-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeBuildConfigTemplate.txt
104 lines (89 loc) · 4.1 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
## 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 ######
set(TUNDRACORE_SHARED 1)
option (ENABLE_BUILD_OPTIMIZATIONS
"MSVC-only: Enables certain build optimizations on the release builds" ON
)
option (ENABLE_TESTS
"Enables building unit tests" OFF
)
# Enable solution folders. VS Express < 2012 doesn't support solution folders.
# Use set(PROJECT_TYPE "My Plugins") to set solution folders.
if (MSVC_VERSION LESS 1700)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
if (TUNDRACORE_SHARED)
add_definitions(-DTUNDRACORE_SHARED)
endif()
if (ANDROID)
add_definitions(-DANDROID)
endif()
if (MSVC)
if (ENABLE_MEMORY_LEAK_CHECKS)
add_definitions(-DMEMORY_LEAK_CHECK)
endif()
# If requested, enable Visual Studio's static code analysis (2010 Premium and Express >= 2012).
if (RUN_VS_ANALYZE)
add_definitions(/analyze)
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")
endif()
endif()
BeginSection("Configuring Tundra Framework") # 70 visible chars to match CMakeLists.txt's prints
AddProject(TundraCore TundraCore)
BeginSection("Configuring Plugins")
AddProject(Plugins Plugins/JavaScript)
AddProject(Plugins Plugins/UrhoRenderer)
AddProject(Plugins Plugins/TundraLogic)
AddProject(Plugins Plugins/BulletPhysics)
AddProject(Plugins Plugins/ZipPlugin)
AddProject(Plugins Plugins/HttpPlugin)
# CameraApplication disabled since scripted version exists now
# AddProject(Plugins Plugins/CameraApplication)
AddProject(Plugins Plugins/SceneInteract)
AddProject(Plugins Plugins/AvatarApplication)
if (NOT ANDROID)
AddProject(Plugins Plugins/WebSocketServer)
AddProject(Plugins Plugins/HttpServer)
AddProject(Plugins Plugins/ECEditor)
endif()
AddProject(Plugins Plugins/LoginScreen)
BeginSection("Configuring Tundra Executable(s)")
AddProject(Tundra Tundra/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 (WIN32)
AddProject(Tundra Tundra/TundraConsole)
endif()
if (ENABLE_TESTS)
BeginSection("Configuring Tests")
add_subdirectory(tests)
elseif (GTEST_HOME) # Ref variable to remove warnings
endif()