-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
158 lines (133 loc) · 5.17 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
cmake_minimum_required (VERSION 2.6)
#####################################################
## Variables to be set depending on project
#####################################################
set (PROJECTNAME "VsSudoku")
set (GAMEFILES
src/main.cpp
src/GameProperties.hpp
src/GameProperties.cpp
src/StateGame.hpp
src/StateGame.cpp
src/StateGameTwoPlayer.hpp
src/StateGameTwoPlayer.cpp
src/StateGameOnePlayer.hpp
src/StateGameOnePlayer.cpp
src/StateMenu.hpp
src/StateMenu.cpp
src/GameBoard.hpp
src/GameBoard.cpp
src/PuzzleStorage.hpp
src/Hud.hpp
src/Hud.cpp
)
set (SUDOKUFILES
src/Sudoku/Coord.hpp
src/Sudoku/Cell.hpp
src/Sudoku/Board.hpp
src/Sudoku/Serializer.hpp
src/Sudoku/empty.cpp
)
#####################################################
## Other variables and compiler setup
#####################################################
set (JAMTEMPLATEFILES
src/JamTemplate/Animation.hpp
src/JamTemplate/Box2DObject.hpp
src/JamTemplate/Button.hpp
src/JamTemplate/Collision.hpp
src/JamTemplate/Conversions.hpp
src/JamTemplate/Game.hpp
src/JamTemplate/GameObject.hpp
src/JamTemplate/GameState.hpp
src/JamTemplate/InputManager.hpp
src/JamTemplate/InputManager.cpp
src/JamTemplate/Lerp.hpp
src/JamTemplate/MathHelper.hpp
src/JamTemplate/Noise.hpp
src/JamTemplate/ObjectGroup.hpp
src/JamTemplate/Random.hpp
src/JamTemplate/Random.cpp
src/JamTemplate/SmartObject.hpp
src/JamTemplate/SmartObject.cpp
src/JamTemplate/SmartShape.hpp
src/JamTemplate/SmartSprite.hpp
src/JamTemplate/SmartText.hpp
src/JamTemplate/SplitString.hpp
src/JamTemplate/SpriteFunctions.hpp
src/JamTemplate/TextureManager.cpp
src/JamTemplate/TextureManager.hpp
src/JamTemplate/Timer.hpp
src/JamTemplate/Transform.hpp
src/JamTemplate/TweenAlpha.hpp
src/JamTemplate/TweenBase.hpp
src/JamTemplate/TweenColor.hpp
src/JamTemplate/TweenPosition.hpp
src/JamTemplate/TweenRotation.hpp
src/JamTemplate/TweenScale.hpp
)
if(WIN32)
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 -Ox")
else(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O3 --std=c++1z")
endif(WIN32)
#####################################################
## Create projects and set them up accordingly
#####################################################
project (${PROJECTNAME})
if (WIN32)
link_directories(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/lib)
endif (WIN32)
if (APPLE)
link_directories(/usr/local/Cellar/sfml/2.4.2_1/lib/)
endif (APPLE)
#####################################################
## Setup Box2d
#####################################################
file(GLOB_RECURSE SRC_FILES ext/box2d/Box2D/*)
add_library(Box2D ${SRC_FILES})
target_include_directories(Box2D PRIVATE ext/box2d)
#####################################################
## setup other libs and executables
#####################################################
add_library(JamTemplate ${JAMTEMPLATEFILES})
add_library(SudokuLib ${SUDOKUFILES})
add_executable(${PROJECTNAME} ${GAMEFILES})
target_include_directories(JamTemplate PRIVATE ext/SFML-2.5.1_win/include)
target_include_directories(JamTemplate PRIVATE ext/box2d)
target_include_directories(JamTemplate PRIVATE /usr/local/Cellar/sfml/2.4.2_1/include)
target_link_libraries(JamTemplate optimized sfml-system )
target_link_libraries(JamTemplate optimized sfml-window )
target_link_libraries(JamTemplate optimized sfml-graphics )
target_link_libraries(JamTemplate Box2D)
if (WIN32)
target_link_libraries(JamTemplate debug sfml-system-d )
target_link_libraries(JamTemplate debug sfml-window-d )
target_link_libraries(JamTemplate debug sfml-graphics-d )
endif (WIN32)
target_include_directories(${PROJECTNAME} PRIVATE ext/SFML-2.5.1_win/include)
target_include_directories(${PROJECTNAME} PRIVATE /usr/local/Cellar/sfml/2.4.2_1/include)
target_link_libraries(${PROJECTNAME} optimized sfml-window )
target_link_libraries(${PROJECTNAME} optimized sfml-system )
target_link_libraries(${PROJECTNAME} optimized sfml-graphics )
target_link_libraries(${PROJECTNAME} JamTemplate)
target_link_libraries(${PROJECTNAME} Box2D)
target_link_libraries(${PROJECTNAME} SudokuLib)
add_executable(SudokuCreator src/SudokuCreator/main.cpp)
target_link_libraries(SudokuCreator SudokuLib)
#####################################################
## copy sfml dlls around
#####################################################
if (WIN32)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-system-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-window-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-graphics-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-system-d-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-window-d-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/ext/SFML-2.5.1_win/bin/sfml-graphics-d-2.dll ${CMAKE_BINARY_DIR}/ COPYONLY)
endif (WIN32)
#####################################################
## copy assets around
#####################################################
file(COPY ${CMAKE_SOURCE_DIR}/assets DESTINATION ${CMAKE_BINARY_DIR}/ )