Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static libraries being treated as dynamic libs #16

Merged
merged 2 commits into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Magnum/BulletIntegration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
find_package(Magnum REQUIRED SceneGraph Shapes)
find_package(Bullet REQUIRED)

if(BUILD_STATIC)
set(MAGNUM_BULLETINTEGRATION_BUILD_STATIC 1)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)

set(MagnumBulletIntegration_SRCS
ConvertShape.cpp
MotionState.cpp)
Expand All @@ -42,7 +49,9 @@ set(MagnumBulletIntegration_HEADERS
add_library(MagnumBulletIntegration ${SHARED_OR_STATIC}
${MagnumBulletIntegration_SRCS}
${MagnumBulletIntegration_HEADERS})
target_include_directories(MagnumBulletIntegration PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_include_directories(MagnumBulletIntegration PUBLIC
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src)
# Silence pedantic warnings in Bullet headers
target_include_directories(MagnumBulletIntegration SYSTEM PUBLIC ${BULLET_INCLUDE_DIRS})
set_target_properties(MagnumBulletIntegration PROPERTIES DEBUG_POSTFIX "-d")
Expand All @@ -60,6 +69,7 @@ install(TARGETS MagnumBulletIntegration
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumBulletIntegration_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/BulletIntegration)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/BulletIntegration)

if(BUILD_TESTS)
add_subdirectory(Test)
Expand Down
26 changes: 26 additions & 0 deletions src/Magnum/BulletIntegration/configure.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
This file is part of Magnum.

Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#cmakedefine MAGNUM_BULLETINTEGRATION_BUILD_STATIC
12 changes: 9 additions & 3 deletions src/Magnum/BulletIntegration/visibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@

#include <Corrade/Utility/VisibilityMacros.h>

#ifdef MagnumBulletIntegration_EXPORTS
#define MAGNUM_BULLETINTEGRATION_EXPORT CORRADE_VISIBILITY_EXPORT
#include "Magnum/BulletIntegration/configure.h"

#ifndef MAGNUM_BULLETINTEGRATION_BUILD_STATIC
#ifdef MagnumBulletIntegration_EXPORTS
#define MAGNUM_BULLETINTEGRATION_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_BULLETINTEGRATION_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_BULLETINTEGRATION_EXPORT CORRADE_VISIBILITY_IMPORT
#define MAGNUM_BULLETINTEGRATION_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_BULLETINTEGRATION_LOCAL CORRADE_VISIBILITY_LOCAL

Expand Down
12 changes: 11 additions & 1 deletion src/Magnum/OvrIntegration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@

find_package(OVR REQUIRED)

if(BUILD_STATIC)
set(MAGNUM_OVRINTEGRATION_BUILD_STATIC 1)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)

set(MagnumOvrIntegration_SRCS
Compositor.cpp
Context.cpp
Expand All @@ -46,7 +53,9 @@ set(MagnumOvrIntegration_HEADERS
add_library(MagnumOvrIntegration SHARED
${MagnumOvrIntegration_SRCS}
${MagnumOvrIntegration_HEADERS})
target_include_directories(MagnumOvrIntegration PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_include_directories(MagnumOvrIntegration PUBLIC
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src)
set_target_properties(MagnumOvrIntegration PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumOvrIntegration PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand All @@ -60,6 +69,7 @@ install(TARGETS MagnumOvrIntegration
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumOvrIntegration_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OvrIntegration)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OvrIntegration)

if(BUILD_TESTS)
add_subdirectory(Test)
Expand Down
26 changes: 26 additions & 0 deletions src/Magnum/OvrIntegration/configure.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
This file is part of Magnum.

Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#cmakedefine MAGNUM_OVRINTEGRATION_BUILD_STATIC
12 changes: 9 additions & 3 deletions src/Magnum/OvrIntegration/visibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@

#include <Corrade/Utility/VisibilityMacros.h>

#ifdef MagnumOvrIntegration_EXPORTS
#define MAGNUM_OVRINTEGRATION_EXPORT CORRADE_VISIBILITY_EXPORT
#include "Magnum/OvrIntegration/configure.h"

#ifndef MAGNUM_OVRINTEGRATION_BUILD_STATIC
#ifdef MagnumOvrIntegration_EXPORTS
#define MAGNUM_OVRINTEGRATION_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_OVRINTEGRATION_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_OVRINTEGRATION_EXPORT CORRADE_VISIBILITY_IMPORT
#define MAGNUM_OVRINTEGRATION_EXPORT CORRADE_VISIBILITY_STATIC
#endif

#endif