Make dynamic or static libraries optional
The user can choose static or dynamic libraries using BUILD_STATIC_LIBRARIES and BUILD_DYNAMIC_LIBRARIES. By default Windows will only build static libraries and Linux will build both.
This commit is contained in:
@ -80,7 +80,6 @@ SET(IMPL_INC_FILES
|
||||
)
|
||||
|
||||
#NOTE: The following line should be uncommented when building shared libs.
|
||||
#ADD_DEFINITIONS(-DPOLYVOX_SHARED_EXPORTS) #Export symbols in the .dll
|
||||
|
||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||
#They may have other uses too...
|
||||
@ -95,20 +94,42 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
#Core
|
||||
#Build
|
||||
ADD_LIBRARY(PolyVoxCore STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
|
||||
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/wd4251") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
IF(BUILD_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 "/wd4251") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
SET(PolyVoxCore_LIBRARY "PolyVoxCoreStatic")
|
||||
ENDIF()
|
||||
IF(BUILD_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 "/wd4251") #Disable warning on STL exports
|
||||
ENDIF(MSVC)
|
||||
SET(PolyVoxCore_LIBRARY "PolyVoxCoreDynamic")
|
||||
ENDIF()
|
||||
|
||||
#Install
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS PolyVoxCore
|
||||
RUNTIME DESTINATION PolyVoxCore/bin
|
||||
LIBRARY DESTINATION PolyVoxCore/lib
|
||||
ARCHIVE DESTINATION PolyVoxCore/lib
|
||||
COMPONENT library
|
||||
)
|
||||
IF(BUILD_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(BUILD_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 the core header files, including the ones in the PolyVoxImpl subfolder.
|
||||
INSTALL(DIRECTORY include DESTINATION PolyVoxCore COMPONENT development PATTERN "*.svn*" EXCLUDE)
|
||||
@ -118,12 +139,20 @@ IF(WIN32)
|
||||
#found was: http://www.cmake.org/pipermail/cmake/2007-October/016924.html (and it is a bit ugly).
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../Debug/PolyVoxCore.pdb DESTINATION PolyVoxCore/lib CONFIGURATIONS Debug)
|
||||
ELSE(WIN32)
|
||||
INSTALL(TARGETS PolyVoxCore
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
COMPONENT library
|
||||
)
|
||||
IF(BUILD_STATIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreStatic
|
||||
RUNTIME DESTINATION bin COMPONENT library
|
||||
LIBRARY DESTINATION lib COMPONENT library
|
||||
ARCHIVE DESTINATION lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
IF(BUILD_DYNAMIC_LIBRARIES)
|
||||
INSTALL(TARGETS PolyVoxCoreDynamic
|
||||
RUNTIME DESTINATION bin COMPONENT library
|
||||
LIBRARY DESTINATION lib COMPONENT library
|
||||
ARCHIVE DESTINATION lib COMPONENT library
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
#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