-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
165 lines (148 loc) · 4.56 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Projects Settings
cmake_minimum_required (VERSION 3.11)
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
add_subdirectory(third_party)
project(InTheCube)
# The inthecube executable
add_executable(inthecube
src/activity/Activity.hpp
src/activity/IntroScreen.cpp
src/activity/IntroScreen.hpp
src/activity/LevelScreen.cpp
src/activity/LevelScreen.hpp
src/activity/Main.hpp
src/activity/MainScreen.cpp
src/activity/MainScreen.hpp
src/activity/ResourceLoadingScreen.cpp
src/activity/ResourceLoadingScreen.hpp
src/activity/WelcomeScreen.cpp
src/activity/WelcomeScreen.hpp
src/game/Accelerator.cpp
src/game/Accelerator.hpp
src/game/Arrow.cpp
src/game/Arrow.hpp
src/game/Laser.cpp
src/game/Laser.hpp
src/game/ArrowLauncher.cpp
src/game/ArrowLauncher.hpp
src/game/ArrowLauncherDetector.cpp
src/game/ArrowLauncherDetector.hpp
src/game/BackgroundMusic.cpp
src/game/BackgroundMusic.hpp
src/game/Block.cpp
src/game/Block.hpp
src/game/Button.cpp
src/game/Button.hpp
src/game/Cloner.cpp
src/game/Cloner.hpp
src/game/Collision.cpp
src/game/Collision.hpp
src/game/Creeper.cpp
src/game/Creeper.hpp
src/game/Decor.cpp
src/game/Decor.hpp
src/game/Detector.cpp
src/game/Detector.hpp
src/game/Electricity.cpp
src/game/Electricity.hpp
src/game/FallingBlock.cpp
src/game/FallingBlock.hpp
src/game/FinishBlock.cpp
src/game/FinishBlock.hpp
src/game/Forme.cpp
src/game/Forme.hpp
src/game/Glass.cpp
src/game/Glass.hpp
src/game/Hero.cpp
src/game/Hero.hpp
src/game/InvisibleBlock.cpp
src/game/InvisibleBlock.hpp
src/game/Lang.cpp
src/game/Lang.hpp
src/game/LaserTurret.cpp
src/game/LaserTurret.hpp
src/game/Level.cpp
src/game/Level.hpp
src/game/LevelListLoader.cpp
src/game/LevelListLoader.hpp
src/game/MovableBlock.cpp
src/game/MovableBlock.hpp
src/game/MovingBlock.cpp
src/game/MovingBlock.hpp
src/game/Particule.cpp
src/game/Particule.hpp
src/game/Pic.cpp
src/game/Pic.hpp
src/game/Pincette.cpp
src/game/Pincette.hpp
src/game/Resource.cpp
src/game/Resource.hpp
src/game/SaveManager.cpp
src/game/SaveManager.hpp
src/game/Special.cpp
src/game/Special.hpp
src/game/StaticMirror.cpp
src/game/StaticMirror.hpp
src/game/Teleporter.cpp
src/game/Teleporter.hpp
src/game/TextPopup.cpp
src/game/TextPopup.hpp
src/main.cpp
src/string.cpp
src/string.hpp
)
target_compile_options(inthecube PRIVATE -Wall -Wextra -pedantic -Werror)
target_include_directories(inthecube PRIVATE ./src)
target_compile_options(inthecube
PRIVATE
-Wall
-Werror
-pedantic-errors
-Wextra
)
set_property(TARGET inthecube PROPERTY CXX_STANDARD 17)
add_definitions(-DGLM_FORCE_RADIANS)
# Detect emscripten is used.
if(CMAKE_CXX_COMPILER MATCHES "/em\\+\\+(-[a-zA-Z0-9.])?$")
target_link_libraries(inthecube PRIVATE -lidbfs.js)
set_property(TARGET inthecube APPEND_STRING PROPERTY LINK_FLAGS " -sDEMANGLE_SUPPORT")
set_property(TARGET inthecube APPEND_STRING PROPERTY LINK_FLAGS " -s TOTAL_MEMORY=536870912")
#target_compile_options(inthecube PRIVATE "-fwasm-exceptions")
#target_link_options(inthecube PRIVATE "-fwasm-exceptions")
#target_link_options(inthecube PRIVATE "-s ASSERTIONS=2")
#target_link_options(inthecube PRIVATE "-s SAFE_HEAP=1")
#target_link_options(inthecube PRIVATE "-g4 -s ASSERTIONS=2 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1")
option(ADD_GOOGLE_ANALYTICS "Add google analytics script" ON)
if (ADD_GOOGLE_ANALYTICS)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/google-analytics.html google-analytics)
endif(ADD_GOOGLE_ANALYTICS)
# Copy the index.html file.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/index.html
${CMAKE_CURRENT_BINARY_DIR}/index.html
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/run_webassembly.py
${CMAKE_CURRENT_BINARY_DIR}/run_webassembly.py
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/style.css
${CMAKE_CURRENT_BINARY_DIR}/style.css
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/resources/img/img_hero.png
${CMAKE_CURRENT_BINARY_DIR}/favicon.png
COPYONLY
)
# Allow some files to be fetched.
file(GLOB files "./resources/*" "./resources/*/*")
foreach(file ${files})
file(RELATIVE_PATH relative_file ${CMAKE_SOURCE_DIR} ${file})
set_property(TARGET inthecube APPEND_STRING PROPERTY LINK_FLAGS " --preload-file ${file}@/${relative_file}")
endforeach()
else()
target_link_libraries(inthecube PRIVATE stdc++fs)
endif()
target_link_libraries(inthecube PRIVATE smk)
install(TARGETS inthecube RUNTIME DESTINATION bin)
install(DIRECTORY resources DESTINATION share/inthecube)