-
Notifications
You must be signed in to change notification settings - Fork 70
/
CMakeBuildConfigTemplate.txt
196 lines (166 loc) · 10 KB
/
CMakeBuildConfigTemplate.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
## The CMakeBuildConfigTemplate.txt defines the default build settings
## that are used when you build a clean checkout.
##
## CMakeBuildConfigTemplate.txt is only a template file! Changes to that file
## do not have any effect on the actual CMake execution.
##
## For the actual configuration, the file CMakeBuildConfigTemplate.txt gets
## copied to CMakeBuildConfig.txt, in which you can customize your own settings.
##
## The CMakeBuildConfig.txt is not part of the repository, and do not add it there!
## The idea is that everyone can customize the set of modules to build using that
## file, without having to fear about an accidental commit of these changes.
###### BUILD CONFIGURATION DEFINES ######
## Various flags/defines that configure your build
# Do we want to build TundraCore as a shared or static library.
set(TUNDRACORE_SHARED 1)
# Configure if you want to build only the SDK, meaning projects from src/Application will be omitted
# TODO BUILD_SDK_ONLY seems not be very useful as many core Tundra functionalities reside in the Application folder,
# JavascriptModule f.ex.; consider removing this option for good.
set(BUILD_SDK_ONLY 0)
# Do we want to deploy only the binaries (contents of bin) when running the INSTALL project."
# If FALSE, all binaries (bin), static libraries (lib) and headers (include) are deployed.
option(INSTALL_BINARIES_ONLY "Do we want to deploy only the binaries (contents of bin) when running the INSTALL project." TRUE)
# Do we want to deploy the example scenes (bin/scenes) when running the INSTALL project.
option(INSTALL_EXAMPLE_SCENES "Do we want to deploy the example scenes (bin/scenes) when running the INSTALL project." TRUE)
# Do we want to enable usage of language translations. Currently bitrot/deprecated and off by default.
option(ENABLE_TRANSLATIONS "Do we want to enable usage of language translations. Currently bitrot/deprecated and off by default." OFF)
# Enables certain build optimizations on the release builds, f.ex. disables math correctness checks and error prints.
# On Windows also enables some of the more aggressive linker optimizations. Do not enable if you are planning to retain reusable symbol information.
option(ENABLE_BUILD_OPTIMIZATIONS "Enables certain build optimizations on the release builds." OFF)
# 3rd party dependencies:
if (NOT ANDROID)
set(ENABLE_HYDRAX 1) # Configure the use of Hydrax, http://www.ogre3d.org/tikiwiki/Hydrax
set(ENABLE_SKYX 1) # Configure the use of SkyX, http://www.ogre3d.org/tikiwiki/SkyX
set(ENABLE_OPEN_ASSET_IMPORT 1) # Enables Open Asset Import Library, which can be used to import various mesh formats.
else()
set(ENABLE_HYDRAX 0)
set(ENABLE_SKYX 0)
set(ENABLE_OPEN_ASSET_IMPORT 0)
endif()
# TUNDRA_NO_BOOST is configured in the root CMakeLists.txt
if (TUNDRA_NO_BOOST)
add_definitions(-DTUNDRA_NO_BOOST)
endif()
# TUNDRA_NO_AUDIO is configured in the root CMakeLists.txt
if (TUNDRA_NO_AUDIO)
add_definitions(-DTUNDRA_NO_AUDIO)
endif()
# TUNDRA_CPP11_ENABLED is configured in the root CMakeLists.txt
if (TUNDRA_CPP11_ENABLED)
add_definitions(-DTUNDRA_CPP11_ENABLED)
endif()
# Enable solution folders
if (NOT MSVC)
# Cannot enable solution folders by default when using Visual Studio as the Express versions don't support them.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
if (ENABLE_OPEN_ASSET_IMPORT)
add_definitions(-DASSIMP_ENABLED)
endif()
set (ENABLE_PROFILING 1) # Enable the following flag to add compile with support for a built-in execution time profiler.
set (ENABLE_JS_PROFILING 0) # Enable js profiling?
set (ENABLE_MEMORY_LEAK_CHECKS 0) # If the following flag is defined, memory leak checking is enabled in all modules when building on MSVC.
message("\n")
if (TUNDRACORE_SHARED)
add_definitions(-DTUNDRACORE_SHARED)
endif()
if (ENABLE_PROFILING)
add_definitions (-DPROFILING)
endif ()
if (ENABLE_JS_PROFILING)
add_definitions (-DENABLE_JS_PROFILING)
endif()
if (ENABLE_BUILD_OPTIMIZATIONS)
add_definitions (-DOPTIMIZED_RELEASE) # Disable MathGeoLib assume() prints in an optimized build
endif ()
if (ENABLE_TRANSLATIONS)
add_definitions (-DENABLE_TRANSLATIONS)
endif()
if (MSVC)
if (ENABLE_MEMORY_LEAK_CHECKS)
add_definitions(-DMEMORY_LEAK_CHECK)
endif()
# Common flags for all configurations: build with multiple processes and increase PCH size in order to overcome occasional errors.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP /Zm1000")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /Zm1000")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP /Zm1000")
# NOTE: RelWithDebInfo and Release use O2 (= /Ox /Gl /Gy/ = Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) by default,
# with the exception with RelWithDebInfo has /Ob1 instead.
if (ENABLE_BUILD_OPTIMIZATIONS)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /INCREMENTAL:NO /OPT:REF") # /OPT:REF enables also /OPT:ICF
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /INCREMENTAL:NO /OPT:REF")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
endif()
endif()
###### ENTITY-COMPONENTS ######
message("\n=========== Configuring Optional Entity-Components ===========\n")
## The AddEntityComponent macros must appear before any of the add_subdirectory() directives for modules that use the ECs, or otherwise
## they will not be able to conditionally compile the EC.
## The following EC's are declared by TundraProtocolModule and are optional.
## You may comment these lines out to disable any ECs you do not want to include.
AddEntityComponent(EC_Highlight)
AddEntityComponent(EC_Sound)
AddEntityComponent(EC_HoveringText)
AddEntityComponent(EC_TransformGizmo)
## Here are the Application level ECs that wont be added if BUILD_SDK_ONLY is TRUE (default is FALSE)
if (NOT BUILD_SDK_ONLY)
AddEntityComponent(EC_Script) # Optional but used by both PythonScriptModule and JavascriptModule.
AddEntityComponent(EC_PlanarMirror)
AddEntityComponent(EC_ProximityTrigger)
AddEntityComponent(EC_LaserPointer)
endif()
###### TUNDRA FRAMEWORK ######
message("\n=========== Configuring Tundra Framework ===========\n")
## The following are the core modules/libs that are required
## for the project to build. None of these can be omitted.
AddProject(Core TundraCore)
AddProject(Core Math)
# The Tundra project builds the main exe as a WINDOWS subsystem (or as a unix executable).
AddProject(Core Tundra)
# For Windows, also add a version of the project which builds using CONSOLE subsystem.
# This is otherwise equivalent to the Tundra executable, but this one always shows the console window.
if (MSVC)
AddProject(Core TundraConsole)
endif()
###### MANDATORY PLUGINS ######
message("\n=========== Configuring Mandatory Plugins ===========\n")
## Here we have plugins that cannot be omitted from the build.
AddProject(Core OgreRenderingModule)
AddProject(Core TundraProtocolModule)
AddProject(Core AssetModule)
AddProject(Core PhysicsModule) # Optional in theory, if your application doesn't need physics, but currently TundraProtocolModule depends on this. Depends on OgreRenderingModule and EnvironmentModule.
AddProject(Core EnvironmentModule) # Optional in theory, if you drop PhysicsModule and DebugStatsModule. Depends on OgreRenderingModule.
###### OPTIONAL PLUGINS ######
message("\n=========== Configuring Optional Plugins ===========\n")
# Add addons projects if they have been checked out from the separate repository
if (EXISTS src/TundraAddons)
add_subdirectory(src/TundraAddons)
endif ()
if (NOT ANDROID)
AddProject(Core ECEditorModule) # Provides tools for managing scenes, entities, entity-components and assets.
endif()
AddProject(Application SceneInteract) # Transforms generic mouse and keyboard input events on scene entities to input-related entity actions and signals. Depends on OgreRenderingModule.
AddProject(Application AvatarModule) # Provides EC_Avatar. Depends on OgreRenderingModule.
AddProject(Application DebugStatsModule) # Enables a developer window for debugging. Depends on OgreRenderingModule, EnvironmentModule, and PhysicsModule.
AddProject(Application SkyXHydrax) # Provides photorealistic sky and water components by utilizing SkyX and Hydrax Ogre add-ons.
AddProject(Application JavascriptModule) # Allows QtScript-created scene script instances.
AddProject(Application SceneWidgetComponents) # Provides ECs for injecting various QWidgets to the 3D scene eg. EC_WebView.
if (NOT APPLE OR NOT TUNDRA_NO_BOOST)
AddProject(Application WebSocketServerModule) # Provides connectivity for WebSocket browser clients. Requires non-c++11 / Boost build on OSX or will be disabled.
endif()
if (NOT ANDROID)
AddProject(Application MumblePlugin) # VOIP communication, implements a Mumble client for the Murmur server. Depends on JavascriptModule, OgreRenderingModule and TundraProtocolModule.
endif()
if (NOT ANDROID)
AddProject(Application OgreAssetEditorModule) # Enables various asset editors. Depends on OgreRenderingModule.
endif()
if (ENABLE_OPEN_ASSET_IMPORT)
AddProject(Application OpenAssetImport) # Allows import of various mesh file formats
endif ()
#AddProject(Application AssetInterestPlugin) # Options to only keep assets below certain distance threshold in memory. Can also unload all non used assets from memory. Exposed to scripts so scenes can set the behaviour.
AddProject(Application CanvasPlugin) # Component that draws a graphics scene with any number of widgets into a mesh and provides 3D mouse input.
AddProject(Application ArchivePlugin) # Provides archived asset bundle capabilities. Enables example sub asset referencing into eg. zip files.