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:
@ -13,6 +13,12 @@ FIND_PACKAGE(Doxygen)
|
||||
set_package_properties(Doxygen PROPERTIES URL http://www.doxygen.org DESCRIPTION "API documentation generator" TYPE OPTIONAL PURPOSE "Building the API documentation")
|
||||
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
||||
|
||||
SET(LIBRARY_TYPE "DYNAMIC" CACHE STRING "Should the library be STATIC or DYNAMIC")
|
||||
SET_PROPERTY(CACHE LIBRARY_TYPE PROPERTY STRINGS DYNAMIC STATIC)
|
||||
IF(WIN32)
|
||||
SET(LIBRARY_TYPE "STATIC")
|
||||
ENDIF()
|
||||
|
||||
# Qt is required for building the tests, the example and optionally for bundling the documentation
|
||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtTest)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
@ -42,18 +48,6 @@ IF(ENABLE_EXAMPLES)
|
||||
ADD_SUBDIRECTORY(examples/Paging)
|
||||
ADD_SUBDIRECTORY(examples/OpenGL)
|
||||
ADD_SUBDIRECTORY(examples/SmoothLOD)
|
||||
if(ENABLE_STATIC_LIBRARIES)
|
||||
ADD_DEPENDENCIES(BasicExample PolyVoxCoreStatic PolyVoxUtilStatic)
|
||||
ADD_DEPENDENCIES(PagingExample PolyVoxCoreStatic PolyVoxUtilStatic)
|
||||
ADD_DEPENDENCIES(OpenGLExample PolyVoxCoreStatic PolyVoxUtilStatic)
|
||||
ADD_DEPENDENCIES(SmoothLODExample PolyVoxCoreStatic PolyVoxUtilStatic)
|
||||
endif()
|
||||
if(ENABLE_DYNAMIC_LIBRARIES)
|
||||
ADD_DEPENDENCIES(BasicExample PolyVoxCoreDynamic PolyVoxUtilDynamic)
|
||||
ADD_DEPENDENCIES(PagingExample PolyVoxCoreDynamic PolyVoxUtilDynamic)
|
||||
ADD_DEPENDENCIES(OpenGLExample PolyVoxCoreDynamic PolyVoxUtilDynamic)
|
||||
ADD_DEPENDENCIES(SmoothLODExample PolyVoxCoreDynamic PolyVoxUtilDynamic)
|
||||
endif()
|
||||
ENDIF(ENABLE_EXAMPLES)
|
||||
|
||||
INCLUDE(Packaging.cmake)
|
||||
@ -74,8 +68,6 @@ ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(documentation)
|
||||
|
||||
add_feature_info("Static libraries" ENABLE_STATIC_LIBRARIES "Will static libraries be built")
|
||||
add_feature_info("Dynamic libraries" ENABLE_DYNAMIC_LIBRARIES "Will dynamic libraries be built")
|
||||
add_feature_info("Examples" ENABLE_EXAMPLES "Examples of PolyVox usage")
|
||||
add_feature_info("Tests" ENABLE_TESTS "Unit tests")
|
||||
add_feature_info("Bindings" BUILD_BINDINGS "SWIG bindings")
|
||||
@ -89,8 +81,7 @@ feature_summary(WHAT ALL)
|
||||
MESSAGE(STATUS "")
|
||||
MESSAGE(STATUS "Summary")
|
||||
MESSAGE(STATUS "-------")
|
||||
MESSAGE(STATUS "Static libraries: " ${ENABLE_STATIC_LIBRARIES})
|
||||
MESSAGE(STATUS "Dynamic libraries: " ${ENABLE_DYNAMIC_LIBRARIES})
|
||||
MESSAGE(STATUS "Library type: " ${LIBRARY_TYPE})
|
||||
MESSAGE(STATUS "Build examples: " ${ENABLE_EXAMPLES})
|
||||
MESSAGE(STATUS "Build tests: " ${ENABLE_TESTS})
|
||||
MESSAGE(STATUS "Build bindings: " ${BUILD_BINDINGS})
|
||||
|
Reference in New Issue
Block a user