@ -412,6 +412,10 @@ set(_MAGNUM_LIBRARY_COMPONENTS
A u d i o D e b u g T o o l s G L M a t e r i a l T o o l s M e s h T o o l s P r i m i t i v e s S c e n e G r a p h
S c e n e T o o l s S h a d e r s S h a d e r T o o l s T e x t T e x t u r e T o o l s T r a d e
W i n d o w l e s s E g l A p p l i c a t i o n E g l C o n t e x t O p e n G L T e s t e r )
# T h e s e l i b r a r i e s a r e e x c l u d e d f r o m D L L d e t e c t i o n i f M a g n u m i s b u i l t a s s h a r e d .
# A d d i t i o n a l l y , a l l * 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 e x c l u d e d a s w e l l .
set ( _MAGNUM_LIBRARY_COMPONENTS_ALWAYS_STATIC
O p e n G L T e s t e r )
set ( _MAGNUM_PLUGIN_COMPONENTS
A n y A u d i o I m p o r t e r A n y I m a g e C o n v e r t e r A n y I m a g e I m p o r t e r A n y S c e n e C o n v e r t e r
A n y S c e n e I m p o r t e r M a g n u m F o n t M a g n u m F o n t C o n v e r t e r O b j I m p o r t e r
@ -426,6 +430,7 @@ set(_MAGNUM_IMPLICITLY_ENABLED_COMPONENTS
G L P r i m i t i v e s )
if ( NOT CORRADE_TARGET_EMSCRIPTEN )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS Vk VulkanTester )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS_ALWAYS_STATIC VulkanTester )
list ( APPEND _MAGNUM_EXECUTABLE_COMPONENTS vk-info )
endif ( )
if ( NOT CORRADE_TARGET_ANDROID )
@ -631,6 +636,22 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
mark_as_advanced ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG
M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E )
# O n W i n d o w s , i f w e h a v e a d y n a m i c b u i l d o f g i v e n l i b r a r y , f i n d t h e
# D L L s a s w e l l . A b u s e find_program ( ) s i n c e t h e D L L s s h o u l d b e
# a l o n g s i d e u s u a l e x e c u t a b l e s . O n M i n G W t h e y h o w e v e r h a v e a l i b
# p r e f i x .
if ( CORRADE_TARGET_WINDOWS AND NOT MAGNUM_BUILD_STATIC AND NOT _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS_ALWAYS_STATIC AND NOT _component MATCHES ".+Application" AND NOT _component MATCHES ".+Context" )
find_program ( MAGNUM_ ${ _COMPONENT } _DLL_DEBUG ${ CMAKE_SHARED_LIBRARY_PREFIX } Magnum ${ _component } -d.dll )
find_program ( MAGNUM_ ${ _COMPONENT } _DLL_RELEASE ${ CMAKE_SHARED_LIBRARY_PREFIX } Magnum ${ _component } .dll )
mark_as_advanced ( MAGNUM_ ${ _COMPONENT } _DLL_DEBUG
M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ R E L E A S E )
# I f n o t o n W i n d o w s o r o n a s t a t i c b u i l d , u n s e t t h e D L L v a r i a b l e s
# t o a v o i d l e a k s w h e n s w i t c h i n g s h a r e d a n d s t a t i c b u i l d s
else ( )
unset ( MAGNUM_ ${ _COMPONENT } _DLL_DEBUG CACHE )
unset ( MAGNUM_ ${ _COMPONENT } _DLL_RELEASE CACHE )
endif ( )
# P l u g i n c o m p o n e n t s
elseif ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
# A u d i o I m p o 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
@ -721,35 +742,102 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
mark_as_advanced ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR )
endif ( )
# D e t e r m i n e i f t h e p l u g i n i s s t a t i c o r d y n a m i c b y r e a d i n g t h e
# p e r - p l u g i n c o n f i g f i l e . P l u g i n s u s e t h i s f o r a u t o m a t i c i m p o r t i f
# s t a t i c .
# T O D O : a d d p e r - l i b r a r y c o n f i g u r e . h a s w e l l , f o r c o n s i s t e n c y w i t h
# e x t r a s , p l u g i n s a n d i n t e g r a t i o n
if ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
find_file ( _MAGNUM_ ${ _COMPONENT } _CONFIGURE_FILE configure.h
H I N T S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ D I R } )
mark_as_advanced ( _MAGNUM_ ${ _COMPONENT } _CONFIGURE_FILE )
# I f t h e f i l e w a s n ' t f o u n d , s k i p t h i s s o i t f a i l s o n t h e F P H S A
# b e l o w a n d n o t r i g h t h e r e .
if ( _MAGNUM_ ${ _COMPONENT } _CONFIGURE_FILE )
file ( READ ${ _MAGNUM_${_COMPONENT } _CONFIGURE_FILE} _magnumPluginConfigure )
string ( REGEX REPLACE ";" "\\\\;" _magnumPluginConfigure "${_magnumPluginConfigure}" )
string ( REGEX REPLACE "\n" ";" _magnumPluginConfigure "${_magnumPluginConfigure}" )
list ( FIND _magnumPluginConfigure "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnumPluginBuildStatic )
if ( NOT _magnumPluginBuildStatic EQUAL -1 )
# T h e v a r i a b l e i s i n c o n s i s t e n t l y n a m e d b e t w e e n C + + a n d
# C M a k e i n e x t r a s , p l u g i n s a n d i n t e g r a t i o n , k e e p i t
# u n d e r s c o r e d / p r i v a t e u n t i l t h a t ' s r e s o l v e d
set ( _MAGNUM_ ${ _COMPONENT } _BUILD_STATIC ON )
endif ( )
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 . 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 .
# T h i s m e a n s t h a t t h e r e s t c a n a l s o r e l y o n t h a t e . g . F i n d E G L . c m a k e i s
# p r e s e n t i n _ M A G N U M _ D E P E N D E N C Y _ M O D U L E _ D I R - - g i v e n t h a t t h e l i b r a r y
# n e e d i n g E G L w a s f o u n d , i t l i k e l y a l s o i n s t a l l e d F i n d E G L f o r i t s e l f .
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 ) )
if (
# I f t h e c o m p o n e n t i s a l i b r a r y , i t s h o u l d h a v e t h e i n c l u d e d i r
( ( _ c o m p o n e n t I N _ L I S T _ M A G N U M _ L I B R A R Y _ C O M P O N E N T S O R _ c o m p o n e n t I N _ L I S T _ M A G N U M _ P L U G I N _ C O M P O N E N T S ) A N D _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ D I R AND (
# A n d i t s h o u l d h a v e a d e b u g l i b r a r y , a n d a D L L f o u n d i f
# e x p e c t e d
( M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ D E B U G AND (
N O T D E F I N E D M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ D E B U G O R
M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ D E B U G ) ) O R
# O r h a v e a r e l e a s e l i b r a r y , a n d a D L L f o u n d i f e x p e c t e d
( M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E AND (
N O T D E F I N E D M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ R E L E A S E O R
M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ R E L E A S E ) ) ) ) O R
# I f t h e c o m p o n e n t i s a n e x e c u t a b l e , i t s h o u l d h a v e j u s t t h e
# l o c a t i o n
( _ c o m p o n e n t I N _ L I S T _ M A G N U M _ E X E C U T A B L E _ C O M P O N E N T S A N D M A G N U M _ $ { _ C O M P O N E N T } _ E X E C U T A B L E )
)
set ( Magnum_ ${ _component } _FOUND TRUE )
else ( )
set ( Magnum_ ${ _component } _FOUND FALSE )
continue ( )
endif ( )
# T a r g e t a n d 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 )
add_library ( Magnum:: ${ _component } UNKNOWN IMPORTED )
# T a r g e t a n d l o c a t i o n f o r l i b r a r i e s
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS )
if ( MAGNUM_BUILD_STATIC OR _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS_ALWAYS_STATIC OR _component MATCHES ".+Application" OR _component MATCHES ".+Context" )
add_library ( Magnum:: ${ _component } STATIC IMPORTED )
else ( )
add_library ( Magnum:: ${ _component } SHARED IMPORTED )
endif ( )
foreach ( _CONFIG DEBUG RELEASE )
if ( NOT MAGNUM_ ${ _COMPONENT } _LIBRARY_ ${ _CONFIG } )
continue ( )
endif ( )
if ( MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S R E L E A S E )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E } )
endif ( )
I M P O R T E D _ C O N F I G U R A T I O N S $ { _ C O N F I G } )
# U n f o r t u n a t e l y f o r a D L L t h e t w o p r o p e r t i e s a r e s w a p p e d o u t ,
# * . l i b g o e s t o I M P L I B , s o i t ' s d u p l i c a t e d l i k e t h i s
if ( DEFINED MAGNUM_ ${ _COMPONENT } _DLL_ ${ _CONFIG } )
# Q u o t e s t o " f i x " K D E ' s h i g l i g h t e r
set_target_properties ( "Magnum::${_component}" PROPERTIES
I M P O R T E D _ L O C A T I O N _ $ { _ C O N F I G } $ { M A G N U M _ $ { _ C O M P O N E N T } _ D L L _ $ { _ C O N F I G } }
I M P O R T E D _ I M P L I B _ $ { _ C O N F I G } $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ $ { _ C O N F I G } } )
else ( )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N _ $ { _ C O N F I G } $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ $ { _ C O N F I G } } )
endif ( )
endforeach ( )
# T a r g e t a n d l o c a t i o n f o r p l u g i n s . N o t d e a l i n g w i t h D L L l o c a t i o n s f o r
# t h o s e .
elseif ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
add_library ( Magnum:: ${ _component } UNKNOWN IMPORTED )
foreach ( _CONFIG DEBUG RELEASE )
if ( NOT MAGNUM_ ${ _COMPONENT } _LIBRARY_ ${ _CONFIG } )
continue ( )
endif ( )
if ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S D E B U G )
I M P O R T E D _ C O N F I G U R A T I O N S $ { _ C O N F I G } )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N _ D E B U G $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ D E B U G } )
endif ( )
I M P O R T E D _ L O C A T I O N _ $ { _ C O N F I G } $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ $ { _ C O N F I G } } )
endforeach ( )
# T a r g e t a n d l o c a t i o n f o r e x e c u t a b l e c o m p o n e n t s
elseif ( _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS )
@ -1020,21 +1108,10 @@ 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
# 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
# i s t h e c a s e w i t h M a g n u m a s a s u b p r o j e c t a n d g i v e n p l u g i n n o t e n a b l e d
# - - t h e r e i t f i n d s j u s t t h e s o u r c e s , w h e r e ' s j u s t c o n f i g u r e . h . c m a k e ,
# a n d t h a t ' s n o t u s e f u l f o r a n y t h i n g . T h e a s s u m p t i o n h e r e i s t h a t i t
# w i l l f a i l l a t e r a n y w a y o n t h e b i n a r y n o t b e i n g f o u n d .
if ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR AND EXISTS ${ _MAGNUM_${_COMPONENT } _INCLUDE_DIR}/configure.h )
# 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
file ( READ ${ _MAGNUM_${_COMPONENT } _INCLUDE_DIR}/configure.h _magnum ${ _component } Configure )
string ( FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum ${ _component } _BUILD_STATIC )
if ( NOT _magnum ${ _component } _BUILD_STATIC EQUAL -1 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ S O U R C E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ D I R } / i m p o r t S t a t i c P l u g i n . c p p )
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
if ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND _MAGNUM_ ${ _COMPONENT } _BUILD_STATIC )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ S O U R C E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ D I R } / i m p o r t S t a t i c P l u g i n . c p p )
endif ( )
# L i n k t o c o r e M a g n u m l i b r a r y , a d d i n t e r - l i b r a r y d e p e n d e n c i e s . I f t h e r e