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 4.97 KB
Newer Older
1
# = CAMPVis - Yet another medical visualization framework =====================
schultezub's avatar
schultezub committed
2
PROJECT(CAMPVis)
3
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)
schultezub's avatar
schultezub committed
4

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

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

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

IF(WIN32)
21 22
    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
23
    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
24 25
ENDIF()

26 27

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

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

35 36 37 38 39
# 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
40
include(cmake/commonconf.cmake)
41
include(cmake/parseModulesDir.cmake)
schultezub's avatar
schultezub committed
42

43 44

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

47 48 49 50 51 52 53
# 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
54 55
ENDIF()

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

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

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

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

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

85

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
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
112
IF(WIN32)
schultezub's avatar
schultezub committed
113
    IF(CAMPVIS_COPY_EXTERNAL_DLLS)
114 115
        LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug)
        LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease)
schultezub's avatar
schultezub committed
116
        COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false)
schultezub's avatar
schultezub committed
117 118
    ENDIF()
ENDIF()
119 120

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