@ -28,23 +28,40 @@
# p r o p e r t y t h a t w o u l d h a v e t o b e s e t o n e a c h t a r g e t s e p a r a t e l y .
set ( CMAKE_FOLDER "Magnum/Shaders" )
if ( NOT MAGNUM_WITH_GL )
message ( SEND_ERROR "Shaders are available only if MAGNUM_WITH_GL is enabled" )
endif ( )
set ( MagnumShaders_SRCS )
set ( MagnumShaders_GracefulAssert_SRCS
L i n e . c p p )
set ( MagnumShaders_HEADERS
D i s t a n c e F i e l d V e c t o r . h
F l a t . h
G e n e r i c . h
L i n e . h
M e s h V i s u a l i z e r . h
P h o n g . h
S h a d e r s . h
V e c t o r . h
v i s i b i l i t y . h )
# H e a d e r f i l e s t o d i s p l a y i n p r o j e c t v i e w o f I D E s o n l y
set ( MagnumShaders_PRIVATE_HEADERS
I m p l e m e n t a t i o n / l i n e M i t e r L i m i t . h )
if ( MAGNUM_TARGET_GL )
if ( MAGNUM_TARGET_GLES2 )
corrade_add_resource ( MagnumShaders_RESOURCES_GL resources-gles2.conf )
else ( )
corrade_add_resource ( MagnumShaders_RESOURCES_GL resources-gl.conf )
endif ( )
set ( MagnumShaders_SRCS
li st( APPEND MagnumShaders_SRCS
$ { M a g n u m S h a d e r s _ R E S O U R C E S _ G L } )
set ( MagnumShaders_GracefulAssert_SRCS
li st( APPEND MagnumShaders_GracefulAssert_SRCS
D i s t a n c e F i e l d V e c t o r G L . c p p
F l a t G L . c p p
L i n e . c p p
M e s h V i s u a l i z e r G L . c p p
P h o n g G L . c p p
V e c t o r G L . c p p
@ -52,29 +69,16 @@ set(MagnumShaders_GracefulAssert_SRCS
g l S h a d e r W r a p p e r . c p p )
set ( MagnumShaders_HEADERS
D i s t a n c e F i e l d V e c t o r . h
list ( APPEND MagnumShaders_HEADERS
D i s t a n c e F i e l d V e c t o r G L . h
F l a t . h
F l a t G L . h
G e n e r i c . h
G e n e r i c G L . h
L i n e . h
M e s h V i s u a l i z e r . h
M e s h V i s u a l i z e r G L . h
P h o n g . h
P h o n g G L . h
S h a d e r s . h
V e c t o r . h
V e c t o r G L . h
V e r t e x C o l o r G L . h
g l S h a d e r W r a p p e r . h
v i s i b i l i t y . h )
# H e a d e r f i l e s t o d i s p l a y i n p r o j e c t v i e w o f I D E s o n l y
set ( MagnumShaders_PRIVATE_HEADERS
I m p l e m e n t a t i o n / l i n e M i t e r L i m i t . h )
g l S h a d e r W r a p p e r . h )
if ( NOT MAGNUM_TARGET_GLES2 )
list ( APPEND MagnumShaders_GracefulAssert_SRCS
@ -88,8 +92,11 @@ if(MAGNUM_BUILD_DEPRECATED)
list ( APPEND MagnumShaders_HEADERS
V e r t e x C o l o r . h )
endif ( )
endif ( )
# O b j e c t s s h a r e d b e t w e e n m a i n a n d t e s t l i b r a r y
# O b j e c t s s h a r e d b e t w e e n m a i n a n d t e s t l i b r a r y . O n n o n - G L b u i l d s c o n t a i n s
# n o t h i n g s o i t ' s n o t e v e n d e f i n e d .
if ( MAGNUM_TARGET_GL )
add_library ( MagnumShadersObjects OBJECT
$ { M a g n u m S h a d e r s _ S R C S }
$ { M a g n u m S h a d e r s _ H E A D E R S }
@ -110,10 +117,14 @@ endif()
if ( NOT MAGNUM_BUILD_STATIC OR MAGNUM_BUILD_STATIC_PIC )
set_target_properties ( MagnumShadersObjects PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif ( )
set ( MagnumShadersObjects_OBJECTS $< TARGET_OBJECTS:MagnumShadersObjects > )
else ( )
set ( MagnumShadersObjects_OBJECTS )
endif ( )
# M a i n S h a d e r s l i b r a r y
add_library ( MagnumShaders ${ SHARED_OR_STATIC }
$ < T A R G E T _ O B J E C T S : M a g n u m S h a d e r s O b j e c t s >
$ { M a g n u m S h a d e r s O b j e c t s _ O B J E C T S }
$ { M a g n u m S h a d e r s _ G r a c e f u l A s s e r t _ S R C S } )
set_target_properties ( MagnumShaders PROPERTIES DEBUG_POSTFIX "-d" )
if ( NOT MAGNUM_BUILD_STATIC )
@ -121,9 +132,10 @@ if(NOT MAGNUM_BUILD_STATIC)
elseif ( MAGNUM_BUILD_STATIC_PIC )
set_target_properties ( MagnumShaders PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif ( )
target_link_libraries ( MagnumShaders PUBLIC
M a g n u m
M a g n u m G L )
target_link_libraries ( MagnumShaders PUBLIC Magnum )
if ( MAGNUM_TARGET_GL )
target_link_libraries ( MagnumShaders PUBLIC MagnumGL )
endif ( )
install ( TARGETS MagnumShaders
R U N T I M E D E S T I N A T I O N $ { M A G N U M _ B I N A R Y _ I N S T A L L _ D I R }
@ -134,7 +146,7 @@ install(FILES ${MagnumShaders_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}
if ( MAGNUM_BUILD_TESTS )
# L i b r a r y w i t h g r a c e f u l a s s e r t f o r t e s t i n g
add_library ( MagnumShadersTestLib ${ SHARED_OR_STATIC } ${ EXCLUDE_FROM_ALL_IF_TEST_TARGET }
$ < T A R G E T _ O B J E C T S : M a g n u m S h a d e r s O b j e c t s >
$ { M a g n u m S h a d e r s O b j e c t s _ O B J E C T S }
$ { M a g n u m S h a d e r s _ G r a c e f u l A s s e r t _ S R C S } )
set_target_properties ( MagnumShadersTestLib PROPERTIES DEBUG_POSTFIX "-d" )
target_compile_definitions ( MagnumShadersTestLib PRIVATE
@ -142,9 +154,10 @@ if(MAGNUM_BUILD_TESTS)
if ( MAGNUM_BUILD_STATIC_PIC )
set_target_properties ( MagnumShadersTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif ( )
target_link_libraries ( MagnumShadersTestLib PUBLIC
M a g n u m
M a g n u m G L )
target_link_libraries ( MagnumShadersTestLib PUBLIC Magnum )
if ( MAGNUM_TARGET_GL )
target_link_libraries ( MagnumShadersTestLib PUBLIC MagnumGL )
endif ( )
add_subdirectory ( Test ${ EXCLUDE_FROM_ALL_IF_TEST_TARGET } )
endif ( )