Browse Source

Disable automatic resource initializers when building static.

That's done manually, and when such a static lib is linked to a DLL, the
suddenly appearing global constructors are unexpected.
pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
cdd0147edb
  1. 8
      src/Magnum/DebugTools/CMakeLists.txt
  2. 7
      src/Magnum/Shaders/CMakeLists.txt
  3. 8
      src/Magnum/TextureTools/CMakeLists.txt

8
src/Magnum/DebugTools/CMakeLists.txt

@ -51,6 +51,14 @@ if(TARGET_GL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2)
corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf)
list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES})
if(BUILD_STATIC)
# On the static build we're importing the resources manually, so no
# need to have the implicit initializers as well.
set_property(SOURCE ${MagnumDebugTools_RESOURCES} APPEND PROPERTY
COMPILE_DEFINITIONS
"CORRADE_AUTOMATIC_INITIALIZER=CORRADE_NOOP"
"CORRADE_AUTOMATIC_FINALIZER=CORRADE_NOOP")
endif()
endif()
if(NOT MAGNUM_TARGET_WEBGL)

7
src/Magnum/Shaders/CMakeLists.txt

@ -63,6 +63,13 @@ set(MagnumShaders_PRIVATE_HEADERS Implementation/CreateCompatibilityShader.h)
add_library(MagnumShadersObjects OBJECT
${MagnumShaders_SRCS}
${MagnumShaders_HEADERS})
if(BUILD_STATIC)
# On the static build we're importing the resources manually, so no need to
# have the implicit initializers as well.
set_property(SOURCE ${MagnumShaders_RCS} APPEND PROPERTY COMPILE_DEFINITIONS
"CORRADE_AUTOMATIC_INITIALIZER=CORRADE_NOOP"
"CORRADE_AUTOMATIC_FINALIZER=CORRADE_NOOP")
endif()
target_include_directories(MagnumShadersObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>)

8
src/Magnum/TextureTools/CMakeLists.txt

@ -34,6 +34,14 @@ set(MagnumTextureTools_HEADERS
if(TARGET_GL)
corrade_add_resource(MagnumTextureTools_RCS resources.conf)
set_target_properties(MagnumTextureTools_RCS-dependencies PROPERTIES FOLDER "Magnum/TextureTools")
if(BUILD_STATIC)
# On the static build we're importing the resources manually, so no
# need to have the implicit initializers as well.
set_property(SOURCE ${MagnumTextureTools_RCS} APPEND PROPERTY
COMPILE_DEFINITIONS
"CORRADE_AUTOMATIC_INITIALIZER=CORRADE_NOOP"
"CORRADE_AUTOMATIC_FINALIZER=CORRADE_NOOP")
endif()
list(APPEND MagnumTextureTools_SRCS
DistanceField.cpp

Loading…
Cancel
Save