-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
100 lines (90 loc) · 3.02 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
cmake_minimum_required(VERSION 3.9)
project(pong)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
if(MINGW)
set(CMAKE_EXE_LINKER_FLAGS "-mwindows")
endif(MINGW)
# Using Jackbengine library
add_subdirectory(${PROJECT_SOURCE_DIR}/external/jackbengine)
include_directories(${PROJECT_SOURCE_DIR}/external/jackbengine/include)
include_directories(${PROJECT_SOURCE_DIR}/external/jackbengine/src)
include_directories(${PROJECT_SOURCE_DIR}/external/jackbengine/external)
include_directories(${PROJECT_SOURCE_DIR}/src)
# Using Resource generator tool
add_executable(
resourceGenerator
${PROJECT_SOURCE_DIR}/external/resourceGenerator/resourceGenerator.c
)
# Creating resources C representations
add_custom_command(
OUTPUT resources.cpp
COMMAND resourceGenerator
resources.cpp
-b${PROJECT_SOURCE_DIR}/resources/left.wav
-b${PROJECT_SOURCE_DIR}/resources/right.wav
-b${PROJECT_SOURCE_DIR}/resources/wall.wav
-t${PROJECT_SOURCE_DIR}/resources/menu.tmx
-t${PROJECT_SOURCE_DIR}/resources/wall.tmx
-t${PROJECT_SOURCE_DIR}/resources/two_players.tmx
-t${PROJECT_SOURCE_DIR}/resources/one_player.tmx
-b${PROJECT_SOURCE_DIR}/resources/tileset.png
-b${PROJECT_SOURCE_DIR}/resources/pong32x32.png
DEPENDS
resources/left.wav
resources/right.wav
resources/wall.wav
resources/menu.tmx
resources/wall.tmx
resources/two_players.tmx
resources/one_player.tmx
resources/tileset.png
resources/pong32x32.png
)
# Tell CMake to create an app bundle on MacOS
if(APPLE)
set(CMAKE_MACOSX_BUNDLE true)
set(ICON_FILE ${PROJECT_SOURCE_DIR}/resources/${CMAKE_PROJECT_NAME}.icns)
set_source_files_properties(
${ICON_FILE}
PROPERTIES
MACOSX_PACKAGE_LOCATION
Resources
)
endif(APPLE)
if(MINGW)
set(ICON_FILE ${PROJECT_SOURCE_DIR}/resources/win_icon.rc)
endif(MINGW)
# Defining source files
set(
SOURCE_FILES
src/main.cpp
src/app.cpp
src/scene/menu/menuScene.cpp
src/scene/wall/wallScene.cpp
src/scene/wall/state/wallServiceState.cpp
src/scene/wall/state/wallGameState.cpp
src/scene/wall/state/wallGameOverState.cpp
src/scene/2players/2playersScene.cpp
src/scene/2players/state/2playersServiceState.cpp
src/scene/2players/state/2playersGameState.cpp
src/scene/2players/state/2playersGameOverState.cpp
src/scene/1player/1playerScene.cpp
src/scene/1player/state/1playerServiceState.cpp
src/scene/1player/state/1playerGameState.cpp
src/scene/1player/state/1playerGameOverState.cpp
resources.cpp
${ICON_FILE}
)
# Compiling final executable
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${CMAKE_PROJECT_NAME} jackbengine)
# Post build operations
if(APPLE)
set_target_properties(
${CMAKE_PROJECT_NAME}
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST
${PROJECT_SOURCE_DIR}/resources/${CMAKE_PROJECT_NAME}.plist
)
endif(APPLE)