2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

CMakeLists.txt 4.59 KB
Newer Older
schultezub's avatar
schultezub committed
1
#
schultezub's avatar
schultezub committed
2
# CAMPVis - Yet another visualization framework
schultezub's avatar
schultezub committed
3
4
5
# CMake file inspired by Voreen
#

schultezub's avatar
schultezub committed
6
PROJECT(CAMPVis)
schultezub's avatar
schultezub committed
7
8
9
10
11
12
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)

#
# Global Build Options
#

13
OPTION(BUILD_SHARED_LIBS            "Build shared libraries?"                                       ON)
14
15
16
17
18
#OPTION(CAMPVIS_PRECOMPILED_HEADER   "Use pre-compiled headers?"                                     ON)
OPTION(CAMPVIS_DEBUG                "Activate debug code?"                                          ON)
OPTION(CAMPVIS_BUILD_APPLICATION    "Build CAMPVis Application"                                     ON)
OPTION(CAMPVIS_BUILD_CORE           "Build CAMPVis Core"                                            ON)
OPTION(CAMPVIS_BUILD_MODULES        "Build CAMPVis Modules"                                         ON)
19
OPTION(CAMPVIS_ENABLE_SCRIPTING     "Add support for scripting CAMPVis using Lua"                   OFF)
20
OPTION(CAMPVIS_BUILD_LIB_TGT        "Build TGT Library"                                             ON)
Artur Grunau's avatar
Artur Grunau committed
21
OPTION(CAMPVIS_BUILD_LIB_LUA        "Build Lua Library"                                             OFF)
22
OPTION(CAMPVIS_BUILD_DOXYGEN        "Build Doxygen Documentation"                                   OFF)
23
24

OPTION(CAMPVIS_DEPLOY_SHADERS       "Deploy Shader files to binary directory"                       OFF)
25
OPTION(CAMPVIS_GROUP_SOURCE_FILES   "Group source files by directory"                               ON)
26
27
OPTION(CAMPVIS_BUILD_GOOGLETEST     "Build googletest library"                                      OFF)
OPTION(CAMPVIS_BUILD_TEST_SOURCES   "Build Unit Tests of gooogletest"                               OFF)
schultezub's avatar
schultezub committed
28
29

IF(WIN32)
30
31
    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
32
    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
33
34
ENDIF()

35
36
37
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")

schultezub's avatar
schultezub committed
38
39
40
41
#
# Further Build Configurations
#
include(cmake/commonconf.cmake)
42
include(cmake/parseModulesDir.cmake)
schultezub's avatar
schultezub committed
43

44
45
MESSAGE(STATUS "--------------------------------------------------------------------------------")

schultezub's avatar
schultezub committed
46
IF(CAMPVIS_BUILD_LIB_TGT)
schultezub's avatar
schultezub committed
47
48
49
    ADD_SUBDIRECTORY(ext/tgt)
ENDIF()

Artur Grunau's avatar
Artur Grunau committed
50
IF(CAMPVIS_BUILD_LIB_LUA)
51
52
53
    # Keep LUA_BUILD_AS_DLL in sync with BUILD_SHARED_LIBS
    SET(LUA_BUILD_AS_DLL ${BUILD_SHARED_LIBS} CACHE BOOL "Build Lua library as DLL" FORCE)

54
    ADD_SUBDIRECTORY(ext/lua EXCLUDE_FROM_ALL)
55
56
57
58
59

    # If the above command failed, provide a hint how to fix the problem
    IF(NOT TARGET liblua)
        MESSAGE(SEND_ERROR "Did you forget to run `git submodule update --init`?")
    ENDIF(NOT TARGET liblua)
Artur Grunau's avatar
Artur Grunau committed
60
61
ENDIF()

schultezub's avatar
schultezub committed
62
IF(CAMPVIS_BUILD_CORE)
schultezub's avatar
schultezub committed
63
64
65
    ADD_SUBDIRECTORY(core)
ENDIF()

schultezub's avatar
schultezub committed
66
IF(CAMPVIS_BUILD_MODULES)
schultezub's avatar
   
schultezub committed
67
68
69
    ADD_SUBDIRECTORY(modules)
ENDIF()

70

71
IF(CAMPVIS_ENABLE_SCRIPTING)
72
73
74
75
76
77
78
79
80
81
82
    # First, find Lua to setup paths for all projects correctly
    FIND_PACKAGE(Lua REQUIRED)
    IF(LUA_FOUND)
        MESSAGE(STATUS "* Found Lua")
        LIST(APPEND CampvisGlobalDefinitions ${LUA_DEFINITIONS})
        LIST(APPEND CampvisGlobalIncludeDirs ${LUA_INCLUDE_DIR})
        LIST(APPEND CampvisGlobalExternalLibs ${LUA_LIBRARY})
    ELSE(LUA_FOUND)
        MESSAGE(FATAL_ERROR "Lua not found!")
    ENDIF(LUA_FOUND)
    
83
84
85
86
    ADD_SUBDIRECTORY(scripting)
    LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_HAS_SCRIPTING")
ENDIF()

schultezub's avatar
schultezub committed
87
IF(CAMPVIS_BUILD_APPLICATION)
schultezub's avatar
   
schultezub committed
88
89
90
    ADD_SUBDIRECTORY(application)
ENDIF()

91
92
93
94
95
96
97
98
IF(CAMPVIS_BUILD_GOOGLETEST)
    ADD_SUBDIRECTORY(ext/gtest-1.7.0)
ENDIF()

IF(CAMPVIS_BUILD_TEST_SOURCES)
    ADD_SUBDIRECTORY(test)
ENDIF()

99
100
101
102
IF(CAMPVIS_BUILD_DOXYGEN)
    ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL)
ENDIF()

103

schultezub's avatar
schultezub committed
104
105
106
107
#
# Copy External DLLs
#
IF(WIN32)
schultezub's avatar
schultezub committed
108
    # gather Qt4 DLLs - TODO: remove redundant naming of required components 
109
    FIND_PACKAGE(Qt4DLLs COMPONENTS QtCore QtGui QtOpenGL QtNetwork QtXmlPatterns)
schultezub's avatar
schultezub committed
110
111
112
    LIST(APPEND CampvisExternalDllsDebug ${QT_DEBUG_DLLS})
    LIST(APPEND CampvisExternalDllsRelease ${QT_RELEASE_DLLS})

schultezub's avatar
schultezub committed
113
114
    LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug)
    LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease)
schultezub's avatar
schultezub committed
115

schultezub's avatar
schultezub committed
116
    IF(CAMPVIS_COPY_EXTERNAL_DLLS)
schultezub's avatar
schultezub committed
117
        COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false)
schultezub's avatar
schultezub committed
118
119
    ENDIF()
ENDIF()