-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
218 lines (157 loc) · 5.49 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
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
#
# This file is part of PuzzleBlocks
# Copyright (C) 2020-2022 Andreas Rönnquist
#
# PuzzleBlocks is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PuzzleBlocks is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PuzzleBlocks.
# If not, see <http://www.gnu.org/licenses/>.
#
#
cmake_minimum_required(VERSION 3.10)
project(puzzleblocks)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
option (DEBUG "Build Debug executable" off)
find_package(Allegro5 REQUIRED)
if (DEBUG)
message(STATUS "Building Debug executable")
set(CMAKE_BUILD_TYPE "Debug")
add_definitions(-D_DEBUG)
#add_definitions(-Wwrite-strings
#-Wextra
#-Wall
#-Winit-self
#-O
#-Wno-uninitialized
#-Wno-unused-parameter
#-Wno-switch
#-w
#-Wreturn-type
#-Weffc++
#)
# Cpp only flags: (Will not be applied to C files.)
set(CMAKE_CXX_FLAGS -Weffc++)
else (DEBUG)
message(STATUS "Building Release executable")
#add_definitions(-fomit-frame-pointer)
set(CMAKE_BUILD_TYPE "Release")
endif (DEBUG)
# set(DLL_FLAGS -DBUILDING_GUSGAME_DLL)
set(BUILD_SHARED_LIBS on)
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -DBUILDING_GUSGAME_DLL")
if (MSYS)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-enable-auto-import")
endif (MSYS)
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
cmake_policy(SET CMP0072 NEW)
find_package(OpenGL REQUIRED)
find_package(GusGame REQUIRED)
find_package(GusGui REQUIRED)
find_package(Allegro5 REQUIRED)
find_package(Lua REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem thread)
message(STATUS "GusGame Library: ${GUSGAME_LIBRARY}")
message(STATUS "GusGui Library: ${GUSGUI_LIBRARY}")
include_directories(include ${GUSGAME_INCLUDE_DIR})
include_directories(include ${GUSGUI_INCLUDE_DIR})
include_directories(include ${CMAKE_SOURCE_DIR}/include)
include_directories(include ${ALLEGRO_INCLUDE_DIR})
include_directories(include ${LUA_INCLUDE_DIR})
if (WIN32)
if (MSYS)
Set (WINGL_LIBS glu32)
else (MSYS)
Set (WINGL_LIBS glu32)
endif (MSYS)
endif(WIN32)
find_package(OpenGL REQUIRED)
find_package(GusGame REQUIRED)
find_package(GusGui REQUIRED)
message(STATUS "GusGame Library: ${GUSGAME_LIBRARY}")
message(STATUS "GusGui Library: ${GUSGAME_LIBRARY}")
include_directories(include ${CMAKE_SOURCE_DIR}/src)
include_directories(include ${CMAKE_SOURCE_DIR}/src/Objects)
include_directories(include ${GUSGAME_INCLUDE_DIR})
include_directories(include ${GUSGUI_INCLUDE_DIR})
include_directories(include ${Boost_INCLUDE_DIR})
if (MSYS)
message(STATUS "MingDir: $ENV{MINGDIR}")
endif (MSYS)
message(STATUS "Boost INCLUDE_DIR: ${Boost_INCLUDE_DIR}")
message(STATUS "GUSGAME_INCLUDE_DIR: ${GUSGAME_INCLUDE_DIR}")
message(STATUS "GUSGUI_INCLUDE_DIR: ${GUSGUI_INCLUDE_DIR}")
if (NOT ALLEGRO_FOUND)
message(FATAL_ERROR "Allegro not found!")
endif (NOT ALLEGRO_FOUND)
# And some libs:
message(STATUS "Allegro5 LIBRARY: ${ALLEGRO_LIBRARIES}")
message(STATUS "OPENGL_LIBRARY: ${OPENGL_LIBRARY}")
message(STATUS "OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}")
message(STATUS "GLUT_LIBRARY: ${GLUT_LIBRARY}")
message(STATUS "GUSGAME_LIBRARY: ${GUSGAME_LIBRARY}")
message(STATUS "GUSGUI_LIBRARY: ${GUSGUI_LIBRARY}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
if (USE_GLEW)
set (MY_GLEW_LIB ${GLEW_LIBRARY})
else (USE_GLEW)
set (MY_GLEW_LIB )
endif (USE_GLEW)
if (MSYS)
set (GL_LIBS ${OPENGL_LIBRARY} ${OPENGL_LIBRARIES})
else (MSYS)
set (GL_LIBS ${OPENGL_LIBRARY})
endif (MSYS)
set(ALL_LIBS
${LUA_LIBRARIES}
${GL_LIBS}
${GLUT_LIBRARY}
${WINGL_LIBS}
${MY_GLEW_LIB}
${Boost_LIBRARIES}
${GUSGAME_LIBRARIES}
${ALLEGRO_LIBRARIES}
)
link_libraries(${ALL_LIBS} ${GUSGUI_LIBRARY} ${GUSGAME_LIBRARY})
include_directories(include "/usr/local/include")
include_directories(include ${GUSGAME_INCLUDE})
include_directories(include ${GUSGUI_INCLUDE})
# LINK_DIRECTORIES( ${LINK_DIRECTORIES} ${LIBRARY_OUTPUT_PATH})
message (STATUS "Link directories: ${LINK_DIRECTORIES}")
message (STATUS "Library output path: ${LIBRARY_OUTPUT_PATH}")
set(SRC_FOLDER src/)
set (SOURCE_FILES
${SRC_FOLDER}/Entry.cpp
${SRC_FOLDER}/Program.cpp
${SRC_FOLDER}/Map.h
${SRC_FOLDER}/Map.cpp
${SRC_FOLDER}/Block.cpp
${SRC_FOLDER}/Block.h
${SRC_FOLDER}/Data.cpp
${SRC_FOLDER}/Data.h
${SRC_FOLDER}/Events.cpp
${SRC_FOLDER}/Events.h
${SRC_FOLDER}/GameMode/GameMode.cpp
${SRC_FOLDER}/GameMode/GameModeMainMenu.cpp
${SRC_FOLDER}/GameMode/GameModeGame.cpp
${SRC_FOLDER}/GameMode/GameModeHandler.cpp
${SRC_FOLDER}/EventHandler/EventHandlerMainMenu.cpp
${SRC_FOLDER}/EventHandler/EventHandlerGame.cpp
${SRC_FOLDER}/Gui/MainMenuPanel.cpp
${SRC_FOLDER}/Gui/MainMenuPanel.h
${SRC_FOLDER}/Gui/Button.cpp
${SRC_FOLDER}/Gui/Button.h
)
add_executable(puzzleblocks ${SOURCE_FILES})
target_link_libraries(puzzleblocks ${ALL_LIBS})