-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
184 lines (157 loc) · 5.46 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CXX_STANDARD 11)
set(OpenGL_GL_PREFERENCE LEGACY)
project(mazemaze)
option(SFGUI_SUBMODULE "Do you want to use SFGUI submodule?" ON)
option(SFML_STATIC_LIBRARIES "Do you want to link SFML statically?" OFF)
find_package(Intl REQUIRED MODULE)
find_package(OpenGL REQUIRED)
find_package(SFGUI QUIET CONFIG NO_CMAKE_PACKAGE_REGISTRY)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JsonCpp REQUIRED IMPORTED_TARGET jsoncpp)
set(SOURCES
src/Camera.cpp
src/Chunk.cpp
src/Game.cpp
src/GraphicEngine.cpp
src/IRenderable.cpp
src/main.cpp
src/Maze.cpp
src/MazeRenderer.cpp
src/Player.cpp
src/StarSky.cpp
src/Settings.cpp
src/Saver.cpp
src/FpsCalculator.cpp
src/utils.cpp
src/Skybox.cpp
src/Logger.cpp
src/CameraBobbing.cpp
src/Rotation.cpp
src/Point.cpp
src/Point2.cpp
src/Gui/Background.cpp
src/Gui/MainMenu.cpp
src/Gui/Gui.cpp
src/Gui/State.cpp
src/Gui/States/FpsOverlay.cpp
src/Gui/States/Main.cpp
src/Gui/States/OptionsMenu.cpp
src/Gui/States/Options.cpp
src/Gui/States/OptionsGraphics.cpp
src/Gui/States/OptionsOther.cpp
src/Gui/States/OptionsControls.cpp
src/Gui/States/OptionsControlsKeys.cpp
src/Gui/States/OptionsControlsKeyChangeWindow.cpp
src/Gui/States/Pause.cpp
src/Gui/States/Win.cpp
src/Gui/States/NewGame.cpp
src/Gui/States/About.cpp
src/Gui/States/Progress.cpp
src/Gui/States/Debug.cpp
src/MazeRenderers/Classic.cpp
src/MazeRenderers/Gray.cpp
src/MazeRenderers/Brick.cpp
src/MazeRenderers/NightBrick.cpp)
set(HEADERS
src/Camera.hpp
src/Chunk.hpp
src/Game.hpp
src/GraphicEngine.hpp
src/IRenderable.hpp
src/ITickable.hpp
src/Maze.hpp
src/MazeRenderer.hpp
src/Player.hpp
src/StarSky.hpp
src/Settings.hpp
src/Saver.hpp
src/FpsCalculator.hpp
src/utils.hpp
src/path_separator.hpp
src/Skybox.hpp
src/Logger.hpp
src/CameraBobbing.hpp
src/TickableHandler.hpp
src/Rotation.hpp
src/Point.hpp
src/Point2.hpp
src/Gui/Background.hpp
src/Gui/MainMenu.hpp
src/Gui/Gui.hpp
src/Gui/State.hpp
src/Gui/States/FpsOverlay.hpp
src/Gui/States/Main.hpp
src/Gui/States/OptionsMenu.hpp
src/Gui/States/Options.hpp
src/Gui/States/OptionsGraphics.hpp
src/Gui/States/OptionsOther.hpp
src/Gui/States/OptionsControls.hpp
src/Gui/States/Pause.hpp
src/Gui/States/Win.hpp
src/Gui/States/NewGame.hpp
src/Gui/States/About.hpp
src/Gui/States/Progress.hpp
src/Gui/States/Debug.hpp
src/MazeRenderers/Classic.hpp
src/MazeRenderers/Gray.hpp
src/MazeRenderers/Brick.hpp
src/MazeRenderers/NightBrick.hpp)
if (WIN32)
set(SOURCES ${SOURCES} win/resource.rc)
endif (WIN32)
if (WIN32)
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS})
else (WIN32)
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
endif (WIN32)
if (SFGUI_FOUND)
message(STATUS "Found SFGUI ${SFGUI_VERSION} in ${SFGUI_DIR}")
elseif (SFGUI_SUBMODULE)
if (EXISTS ${CMAKE_SOURCE_DIR}/sfgui/CMakeLists.txt)
message(STATUS "Found SFGUI submodule in " ${CMAKE_SOURCE_DIR}/sfgui)
else (EXISTS ${CMAKE_SOURCE_DIR}/sfgui/CMakeLists.txt)
find_package(Git MODULE)
if (GIT_FOUND)
message(STATUS "Downloading SFGUI submodule in " ${CMAKE_SOURCE_DIR}/sfgui)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/sfgui)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/sfgui)
else (GIT_FOUND)
message(FATAL_ERROR "SFGUI not found and can't be downloaded")
endif (GIT_FOUND)
endif (EXISTS ${CMAKE_SOURCE_DIR}/sfgui/CMakeLists.txt)
set(SFGUI_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library." FORCE)
set(SFGUI_BUILD_EXAMPLES OFF CACHE BOOL "Build examples." FORCE)
add_subdirectory(sfgui EXCLUDE_FROM_ALL)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/sfgui/include)
endif (SFGUI_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${Intl_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CONFIG++_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE lib)
target_link_libraries(${PROJECT_NAME} PkgConfig::JsonCpp)
target_link_libraries(${PROJECT_NAME} ${Intl_LIBRARIES})
target_link_libraries(${PROJECT_NAME} SFGUI::SFGUI)
target_link_libraries(${PROJECT_NAME} sfml-window sfml-graphics sfml-system)
target_link_libraries(${PROJECT_NAME} ${OPENGL_gl_LIBRARY})
target_link_libraries(${PROJECT_NAME} Threads::Threads)
if (WIN32)
target_link_libraries(${PROJECT_NAME} iconv)
endif (WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE ENABLE_NLS=1)
set(MAZEMAZE_INSTALL_DIR "/opt" CACHE PATH "Mazemaze Install directory")
configure_file(mazemaze.desktop.in mazemaze.desktop)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${MAZEMAZE_INSTALL_DIR}/${PROJECT_NAME})
install(DIRECTORY data
DESTINATION ${MAZEMAZE_INSTALL_DIR}/${PROJECT_NAME})
install(FILES data/icon.png
DESTINATION share/icons/hicolor/256x256/apps
COMPONENT ICON
RENAME mazemaze.png)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mazemaze.desktop
DESTINATION share/applications
COMPONENT DESKTOP_ENTRY)
add_subdirectory(locale)