-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
108 lines (87 loc) · 3.39 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
# _____ _ _ _ _____ __ _____ _ _____ _
# |_ _| | | | | | | _ |/ _| |_ _| | | __ \ | |
# | | | |__ ___ | | | | __ _ _ _ | | | | |_ | | | |__ ___ | | \/ __ _| | __ ___ ___ _
# | | | '_ \ / _ \ | |/\| |/ _` | | | | | | | | _| | | | '_ \ / _ \ | | __ / _` | |/ _` \ \/ / | | |
# | | | | | | __/ \ /\ / (_| | |_| | \ \_/ / | | | | | | | __/ | |_\ \ (_| | | (_| |> <| |_| |
# \_/ |_| |_|\___| \/ \/ \__,_|\__, | \___/|_| \_/ |_| |_|\___| \____/\__,_|_|\__,_/_/\_\\__, |
# __/ | __/ |
# |___/ |___/
#
# This is a simple makefile to compile this project.
# This project is hybrid between visual studio and cmake
# and cross platform, to compile, you need to install the:
# SDL2, SDL2_image, SDL2_ttf, nlohmann_json packages....
cmake_minimum_required (VERSION 3.5)
project("The Way Of The Galaxy" VERSION 0.0.2)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Setting minimal versions of some packages
set(SDL2_MIN_VERSION 2.26.0)
set(JSON_MIN_VERSION 3.2.0)
# Adding packages
find_package(SDL2 ${SDL2_MIN_VERSION} CONFIG REQUIRED)
find_package(SDL2_image CONFIG REQUIRED)
find_package(SDL2_ttf CONFIG REQUIRED)
find_package(nlohmann_json ${JSON_MIN_VERSION} CONFIG REQUIRED)
find_package(Boost CONFIG REQUIRED COMPONENTS filesystem)
include_directories(
"${SDL2_INCLUDE_DIRS}"
"${Boost_INCLUDE_DIRS}"
)
link_directories("${Boost_LIBRARY_DIRS}")
# Setting group files
file(GLOB srcfiles "${PROJECT_SOURCE_DIR}/The Way Of The Galaxy/*.cpp")
file(GLOB components "${PROJECT_SOURCE_DIR}/The Way Of The Galaxy/ECS/*.cpp")
file(GLOB customComponents "${PROJECT_SOURCE_DIR}/The Way Of The Galaxy/ECS/custom/*.cpp")
add_executable(TWOTG ${srcfiles} ${components} ${customComponents})
target_include_directories(TWOTG PRIVATE
"${PROJECT_SOURCE_DIR}/The Way Of The Galaxy/include"
)
target_link_libraries(TWOTG
${SDL2_LIBRARIES}
SDL2_image::SDL2_image
SDL2_ttf::SDL2_ttf
nlohmann_json::nlohmann_json
${Boost_LIBRARIES}
)
# Mentioning necessary files...
set(assetsList "assetsList.json")
set(assets
"assets/asset2.json"
"assets/background1_level1.json"
"assets/laser.json"
"assets/missile.json"
"assets/playerSpaceship.json"
)
set(textures
"assets/textures/backgrounds/Space_Stars2.png"
"assets/textures/explosions/explosion.png"
"assets/textures/lasers/laser.png"
"assets/textures/missiles/missile.png"
"assets/textures/scraps/pieces.png"
"assets/textures/spaceships/PolygonConcaveTest.png"
"assets/textures/spaceships/PolygonConvexTest.png"
"assets/textures/spaceships/spaceship1.png"
)
set(statusbarTexture "statusbar/statusbar.png")
set(statusbarFonts
"statusbar/fonts/character.ttf"
"statusbar/fonts/pixelfonts.ttf"
"statusbar/fonts/wayfers.ttf"
)
set(statusbarIcons
"statusbar/icons/energyIcon.png"
"statusbar/icons/missileIcon.png"
)
set(files_to_copy
"${assetsList}"
"${assets}"
"${textures}"
"${statusbarTexture}"
"${statusbarFonts}"
"${statusbarIcons}"
)
# Copyng necessary files...
foreach(file ${files_to_copy})
configure_file("${PROJECT_SOURCE_DIR}/The Way Of The Galaxy/${file}" "${PROJECT_BINARY_DIR}/${file}" COPYONLY)
endforeach()