In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

CMakeLists.txt 5 KB
Newer Older
1
# = CAMPVis - Yet another medical visualization framework =====================
schultezub's avatar
schultezub committed
2
PROJECT(CAMPVis)
3 4
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2 FATAL_ERROR)
cmake_policy(SET CMP0020 NEW)
schultezub's avatar
schultezub committed
5

6
SET(CAMPVIS_VERSION 1.0.0)
schultezub's avatar
schultezub committed
7

8
# = Global Build Options ======================================================
9
OPTION(BUILD_SHARED_LIBS            "Build shared libraries (strongly recommended!)"                ON)
10
OPTION(CAMPVIS_DEBUG                "Activate debug code?"                                          ON)
11
OPTION(CAMPVIS_BUILD_LIB_CGT        "Build CGT Library"                                             ON)
12 13
OPTION(CAMPVIS_BUILD_APPLICATION    "Build CAMPVis Application"                                     ON)
OPTION(CAMPVIS_BUILD_MODULES        "Build CAMPVis Modules"                                         ON)
14
OPTION(CAMPVIS_ENABLE_SCRIPTING     "Add support for scripting CAMPVis using Lua"                   OFF)
15
OPTION(CAMPVIS_BUILD_DOXYGEN        "Build Doxygen Documentation"                                   OFF)
16 17

OPTION(CAMPVIS_DEPLOY_SHADERS       "Deploy Shader files to binary directory"                       OFF)
18
OPTION(CAMPVIS_GROUP_SOURCE_FILES   "Group source files by directory"                               ON)
19
OPTION(CAMPVIS_ENABLE_TESTING       "Build CAMPVis Unit Tests using gooogletest"                    OFF)
schultezub's avatar
schultezub committed
20 21

IF(WIN32)
22 23
    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)
schultezub's avatar
schultezub committed
24
    OPTION(CAMPVIS_GENERATE_MANIFEST    "Generate manifest in Visual Studio debug builds (switch on when encountering errors using incremental linking)?"          OFF)
schultezub's avatar
schultezub committed
25 26
ENDIF()

27 28

# = Further Build Options =====================================================
29 30 31
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")

32 33 34 35
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)

36 37 38 39 40
# propagate CAMPVIS_ENABLE_SCRIPTING to CAMPVIS_BUILD_LIB_LUA to support deprecated code
IF (CAMPVIS_ENABLE_SCRIPTING)
    SET(CAMPVIS_BUILD_LIB_LUA ON)
ENDIF()

schultezub's avatar
schultezub committed
41
include(cmake/commonconf.cmake)
42
include(cmake/parseModulesDir.cmake)
schultezub's avatar
schultezub committed
43

44 45

# = Start the definition of all CAMPVis targets ===============================
46 47
MESSAGE(STATUS "--------------------------------------------------------------------------------")

48 49 50 51 52 53 54
# 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)
schultezub's avatar
schultezub committed
55 56
ENDIF()

57 58 59
# build scripting targets when enabled
IF(CAMPVIS_ENABLE_SCRIPTING)
    # build Lua from source
60 61
    ADD_SUBDIRECTORY(ext/lua)
    SET(LUA_DIR "${CampvisHome}/ext/lua")
62

63
    # First, find Lua to setup paths for all projects correctly
64 65 66
    LIST(APPEND CampvisGlobalIncludeDirs "${LUA_DIR}/src" "${CMAKE_BINARY_DIR}/ext/lua")
    LIST(APPEND CampvisGlobalExternalLibs "liblua")
    LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_HAS_SCRIPTING")
67
    
68 69 70
    ADD_SUBDIRECTORY(scripting)
ENDIF()

schultezub's avatar
schultezub committed
71
IF(CAMPVIS_BUILD_APPLICATION)
schultezub's avatar
 
schultezub committed
72 73 74
    ADD_SUBDIRECTORY(application)
ENDIF()

75 76
# build campvis-test when enabled
IF(CAMPVIS_ENABLE_TESTING)
77 78 79 80
    ADD_SUBDIRECTORY(ext/gtest-1.7.0)
    ADD_SUBDIRECTORY(test)
ENDIF()

81
# build doxygen when enabled
82 83 84 85
IF(CAMPVIS_BUILD_DOXYGEN)
    ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL)
ENDIF()

86

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
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 =======
schultezub's avatar
schultezub committed
113
IF(WIN32)
schultezub's avatar
schultezub committed
114
    IF(CAMPVIS_COPY_EXTERNAL_DLLS)
115 116
        LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug)
        LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease)
schultezub's avatar
schultezub committed
117
        COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false)
schultezub's avatar
schultezub committed
118 119
    ENDIF()
ENDIF()
120 121

MESSAGE(STATUS "--------------------------------------------------------------------------------")