This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
281 lines (243 loc) · 9.16 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
cmake_minimum_required(VERSION 3.0)
#------------------------------------------------------------------------------
# CMake Policies
#------------------------------------------------------------------------------
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
#------------------------------------------------------------------------------
# Hunter & Project
#
# Note: I am using the Hunter package manager for cmake
# This is an external project that I am using exclusively
# as a utility for my cmake build file. For those interested,
# it can be found at https://github.com/ruslo/hunter
#------------------------------------------------------------------------------
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.218.tar.gz"
SHA1 "9a3594a61227967fb92159339ba326701b287b19"
)
project(EightMinuteEmpire)
#Use C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)
#------------------------------------------------------------------------------
# Hunter Packages
#------------------------------------------------------------------------------
#Boost serialization and graph
hunter_add_package(Boost COMPONENTS filesystem graph serialization system)
find_package(Boost CONFIG REQUIRED filesystem graph serialization system)
#------------------------------------------------------------------------------
# Other dependencies
#------------------------------------------------------------------------------
# In case we use graphviz.
# NOTE: this dependency is not handled by hunter and needs to be installed manually on your computer
# check it out here: https://graphviz.gitlab.io/download/
# GraphViz
#include("cmake/FindGraphViz.cmake")
#if (NOT GRAPHVIZ_FOUND)
#message(FATAL_ERROR "GraphViz must be installed on the system!!")
#endif()
#include_directories(${GRAPHVIZ_INCLUDE_DIRS})
#------------------------------------------------------------------------------
# Doxygen
#------------------------------------------------------------------------------
# In case we use doxygen for our documentation
#find_package(Doxygen)
#if (DOXYGEN_FOUND)
#
# set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
# set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
#
# configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
# message("Doxygen build started")
#
# add_custom_target(doc
# ALL
# COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "Generating documentation with Doxygen"
# VERBATIM
# )
#
# add_custom_target(doc-clean
# COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/doc/
# COMMENT "Cleaning up documentation"
# VERBATIM
# )
#
#else(DOXYGEN_FOUND)
# message("Doxygen must be installed in order to generate the documentation")
#endif(DOXYGEN_FOUND)
#------------------------------------------------------------------------------
# Resource files
#------------------------------------------------------------------------------
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/map1.map ${CMAKE_CURRENT_BINARY_DIR}/data/map1.map COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/map2.map ${CMAKE_CURRENT_BINARY_DIR}/data/map2.map COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/map_invalid1.map ${CMAKE_CURRENT_BINARY_DIR}/data/map_invalid1.map COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/map_invalid2.map ${CMAKE_CURRENT_BINARY_DIR}/data/map_invalid2.map COPYONLY)
#------------------------------------------------------------------------------
# Binaries
# Every part will be a library that we link to the executable,
# Makes things cleaner.
#------------------------------------------------------------------------------
# Map
add_library(Map
src/Utils/SerializationUtils.hpp
src/Map/Map.h
src/Map/Map.cpp
)
target_include_directories(Map PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(Map
Deck
Boost::boost
Boost::filesystem
Boost::graph
Boost::serialization
Boost::system # Needs to be last
)
# Map Driver
add_executable(MapTest
src/Map/MapDriver.cpp
)
target_include_directories(MapTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(MapTest Map)
# Map Loader
add_library(MapLoader
src/Map/MapLoader.h
src/Map/MapLoader.cpp
)
target_include_directories(MapLoader PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(MapLoader Map)
# Map Loader Driver
add_executable(MapLoaderDriver
src/Map/MapLoaderDriver.cpp
)
target_include_directories(MapLoaderDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(MapLoaderDriver MapLoader)
# Deck
add_library(Deck
src/Deck/Deck.h
src/Deck/Deck.cpp
src/Deck/Card.cpp src/Deck/Card.h)
target_include_directories(Deck PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_executable(DeckDriver
src/Deck/DeckDriver.cpp
)
target_include_directories(Deck PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(DeckDriver Deck)
# Player
add_library(Player
src/Player/Player.h
src/Player/Player.cpp
)
target_include_directories(Player PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(Player Deck BidingFacility Map PlayerStrategies ObserverBase ScoreCalculator)
# BidingFacility
add_library(BidingFacility
src/Player/BidingFacility.h
src/Player/BidingFacility.cpp
)
target_include_directories(BidingFacility PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
# BidingFacility Driver
add_executable(BidingFacilityDriver
src/Player/BidingFacilityDriver.cpp
)
target_include_directories(BidingFacilityDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(BidingFacilityDriver BidingFacility Player)
# Actions Driver
add_executable(ActionsDriver
src/Game/ActionsDriver.cpp
)
target_include_directories(ActionsDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(ActionsDriver Map MapLoader GameState Player)
# Game Start Driver
add_executable(GameStartDriver
src/Game/GameStartDriver.cpp
)
target_include_directories(GameStartDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameStartDriver Deck Player Map MapLoader BidingFacility Game)
# Game State
add_library(GameState
src/Game/GameState.hpp
src/Game/GameState.cpp
)
target_include_directories(GameState PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameState Deck Map Subject)
# GameStartup Driver
add_executable(GameStartupDriver
src/Game/GameStartupDriver.cpp
)
target_include_directories(GameStartupDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameStartupDriver BidingFacility GameState Game Deck Map MapLoader)
# Game
add_library(Game
src/Game/Game.h
src/Game/Game.cpp
)
target_include_directories(Game PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(Game GameState Player MapLoader)
#AfterAction Driver
add_executable(AfterActionDriver
src/Game/AfterActionDriver.cpp
)
target_include_directories(AfterActionDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(AfterActionDriver Map MapLoader Game)
#GameLoop Driver
add_executable(GameLoopDriver
src/Game/GameLoopDriver.cpp
)
target_include_directories(GameLoopDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameLoopDriver Deck GameState Player Map BidingFacility)
#GameScore driver
add_executable(GameScoreDriver
src/Game/GameScoreDriver.cpp
)
target_include_directories(GameScoreDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameScoreDriver Deck GameState ScoreCalculator)
# ScoreCalculator
add_library(ScoreCalculator
src/ScoreCalculator/ScoreCalculator.h
src/ScoreCalculator/ScoreCalculator.cpp
)
target_include_directories(ScoreCalculator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(ScoreCalculator Deck GameState MapLoader Game)
#PlayerStrategies
add_library(PlayerStrategies
src/Player/PlayerStrategies.h
src/Player/PlayerStrategies.cpp
)
target_include_directories(PlayerStrategies PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(PlayerStrategies Game)
#PlayerStrategies Driver
add_executable(PlayerStrategiesDriver
src/Player/PlayerStrategiesDriver.cpp
)
target_include_directories(AfterActionDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(PlayerStrategiesDriver Map MapLoader Game PlayerStrategies)
#ObserverBase
add_library(ObserverBase
src/Observer/ObserverBase.h
src/Observer/ObserverBase.cpp
)
target_include_directories(ObserverBase PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
#Subject
add_library(Subject
src/Observer/Subject.h
src/Observer/Subject.cpp
)
target_include_directories(Subject PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(Subject ObserverBase)
#GameObserversDriver
add_executable(GameObserversDriver
src/Game/GameObserversDriver.cpp
)
target_include_directories(GameObserversDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameObserversDriver Map MapLoader Game)
# GameEngine
add_executable(GameEngine
src/Game/GameEngine.cpp
)
target_include_directories(GameEngine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(GameEngine GameState MapLoader Player)