-
Notifications
You must be signed in to change notification settings - Fork 36
/
CMakeLists.txt
136 lines (111 loc) · 4.83 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# MegaMol
# Copyright (c) 2020, MegaMol Dev Team
# All rights reserved.
#
cmake_minimum_required(VERSION 3.19...3.29 FATAL_ERROR)
# Vcpkg setup
set(MEGAMOL_VCPKG_VERSION "2024.07.12") # Update default-registry baseline in vcpkg.json when changing!
include(cmake/megamol_vcpkg_setup.cmake)
include(cmake/megamol_feature_option.cmake)
include(cmake/megamol_vcpkg_empty_port.cmake)
# MegaMol vcpkg features
megamol_feature_option(CGAL "Enable CGAL support." OFF)
megamol_feature_option(CUDA "Enable CUDA support." OFF)
megamol_feature_option(MPI "Enable MPI support." OFF)
megamol_feature_option(NVPERF "Enable NVPerf support." OFF)
megamol_feature_option(OPENGL "Enable OpenGL support." ON)
megamol_feature_option(OSPRAY "Enable OSPRay support." OFF)
megamol_feature_option(POWER "Enable power measurement support." OFF)
megamol_feature_option(PROFILING "Enable profiling support." OFF)
megamol_feature_option(STACKTRACE "Enable Boost.Stacktrace support." OFF)
megamol_feature_option(TRACY "Enable tracy support." OFF)
megamol_feature_option(VTKM "Enable VTK-m support." OFF)
# MegaMol vcpkg features (dependent options)
megamol_feature_option(CUESDK "Enable Corsair CUESDK support." OFF "WIN32")
megamol_feature_option(OPENGL_DEBUGGROUPS "Inject OpenGL debug groups into calls." OFF "MEGAMOL_USE_OPENGL")
megamol_feature_option(POWER_VISA "Enable power measurement VISA sensors." OFF "MEGAMOL_USE_POWER")
megamol_feature_option(VR_INTEROP "Enable MegaMol-Unity VR Interop via Spout2." OFF "WIN32;MEGAMOL_USE_OPENGL")
# Disable in source build
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# Catch deprecated options before project()
include(cmake/deprecation_warning.cmake)
# Project
project(megamol
VERSION 1.3.0
LANGUAGES C CXX)
# Allow CI dependency build to stop here.
if (MEGAMOL_STOP_AFTER_VCPKG)
return()
endif ()
# Default build type
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif ()
# Default install prefix
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
endif ()
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) # This will replace "\" by "/"
# Modules
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# MegaMol config
include(megamol_config)
# MegaMol build info library (version + config)
include(megamol_build_info)
# MegaMol targets
# Frontend Resources, Input Events interfaces
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/frontend/resources)
# Frontend Services (e.g. OpenGL_GLFW provider)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/frontend/services)
# Vislib
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vislib)
if (MEGAMOL_USE_OPENGL)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vislib_gl)
endif ()
# Core
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/core)
if (MEGAMOL_USE_OPENGL)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/core_gl)
endif ()
# Plugins
add_subdirectory(plugins)
if (MEGAMOL_USE_OPENGL)
target_link_libraries(plugins INTERFACE core_gl)
target_sources(plugins INTERFACE $<TARGET_OBJECTS:core_gl>)
endif ()
# MegaMol.exe
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/frontend/main)
target_link_libraries(megamol PRIVATE plugins)
# Utils
add_subdirectory(utils)
# Add directory structure for visual studio
if (WIN32)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE)
endif ()
# Additional downloaded and installed repositories
include(cmake/megamol_extra_repo.cmake)
# Examples
megamol_extra_repo(examples
GIT_REPO "https://github.com/UniStuttgart-VISUS/megamol-examples.git"
DEFAULT_ON)
# Tests
megamol_extra_repo(tests
GIT_REPO "https://github.com/UniStuttgart-VISUS/megamol-tests.git")
# Install vcpkg libraries
# X_VCPKG_APPLOCAL_DEPS_INSTALL currently does only work for windows, in addition only actually used dll's are
# installed. This is a problem for libraries that load dll's dynamically on runtime (i.e. ospray).
# Therefore, we just copy all vcpkg libraries to our install dir, until vcpkg may has a better option in future.
if (WIN32)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows/$<$<CONFIG:Debug>:debug/>bin/
DESTINATION "${CMAKE_INSTALL_BINDIR}"
FILES_MATCHING PATTERN "*.dll" PATTERN "*.pdb")
else ()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-linux/$<$<CONFIG:Debug>:debug/>lib/
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FILES_MATCHING PATTERN "*.so*")
endif ()