forked from realXtend/tundra
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeBuildConfigTemplate.txt
248 lines (214 loc) · 11.2 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
## 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
option (TUNDRACORE_SHARED
"Do we want to build TundraCore as a shared or static library." ON
)
# 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.
option (BUILD_SDK_ONLY
"Configure if you want to build only the SDK, meaning projects from src/Application will be omitted." OFF
)
# 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." ON
)
# 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." ON
)
# 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
)
option (ENABLE_TESTS
"Enable building tests" ON
)
option (ENABLE_PROFILING
"Enables Tundras built-in profiler." ON
)
option (ENABLE_JS_PROFILING
"Enables JavaScriptModule QScriptEngine profiling." OFF
)
option (ENABLE_MEMORY_LEAK_CHECKS
"Windows only: Enables memory leak checking and log dump at exit. Implemented by Tundra. Enabled only in Debug build." OFF
)
# NOTE: Not recommended to enable at the same time with above ENABLE_MEMORY_LEAK_CHECKS
option (ENABLE_MEMORY_LEAK_CHECKS_VLD
"Windows only: Enables automatic inclusion of http://vld.codeplex.com utility. You must copy the runtime to /bin manually. Enabled only in Debug build." 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)
# Use only regex from boost
if (TUNDRA_BOOST_REGEX)
add_definitions(-DTUNDRA_BOOST_REGEX)
endif()
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()
# Defines
if (ENABLE_OPEN_ASSET_IMPORT)
add_definitions(-DASSIMP_ENABLED)
endif()
if (TUNDRACORE_SHARED)
add_definitions(-DTUNDRACORE_SHARED)
endif()
if (ENABLE_TESTS)
enable_testing()
include (CTest)
endif ()
if (ENABLE_PROFILING)
add_definitions (-DPROFILING)
endif ()
if (ENABLE_JS_PROFILING)
add_definitions (-DENABLE_JS_PROFILING)
endif()
if (ENABLE_BUILD_OPTIMIZATIONS)
# Disable MathGeoLib assume() prints in an optimized build
add_definitions (-DOPTIMIZED_RELEASE)
endif ()
if (ENABLE_TRANSLATIONS)
add_definitions (-DENABLE_TRANSLATIONS)
endif()
if (MSVC)
if (ENABLE_MEMORY_LEAK_CHECKS)
add_definitions(-DMEMORY_LEAK_CHECK)
endif()
if (ENABLE_MEMORY_LEAK_CHECKS_VLD)
add_definitions(-DMEMORY_LEAK_CHECK_VLD)
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 /Zm800")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /Zm800")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP /Zm800")
# 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)
# C++
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
# Linker
# /OPT:REF enables also /OPT:ICF and disables INCREMENTAL
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
# /OPT:NOICF is recommended when /DEBUG is used (http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
elseif (SILENCE_MLG)
# Silence MLG assumes in -DSILENCE_MLG=TRUE in Release and RelWithDebInfo
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DMATH_SILENT_ASSUME")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /DMATH_SILENT_ASSUME")
endif()
endif()
message("============== Configuring Optional Entity-Components ================\n") # 70 visible chars to match CMakeLists.txt's prints
## 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_PlanarMirror)
AddEntityComponent(EC_ProximityTrigger)
AddEntityComponent(EC_LaserPointer)
AddEntityComponent(EC_StencilGlow)
endif()
message("=================== 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()
message("=================== Configuring Mandatory Plugin =====================\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.
message("=================== 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.
AddProject(Application WebSocketServerModule) # Provides connectivity for WebSocket browser clients.
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.
# Tests
if (ENABLE_TESTS)
add_subdirectory(src/Core/TundraCore/Tests)
endif ()
# Meshmoon
if (EXISTS src/meshmoon-plugins)
add_subdirectory(src/meshmoon-plugins)
endif ()
if (MESHMOON_SERVER_BUILD AND EXISTS src/admino-server)
add_subdirectory(src/admino-server)
endif ()