# = CAMPVis - Yet another medical visualization framework ===================== CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2 FATAL_ERROR) cmake_policy(SET CMP0020 NEW) PROJECT(CAMPVis) SET(CAMPVIS_VERSION 1.0.0) # = Global Build Options ====================================================== OPTION(BUILD_SHARED_LIBS "Build shared libraries (strongly recommended!)" ON) OPTION(CAMPVIS_DEBUG "Activate debug code?" ON) OPTION(CAMPVIS_BUILD_LIB_CGT "Build CGT Library" ON) OPTION(CAMPVIS_BUILD_APPLICATION "Build CAMPVis Application" ON) OPTION(CAMPVIS_BUILD_MODULES "Build CAMPVis Modules" ON) OPTION(CAMPVIS_ENABLE_SCRIPTING "Add support for scripting CAMPVis using Lua" OFF) OPTION(CAMPVIS_BUILD_DOXYGEN "Build Doxygen Documentation" OFF) OPTION(CAMPVIS_DEPLOY_SHADERS "Deploy Shader files to binary directory" OFF) OPTION(CAMPVIS_GROUP_SOURCE_FILES "Group source files by directory" ON) OPTION(CAMPVIS_ENABLE_TESTING "Build CAMPVis Unit Tests using gooogletest" OFF) IF(WIN32) OPTION(CAMPVIS_COPY_EXTERNAL_DLLS "Copy external DLLs to bin directory?" ON) OPTION(CAMPVIS_INCREMENTAL_LINKING "Enable incremental linking in Visual Studio debug builds?" ON) OPTION(CAMPVIS_GENERATE_MANIFEST "Generate manifest in Visual Studio debug builds (switch on when encountering errors using incremental linking)?" OFF) ENDIF() # = Further Build Options ===================================================== SET(CAMPVIS_DEFAULT_ENABLED_MODULES "STABLE_NO_DEPENDENCIES" CACHE STRING "Default CAMPVis modules to activate") SET_PROPERTY(CACHE CAMPVIS_DEFAULT_ENABLED_MODULES PROPERTY STRINGS "NONE" "STABLE_NO_DEPENDENCIES" "STABLE_WITH_EXTERNAL_DEPENDENCIES" "TESTING" "ALL") IF(NOT BUILD_SHARED_LIBS) MESSAGE(WARNING "Building shared libraries is turned off. Thus, CAMPVis will most probably not work as intended!\nPlease turn BUILD_SHARED_LIBS on unless you know what you're doing!") ENDIF(NOT BUILD_SHARED_LIBS) # propagate CAMPVIS_ENABLE_SCRIPTING to CAMPVIS_BUILD_LIB_LUA to support deprecated code IF (CAMPVIS_ENABLE_SCRIPTING) SET(CAMPVIS_BUILD_LIB_LUA ON) ENDIF() include(cmake/commonconf.cmake) include(cmake/parseModulesDir.cmake) # = Start the definition of all CAMPVis targets =============================== MESSAGE(STATUS "--------------------------------------------------------------------------------") # cgt, sigslot and campvis-core are enabled by default. ADD_SUBDIRECTORY(ext/cgt) ADD_SUBDIRECTORY(ext/sigslot) ADD_SUBDIRECTORY(core) IF(CAMPVIS_BUILD_MODULES) ADD_SUBDIRECTORY(modules) ENDIF() # build scripting targets when enabled IF(CAMPVIS_ENABLE_SCRIPTING) # build Lua from source ADD_SUBDIRECTORY(ext/lua) SET(LUA_DIR "${CampvisHome}/ext/lua") # First, find Lua to setup paths for all projects correctly LIST(APPEND CampvisGlobalIncludeDirs "${LUA_DIR}/src" "${CMAKE_BINARY_DIR}/ext/lua") LIST(APPEND CampvisGlobalExternalLibs "liblua") LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_HAS_SCRIPTING") ADD_SUBDIRECTORY(scripting) ENDIF() IF(CAMPVIS_BUILD_APPLICATION) ADD_SUBDIRECTORY(application) ENDIF() # build campvis-test when enabled IF(CAMPVIS_ENABLE_TESTING) ADD_SUBDIRECTORY(ext/googletest-release-1.8.0) ADD_SUBDIRECTORY(test) ENDIF() # build doxygen when enabled IF(CAMPVIS_BUILD_DOXYGEN) ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL) ENDIF() MESSAGE(STATUS "--------------------------------------------------------------------------------") MESSAGE(STATUS "Finishing up") # = Export all CAMPVis Targets so that they can be included easily ============ # write package version file write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/CAMPVisConfigVersion.cmake" VERSION ${CAMPVIS_VERSION} COMPATIBILITY AnyNewerVersion ) # write campvis targets file export(EXPORT campvis-targets FILE "${CMAKE_CURRENT_BINARY_DIR}/CAMPVisTargets.cmake" # NAMESPACE Upstream:: ) # write campvis configuration file configure_file("${CampvisHome}/cmake/CAMPVisConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/CAMPVisConfig.cmake" @ONLY ) #INSTALL(EXPORT campvis-targets NAMESPACE Upstream:: DESTINATION ${CampvisLibInstallDir}) EXPORT(PACKAGE CAMPVis) # = Copy Windows DLLs to binary dir for improved development experience ======= IF(WIN32) IF(CAMPVIS_COPY_EXTERNAL_DLLS) LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug) LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease) COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false) ENDIF() ENDIF() MESSAGE(STATUS "--------------------------------------------------------------------------------")