-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
149 lines (122 loc) · 5.6 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
137
138
139
140
141
142
143
144
145
146
147
148
149
if (WIN32)
# Needs 3.15 for CMAKE_MSVC_RUNTIME_LIBRARY.
cmake_minimum_required(VERSION 3.15)
else()
cmake_minimum_required(VERSION 3.12)
endif()
if (POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()
project(DeepSea)
# Build options
# Use if since BUILD_SHARED_LIBS defaults to unset.
if (BUILD_SHARED_LIBS)
set(DEEPSEA_SHARED_DEFAULT ON)
else()
set(DEEPSEA_SHARED_DEFAULT OFF)
endif()
set(DEEPSEA_SHARED ${DEEPSEA_SHARED_DEFAULT} CACHE BOOL "Build DeepSea using shared libraries.")
set(DEEPSEA_SINGLE_SHARED OFF CACHE BOOL "Build DeepSea as a single shared library for all modules.")
set(DEEPSEA_STATIC_RUNTIME OFF CACHE BOOL "Use static runtime library on Windows.")
set(DEEPSEA_PROFILING ON CACHE BOOL "Enable profiling of code.")
set(DEEPSEA_GPU_PROFILING OFF CACHE BOOL "Enable profiling of the GPU.")
set(DEEPSEA_SYSTEM_MSL OFF CACHE BOOL "Use the system installed version of MSL.")
if (DEEPSEA_SINGLE_SHARED)
set(DEEPSEA_SHARED ON CACHE BOOL "" FORCE)
endif()
# Options for disabling portions of the build.
set(DEEPSEA_BUILD_TESTS ON CACHE BOOL "Build unit tests.")
set(DEEPSEA_BUILD_DOCS ON CACHE BOOL "Build documentation.")
set(DEEPSEA_BUILD_EASY_PROFILER ON CACHE BOOL "Build the easy_profiler integration for profiling.")
set(DEEPSEA_BUILD_RENDER ON CACHE BOOL "Build rendering libraries.")
set(DEEPSEA_BUILD_RENDER_MOCK ON CACHE BOOL "Build mock rendering implementation, used by tests.")
set(DEEPSEA_BUILD_RENDER_OPENGL ON CACHE BOOL "Build OpenGL rendering implementation.")
set(DEEPSEA_BUILD_RENDER_VULKAN ON CACHE BOOL "Build Vulkan rendering implementation.")
set(DEEPSEA_BUILD_RENDER_METAL ON CACHE BOOL "Build Metal rendering implementation.")
set(DEEPSEA_BUILD_TEXT ON CACHE BOOL "Build text rendering library.")
set(DEEPSEA_BUILD_VECTOR_DRAW ON CACHE BOOL "Build vector draw library.")
set(DEEPSEA_BUILD_PARTICLE ON CACHE BOOL "Build particle library.")
set(DEEPSEA_BUILD_ANIMATION ON CACHE BOOL "Build animation library.")
set(DEEPSEA_BUILD_SCENE ON CACHE BOOL "Build scene library.")
set(DEEPSEA_BUILD_PHYSICS ON CACHE BOOL "Build physics library.")
set(DEEPSEA_BUILD_APPLICATION ON CACHE BOOL "Build application framework libraries.")
set(DEEPSEA_BUILD_APPLICATION_SDL ON CACHE BOOL "Build SDL application implementation.")
# OpenGL specific options.
set(DEEPSEA_GLES OFF CACHE BOOL "Use OpenGL ES rather than desktop OpenGL.")
set(DEEPSEA_TARGET_GLES_VERSION "30" CACHE STRING
"The version of OpenGL ES to use times 10. This is currently only used for Apple platforms.")
set(DEEPSEA_PREFER_EGL OFF CACHE BOOL "Prefer EGL to the platform-specific loader.")
# Misc options.
set(DEEPSEA_OUTPUT_DIR ${CMAKE_BINARY_DIR}/output CACHE PATH "Folder for placing the build output.")
set(DEEPSEA_EXPORTS_DIR ${CMAKE_BINARY_DIR}/cmake CACHE PATH
"Folder for placing the cmake exports while building. Useful when embedding in other projects.")
set(DEEPSEA_ROOT_FOLDER DeepSea CACHE STRING
"Root folder for the DeepSea projects. Usefull when embedding in other projects.")
set(DEEPSEA_INSTALL ON CACHE BOOL "Allow installation for DeepSea components.")
set(DEEPSEA_INSTALL_SET_RPATH ON CACHE BOOL "Set rpath for library and tool on installation.")
set(DEEPSEA_ANDROID_ASSETS_DIR src/main/assets CACHE PATH
"Folder relative to project app directory to place assets for Android.")
set(DEEPSEA_NO_PREBUILT_LIBS OFF CACHE BOOL "Don't use any pre-built library dependencies.")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (DEEPSEA_SHARED)
set(DEEPSEA_LIB SHARED)
else()
set(DEEPSEA_LIB STATIC)
endif()
if (DEEPSEA_OUTPUT_DIR AND NOT ANDROID)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${DEEPSEA_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DEEPSEA_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DEEPSEA_OUTPUT_DIR})
endif()
set(DEEPSEA_MAJOR_VERSION 0)
set(DEEPSEA_MINOR_VERSION 0)
set(DEEPSEA_PATCH_VERSION 1)
set(DEEPSEA_VERSION ${DEEPSEA_MAJOR_VERSION}.${DEEPSEA_MINOR_VERSION}.${DEEPSEA_PATCH_VERSION})
set(DEEPSEA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DEEPSEA_MODULE_DIR ${DEEPSEA_SOURCE_DIR}/modules)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DEEPSEA_SOURCE_DIR}/cmake)
include(cmake/config.cmake)
include(cmake/helpers.cmake)
include(cmake/install.cmake)
include(cmake/prebuilt.cmake)
include(cmake/ConvertFlatbuffers.cmake)
if (APPLE AND NOT IOS)
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
if (DEEPSEA_ARCH STREQUAL arm64)
# Default to 11.0 for arm64 for more Metal features.
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0 CACHE STRING "Minimum macOS deployment version." FORCE)
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS deployment version." FORCE)
endif()
endif()
if (DEEPSEA_ARCH STREQUAL multi AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 11.0)
# Default to 11.0 for arm64 in universal binary builds for more Metal features.
# Requires Xcode generator.
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] 11.0 CACHE STRING
"Minimum macOS deployment version for arm64." FORCE)
endif()
endif()
if (DEEPSEA_BUILD_TESTS)
find_package(GTest QUIET)
if (NOT GTEST_FOUND)
message("GTest not installed. Skipping unit tests.")
endif()
endif()
if (DEEPSEA_BUILD_DOCS)
find_package(Doxygen QUIET)
if (NOT DOXYGEN_FOUND)
message("Doxygon not installed. Skipping documentation.")
endif()
endif()
find_package(Python COMPONENTS Interpreter QUIET)
set(DEEPSEA_PYTHON_DIR ${DEEPSEA_SOURCE_DIR}/python)
if (DEEPSEA_INSTALL)
install(DIRECTORY python DESTINATION share/deepsea COMPONENT dev USE_SOURCE_PERMISSIONS
PATTERN __pycache__ EXCLUDE)
endif()
add_subdirectory(modules)
if (DEEPSEA_BUILD_TESTS)
add_subdirectory(testers)
endif()
# Documentation. (populated by built libraries)
add_subdirectory(doc)