-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
116 lines (101 loc) · 4.29 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
cmake_minimum_required( VERSION 3.4.1 )
###############################################################################
# Source code file list.
###############################################################################
# MyEngine source files.
file( GLOB_RECURSE sourceFiles
"MyEngine/SourceCommon/*.cpp"
"Libraries/imgui/imgui.cpp"
"Libraries/imgui/imgui_demo.cpp"
"Libraries/imgui/imgui_draw.cpp"
"Libraries/imgui/imgui_widgets.cpp"
"Libraries/Lua/src/*.c"
"Libraries/bullet3/src/BulletCollision/*.cpp"
"Libraries/bullet3/src/BulletDynamics/*.cpp"
"Libraries/bullet3/src/LinearMath/*.cpp"
"../SharedGameCode/Core/RenderTextQuick.cpp"
"../SharedGameCode/Menus/MenuItem.cpp"
"../SharedGameCode/Core/MeshShapes.cpp"
"../SharedGameCode/Menus/LanguageTable.cpp"
"../SharedGameCode/Menus/MenuButton.cpp"
"../SharedGameCode/Menus/MenuCheckBox.cpp"
"../SharedGameCode/Menus/MenuSprite.cpp"
"../SharedGameCode/Menus/MenuText.cpp"
"../SharedGameCode/Menus/MenuInputBox.cpp"
"../SharedGameCode/Menus/MenuScrollingText.cpp"
"../SharedGameCode/Menus/MenuScrollBox.cpp"
"../SharedGameCode/Menus/Menu_Helpers.cpp"
)
list( REMOVE_ITEM sourceFiles "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/Lua/src/lua.c" )
list( REMOVE_ITEM sourceFiles "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/Lua/src/luac.c" )
# Editor specific source files.
if( CMAKE_BUILD_TYPE MATCHES EditorDebug OR CMAKE_BUILD_TYPE MATCHES EditorRelease )
file( GLOB_RECURSE editorFiles "MyEngine/SourceEditor/*.cpp" )
set( sourceFiles ${sourceFiles} ${editorFiles} )
list( REMOVE_ITEM sourceFiles "${CMAKE_CURRENT_SOURCE_DIR}/MyEngine/SourceEditor/Dialogs/DialogGridSettings.cpp" )
endif()
###############################################################################
# Library setup.
###############################################################################
# Library
add_library( MyEngine STATIC ${sourceFiles} )
# MyEngine include directories.
target_include_directories( MyEngine PUBLIC
"MyEngine/SourceCommon"
"MyEngine/SourceEditor"
"Libraries/imgui"
"Libraries/Lua/src"
"Libraries/LuaBridge"
"Libraries/bullet3/src/"
"Libraries/SharedGameCode"
"../SharedGameCode/Core"
"../SharedGameCode/Menus"
)
# MyFramework include directories.
target_include_directories( MyEngine PUBLIC
"../Framework/MyFramework/SourceCommon"
"../Framework/MyFramework/SourceEditor"
"../Framework/MyFramework/SourceLinux"
"../Framework/Libraries/b2Settings"
"../Framework/Libraries/Box2D"
"../Framework/Libraries/cJSON"
"../Framework/Libraries/LodePNG"
"../Framework/Libraries/OpenSimplexInC"
)
###############################################################################
# Platform specific settings.
###############################################################################
# Android defines.
if( CMAKE_SYSTEM_NAME MATCHES Android )
target_compile_definitions( MyEngine PRIVATE MYFW_ANDROID=1 )
endif()
# Linux defines.
if( CMAKE_SYSTEM_NAME MATCHES Linux )
target_compile_definitions( MyEngine PRIVATE MYFW_LINUX=1 )
target_include_directories( MyEngine PUBLIC "../Framework/MyFramework/SourceLinux" )
endif()
# Windows/VisualStudio defines.
if( CMAKE_SYSTEM_NAME MATCHES Windows )
target_compile_definitions( MyEngine PRIVATE MYFW_WINDOWS=1 )
target_include_directories( MyEngine PUBLIC "../Framework/MyFramework/SourceWindows" )
add_definitions( -DUNICODE -D_UNICODE )
endif()
# Editor settings.
if( CMAKE_BUILD_TYPE MATCHES EditorDebug OR CMAKE_BUILD_TYPE MATCHES EditorRelease )
target_compile_definitions( MyEngine PRIVATE MYFW_USING_IMGUI=1 MYFW_EDITOR=1 )
# Set base CMake build type to debug or release.
if( CMAKE_BUILD_TYPE MATCHES EditorDebug )
set( CMAKE_BUILD_TYPE Debug )
elseif( CMAKE_BUILD_TYPE MATCHES EditorRelease )
set( CMAKE_BUILD_TYPE Release )
endif()
endif()
# Debug settings.
if( CMAKE_BUILD_TYPE MATCHES Debug )
target_compile_definitions( MyEngine PRIVATE _DEBUG=1 )
endif()
# Currently disabled since some bullet headers don't like being in a unity build.
# cotire (Compile time reducer)
#include( ../Framework/Libraries/Cotire/CMake/cotire.cmake )
#set_target_properties( MyEngine PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "MyEngine/SourceCommon/EngineCommonHeader.h" )
#cotire( MyEngine )