Build only one of static or shared libraries
As discussed on the forums, to simplify the CMake code and avoid having to manually specify dependencies this removes the hack to allow both static and shared libraries to be built at the same time. It introduces the new variable LIBRARY_TYPE which can be either STATIC or DYNAMIC. See: http://www.volumesoffun.com/phpBB3/viewtopic.php?p=3203#p3203
This commit is contained in:
@ -111,42 +111,26 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
#Core
|
||||
#Build
|
||||
IF(ENABLE_STATIC_LIBRARIES)
|
||||
ADD_LIBRARY(PolyVoxCoreStatic STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreStatic PROPERTIES OUTPUT_NAME "PolyVoxCore")
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreStatic PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreStatic PROPERTIES COMPILE_FLAGS "/W4 /wd4251 /wd4127") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
SET(PolyVoxCore_LIBRARY "PolyVoxCoreStatic")
|
||||
IF(LIBRARY_TYPE STREQUAL "STATIC")
|
||||
ADD_LIBRARY(PolyVoxCore STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
|
||||
ENDIF()
|
||||
IF(ENABLE_DYNAMIC_LIBRARIES)
|
||||
ADD_LIBRARY(PolyVoxCoreDynamic SHARED ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreDynamic PROPERTIES OUTPUT_NAME "PolyVoxCore")
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreDynamic PROPERTIES COMPILE_FLAGS "-DPOLYVOX_SHARED_EXPORTS")
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreDynamic PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(PolyVoxCoreDynamic PROPERTIES COMPILE_FLAGS "/W4 /wd4251 /wd4127") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
SET(PolyVoxCore_LIBRARY "PolyVoxCoreDynamic")
|
||||
IF(LIBRARY_TYPE STREQUAL "DYNAMIC")
|
||||
ADD_LIBRARY(PolyVoxCore SHARED ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
|
||||
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "-DPOLYVOX_SHARED_EXPORTS")
|
||||
ENDIF()
|
||||
|
||||
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/W4 /wd4251 /wd4127") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
|
||||
#Install
|
||||
IF(WIN32)
|
||||
IF(ENABLE_STATIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreStatic
|
||||
RUNTIME DESTINATION PolyVoxCore/bin COMPONENT library
|
||||
LIBRARY DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
ARCHIVE DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
IF(ENABLE_DYNAMIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreDynamic
|
||||
RUNTIME DESTINATION PolyVoxCore/bin COMPONENT library
|
||||
LIBRARY DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
ARCHIVE DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
INSTALL(TARGETS PolyVoxCore
|
||||
RUNTIME DESTINATION PolyVoxCore/bin COMPONENT library
|
||||
LIBRARY DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
ARCHIVE DESTINATION PolyVoxCore/lib COMPONENT library
|
||||
)
|
||||
|
||||
#Install the core header files, including the ones in the PolyVoxImpl subfolder.
|
||||
INSTALL(DIRECTORY include DESTINATION PolyVoxCore COMPONENT development PATTERN "*.svn*" EXCLUDE)
|
||||
@ -157,20 +141,11 @@ IF(WIN32)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/PolyVoxCore.pdb DESTINATION PolyVoxCore/lib CONFIGURATIONS Debug)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/PolyVoxCore.pdb DESTINATION PolyVoxCore/lib CONFIGURATIONS RelWithDebInfo)
|
||||
ELSE(WIN32)
|
||||
IF(ENABLE_STATIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreStatic
|
||||
RUNTIME DESTINATION bin COMPONENT library
|
||||
LIBRARY DESTINATION lib COMPONENT library
|
||||
ARCHIVE DESTINATION lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
IF(ENABLE_DYNAMIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreDynamic
|
||||
RUNTIME DESTINATION bin COMPONENT library
|
||||
LIBRARY DESTINATION lib COMPONENT library
|
||||
ARCHIVE DESTINATION lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
INSTALL(TARGETS PolyVoxCore
|
||||
RUNTIME DESTINATION bin COMPONENT library
|
||||
LIBRARY DESTINATION lib COMPONENT library
|
||||
ARCHIVE DESTINATION lib COMPONENT library
|
||||
)
|
||||
|
||||
#Install the core header files, including the ones in the PolyVoxImpl subfolder.
|
||||
INSTALL(DIRECTORY include/ DESTINATION include/PolyVoxCore COMPONENT development PATTERN "*.svn*" EXCLUDE)
|
||||
|
Reference in New Issue
Block a user