@ -563,6 +563,15 @@ if(Magnum_FIND_COMPONENTS)
list ( REMOVE_DUPLICATES Magnum_FIND_COMPONENTS )
endif ( )
# S p e c i a l c a s e s o f i n c l u d e p a t h s . L i b r a r i e s n o t l i s t e d h e r e h a v e a p a t h s u f f i x
# a n d i n c l u d e n a m e d e r i v e d f r o m t h e l i b r a r y n a m e i n t h e l o o p b e l o w .
set ( _MAGNUM_MATERIALTOOLS_INCLUDE_PATH_NAMES PhongToPbrMetallicRoughness.h )
set ( _MAGNUM_MESHTOOLS_INCLUDE_PATH_NAMES CompressIndices.h )
set ( _MAGNUM_OPENGLTESTER_INCLUDE_PATH_SUFFIX Magnum/GL )
set ( _MAGNUM_VULKANTESTER_INCLUDE_PATH_SUFFIX Magnum/Vk )
set ( _MAGNUM_PRIMITIVES_INCLUDE_PATH_NAMES Cube.h )
set ( _MAGNUM_SCENETOOLS_INCLUDE_PATH_NAMES Hierarchy.h )
# F i n d a l l c o m p o n e n t s . M a i n t a i n a l i s t o f c o m p o n e n t s t h a t ' l l n e e d t o h a v e
# t h e i r o p t i o n a l d e p e n d e n c i e s c h e c k e d .
set ( _MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD )
@ -579,9 +588,20 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS )
add_library ( Magnum:: ${ _component } UNKNOWN IMPORTED )
# S e t l i b r a r y d e f a u l t s , f i n d t h e l i b r a r y
# I n c l u d e p a t h n a m e s t o f i n d , u n l e s s s p e c i f i e d a b o v e a l r e a d y .
# A p p l i c a t i o n a n d c o n t e x t l i b r a r i e s a r e a s p e c i a l c a s e a s w e l l .
if ( _component MATCHES ".+Application" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
elseif ( _component MATCHES ".+Context" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES GLContext.h )
endif ( )
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/ ${ _component } )
endif ( )
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _component } .h )
endif ( )
# T r y t o f i n d b o t h d e b u g a n d r e l e a s e v e r s i o n
find_library ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG Magnum ${ _component } -d )
@ -600,7 +620,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# A u d i o i m p o r t e r c l a s s i s A u d i o : : * I m p o r t e r , t h u s w e n e e d t o
# c o n v e r t * A u d i o I m p o r t e r . h t o * I m p o r t e r . h
string ( REPLACE "AudioImporter" "Importer" _MAGNUM_ ${ _COMPONENT } _HEADER_NAME "${_component}" )
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _MAGNUM_${_COMPONENT } _HEADER_NAME}.h )
endif ( )
# S h a d e r C o n v e r t e r p l u g i n s p e c i f i c n a m e s u f f i x e s
elseif ( _component MATCHES ".+ShaderConverter$" )
@ -627,8 +649,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX fontconverters )
endif ( )
# D o n ' t o v e r r i d e t h e e x c e p t i o n f o r * A u d i o I m p o r t e r p l u g i n s
# I n c l u d e p a t h n a m e s t o f i n d , u n l e s s s p e c i f i e d a b o v e
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX MagnumPlugins/ ${ _component } )
endif ( )
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _component } .h )
endif ( )
@ -676,6 +700,23 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
continue ( )
endif ( )
# F i n d l i b r a r y / p l u g i n i n c l u d e s
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
find_path ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR
N A M E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ N A M E S }
H I N T S $ { M A G N U M _ I N C L U D E _ D I R } / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ S U F F I X } )
mark_as_advanced ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR )
endif ( )
# D e c i d e i f t h e l i b r a r y w a s f o u n d . I f n o t , s k i p t h e r e s t , w h i c h
# p o p u l a t e s t h e t a r g e t p r o p e r t i e s a n d f i n d s a d d i t i o n a l d e p e n d e n c i e s .
if ( ( ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS ) AND _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR AND ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG OR MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE ) ) OR ( _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS AND MAGNUM_ ${ _COMPONENT } _EXECUTABLE ) )
set ( Magnum_ ${ _component } _FOUND TRUE )
else ( )
set ( Magnum_ ${ _component } _FOUND FALSE )
continue ( )
endif ( )
# L i b r a r y l o c a t i o n f o r l i b r a r i e s / p l u g i n s
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
if ( MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE )
@ -695,8 +736,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# A p p l i c a t i o n s
if ( _component MATCHES ".+Application" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
# A n d r o i d a p p l i c a t i o n d e p e n d e n c i e s
if ( _component STREQUAL AndroidApplication )
find_package ( EGL )
@ -859,9 +898,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# C o n t e x t l i b r a r i e s
elseif ( _component MATCHES ".+Context" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES GLContext.h )
# G L X c o n t e x t d e p e n d e n c i e s
if ( _component STREQUAL GlxContext )
# W i t h GLVND ( since CMake 3.10 ) w e n e e d t o e x p l i c i t l y l i n k t o
@ -928,40 +964,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L E S 3 : : O p e n G L E S 3 )
endif ( )
# M a t e r i a l T o o l s l i b r a r y
elseif ( _component STREQUAL MaterialTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES PhongToPbrMetallicRoughness.h )
# M e s h T o o l s l i b r a r y
elseif ( _component STREQUAL MeshTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES CompressIndices.h )
# O p e n G L T e s t e r l i b r a r y
elseif ( _component STREQUAL OpenGLTester )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/GL )
# V u l k a n T e s t e r l i b r a r y
elseif ( _component STREQUAL VulkanTester )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Vk )
# P r i m i t i v e s l i b r a r y
elseif ( _component STREQUAL Primitives )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Cube.h )
# N o s p e c i a l s e t u p f o r M a t e r i a l T o o l s l i b r a r y
# N o s p e c i a l s e t u p f o r M e s h T o o l s l i b r a r y
# N o s p e c i a l s e t u p f o r O p e n G L T e s t e r l i b r a r y
# N o s p e c i a l s e t u p f o r V u l k a n T e s t e r l i b r a r y
# N o s p e c i a l s e t u p f o r P r i m i t i v e s l i b r a r y
# N o s p e c i a l s e t u p f o r S c e n e G r a p h l i b r a r y
# S c e n e T o o l s l i b r a r y
elseif ( _component STREQUAL SceneTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Hierarchy.h )
# N o s p e c i a l s e t u p f o r S c e n e T o o l s l i b r a r y
# N o s p e c i a l s e t u p f o r S h a d e r T o o l s l i b r a r y
# N o s p e c i a l s e t u p f o r S h a d e r s l i b r a r y
# N o s p e c i a l s e t u p f o r T e x t l i b r a r y
# T e x t u r e T o o l s l i b r a r y
elseif ( _component STREQUAL TextureTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Atlas.h )
# N o s p e c i a l s e t u p f o r T e x t u r e T o o l s l i b r a r y
# N o s p e c i a l s e t u p f o r T r a d e l i b r a r y
# V k l i b r a r y
@ -982,14 +995,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# N o s p e c i a l s e t u p f o r T g a I m p o r t e r p l u g i n
# N o s p e c i a l s e t u p f o r W a v A u d i o I m p o r t e r p l u g i n
# F i n d l i b r a r y / p l u g i n i n c l u d e s
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
find_path ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR
N A M E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ N A M E S }
H I N T S $ { M A G N U M _ I N C L U D E _ D I R } / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ S U F F I X } )
mark_as_advanced ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR )
endif ( )
# A u t o m a t i c i m p o r t o f s t a t i c p l u g i n s . S k i p i n c a s e t h e i n c l u d e d i r w a s
# n o t f o u n d - - t h a t ' l l f a i l l a t e r w i t h a p r o p e r m e s s a g e . S k i p i t a l s o
# i f t h e i n c l u d e d i r d o e s n ' t c o n t a i n t h e g e n e r a t e d c o n f i g u r e . h , w h i c h
@ -1031,13 +1036,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
list ( APPEND _MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD ${ _component } )
endif ( )
endif ( )
# D e c i d e i f t h e l i b r a r y w a s f o u n d
if ( ( ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS ) AND _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR AND ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG OR MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE ) ) OR ( _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS AND MAGNUM_ ${ _COMPONENT } _EXECUTABLE ) )
set ( Magnum_ ${ _component } _FOUND TRUE )
else ( )
set ( Magnum_ ${ _component } _FOUND FALSE )
endif ( )
endif ( )
# G l o b a l a l i a s e s f o r W i n d o w l e s s * A p p l i c a t i o n , * A p p l i c a t i o n a n d * C o n t e x t