-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (73 loc) · 2.76 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
cmake_minimum_required(VERSION 3.27)
project(CubeRun)
# Setting variables
############################################################
set(CR_SRC_DIR ${CMAKE_SOURCE_DIR}/src)
set(CR_LIBS_DIR ${CMAKE_SOURCE_DIR}/libs/)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
############################################################
# Sub-dirs
############################################################
add_subdirectory(libs/GLFW)
add_subdirectory(libs/freetype)
############################################################
# Source
############################################################
set(CR_SOURCES
# engine/core
${CR_SRC_DIR}/main.cpp
${CR_SRC_DIR}/engine/core/window.cpp
${CR_SRC_DIR}/engine/core/clock.cpp
${CR_SRC_DIR}/engine/core/event.cpp
${CR_SRC_DIR}/engine/core/input.cpp
# engine/core
${CR_SRC_DIR}/engine/file/file.cpp
# engine/graphics
${CR_SRC_DIR}/engine/graphics/renderer.cpp
${CR_SRC_DIR}/engine/graphics/shader.cpp
${CR_SRC_DIR}/engine/graphics/mesh.cpp
${CR_SRC_DIR}/engine/graphics/camera.cpp
${CR_SRC_DIR}/engine/graphics/font.cpp
${CR_SRC_DIR}/engine/graphics/texture.cpp
# engine/audio
${CR_SRC_DIR}/engine/audio/audio_system.cpp
# engine/math
${CR_SRC_DIR}/engine/math/rand.cpp
# game/
${CR_SRC_DIR}/game/game.cpp
# game/ui
${CR_SRC_DIR}/game/ui/text.cpp
# game/physics
${CR_SRC_DIR}/game/physics/physics_world.cpp
${CR_SRC_DIR}/game/physics/body.cpp
${CR_SRC_DIR}/game/physics/collider.cpp
# game/scenes
${CR_SRC_DIR}/game/scenes/scene_manager.cpp
${CR_SRC_DIR}/game/scenes/menu_overlay.cpp
${CR_SRC_DIR}/game/scenes/over_overlay.cpp
${CR_SRC_DIR}/game/scenes/game_scene.cpp
# game/entities
${CR_SRC_DIR}/game/entities/entity_manager.cpp
${CR_SRC_DIR}/game/entities/player.cpp
${CR_SRC_DIR}/game/entities/obsticle.cpp
)
############################################################
# Libs sources
############################################################
set(LIBS_SOURCE
${CR_LIBS_DIR}/glad/gl.c
${CR_LIBS_DIR}/miniaudio/miniaudio.cpp
${CR_LIBS_DIR}/stb_image/stb_image.cpp
)
############################################################
# Linking and compiling
############################################################
add_executable(${PROJECT_NAME} ${CR_SOURCES} ${LIBS_SOURCE})
target_compile_definitions(${PROJECT_NAME} PUBLIC GLFW_INCLUDE_NONE)
target_compile_options(${PROJECT_NAME} PRIVATE -lm -O1 -ldl)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
target_include_directories(${PROJECT_NAME} PUBLIC ${CR_SRC_DIR}/)
target_include_directories(${PROJECT_NAME} PUBLIC ${CR_LIBS_DIR}/)
file(COPY assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC glfw freetype)
############################################################