-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
94 lines (80 loc) · 2.58 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
cmake_minimum_required(VERSION 3.26)
project(yumesdl)
set(CMAKE_CXX_STANDARD 20)
if (WIN32)
include(FetchContent)
FetchContent_Declare(
SDL
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.30.6
)
FetchContent_MakeAvailable(SDL)
FetchContent_Declare(
SDL_image
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image
GIT_TAG release-2.8.2
)
FetchContent_MakeAvailable(SDL_image)
FetchContent_Declare(
SDL_mixer
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer
GIT_TAG release-2.8.0
)
FetchContent_MakeAvailable(SDL_mixer)
FetchContent_Declare(
SDL_ttf
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf
GIT_TAG release-2.22.0
)
FetchContent_MakeAvailable(SDL_ttf)
else()
# REQUIRE - CMAKE, GCC, SDL2, SDL_image, SDL_mixer, SDL_ttf
# sudo apt update
# sudo apt-get install build-essential cmake libasound2-dev libpulse-dev libudev-dev libdbus-1-dev libjack-dev libgl1-mesa-dev libx11-dev libxcursor-dev libxi-dev libxext-dev libxfixes-dev libxrandr-dev libxss-dev libxxf86vm-dev libwayland-dev libxkbcommon-dev libdrm-dev
# sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(SDL2_image REQUIRED SDL2_image)
pkg_check_modules(SDL2_mixer REQUIRED SDL2_mixer)
pkg_check_modules(SDL2_ttf REQUIRED SDL2_ttf)
endif()
add_executable(${PROJECT_NAME}
src/main.cpp
src/config.hpp
src/packages/math/math.hpp
src/packages/render/render.hpp
src/packages/game_objects/rocket.cpp
src/packages/game_objects/rocket.hpp
src/packages/ui_objects/text.cpp
src/packages/ui_objects/text.hpp
src/packages/game_objects/island.cpp
src/packages/game_objects/island.hpp
src/packages/game_objects/texture.cpp
src/packages/game_objects/texture.hpp
)
if (WIN32)
target_link_libraries(${PROJECT_NAME}
PRIVATE
SDL2::SDL2
SDL2::SDL2main
SDL2_image
SDL2_mixer
SDL2_ttf
)
else()
target_link_libraries(${PROJECT_NAME}
PRIVATE
${SDL2_LIBRARIES}
${SDL2_image_LIBRARIES}
${SDL2_mixer_LIBRARIES}
${SDL2_ttf_LIBRARIES}
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${SDL2_INCLUDE_DIRS}
${SDL2_image_INCLUDE_DIRS}
${SDL2_mixer_INCLUDE_DIRS}
${SDL2_ttf_INCLUDE_DIRS}
)
endif()
file(COPY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_BINARY_DIR}/res)