-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
117 lines (103 loc) · 3.16 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
cmake_minimum_required (VERSION 3.22)
project(LearnOpenGL)
# Language specific configs
set(CMAKE_CXX_STANDARD 20) # this does nothing for MSVC, use target_compile_options below
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# Enable static analysis
#set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")
# Find required packages
find_package(imgui REQUIRED)
find_package(glfw3 REQUIRED)
find_package(glad REQUIRED)
find_package(glm REQUIRED)
# Bindings for ImGui
set(
IMGUI_BINDINGS_SOURCES
${CMAKE_SOURCE_DIR}/src/ImGui/Bindings/imgui_impl_glfw.h
${CMAKE_SOURCE_DIR}/src/ImGui/Bindings/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/src/ImGui/Bindings/imgui_impl_opengl3.h
${CMAKE_SOURCE_DIR}/src/ImGui/Bindings/imgui_impl_opengl3.cpp
${CMAKE_SOURCE_DIR}/src/ImGui/Bindings/imgui_impl_opengl3_loader.h
)
add_library(IMGUI_BINDINGS_LIB STATIC ${IMGUI_BINDINGS_SOURCES})
target_link_libraries(
IMGUI_BINDINGS_LIB
imgui::imgui
glfw
glad::glad
)
# stb_image as a lib
set(
STB_IMAGE_SOURCES
${CMAKE_SOURCE_DIR}/src/stb_image/stb_image.cpp
${CMAKE_SOURCE_DIR}/src/stb_image/stb_image.h
)
add_library(
STB_IMAGE_LIB
STATIC
${STB_IMAGE_SOURCES}
)
# Main executable of the engine: Ronnie
set(
RONNIE_SOURCES
"${CMAKE_SOURCE_DIR}/src/ArrayBuffer.cpp"
"${CMAKE_SOURCE_DIR}/src/ArrayBuffer.h"
"${CMAKE_SOURCE_DIR}/src/ElementArray.cpp"
"${CMAKE_SOURCE_DIR}/src/ElementArray.h"
"${CMAKE_SOURCE_DIR}/src/InputHandler.cpp"
"${CMAKE_SOURCE_DIR}/src/InputHandler.h"
"${CMAKE_SOURCE_DIR}/src/Shader.cpp"
"${CMAKE_SOURCE_DIR}/src/Shader.h"
"${CMAKE_SOURCE_DIR}/src/Texture.cpp"
"${CMAKE_SOURCE_DIR}/src/Texture.h"
"${CMAKE_SOURCE_DIR}/src/VertexArray.cpp"
"${CMAKE_SOURCE_DIR}/src/VertexArray.h"
"${CMAKE_SOURCE_DIR}/src/Window.cpp"
"${CMAKE_SOURCE_DIR}/src/Window.h"
"${CMAKE_SOURCE_DIR}/src/Ronnie.h"
"${CMAKE_SOURCE_DIR}/src/Ronnie.cpp"
"${CMAKE_SOURCE_DIR}/src/Camera/CameraDirection.h"
"${CMAKE_SOURCE_DIR}/src/Camera/CameraDirection.cpp"
"${CMAKE_SOURCE_DIR}/src/Camera/FloatingCamera.h"
"${CMAKE_SOURCE_DIR}/src/Camera/FloatingCamera.cpp"
"${CMAKE_SOURCE_DIR}/src/Camera/ICamera.h"
"${CMAKE_SOURCE_DIR}/src/Commands/CommandTypes.h"
"${CMAKE_SOURCE_DIR}/src/Commands/CommandTypes.cpp"
"${CMAKE_SOURCE_DIR}/src/Commands/ICommand.h"
"${CMAKE_SOURCE_DIR}/src/Commands/IDispatcher.h"
"${CMAKE_SOURCE_DIR}/src/Commands/KeyPressCommand.h"
"${CMAKE_SOURCE_DIR}/src/Commands/KeyPressCommand.cpp"
"${CMAKE_SOURCE_DIR}/src/Commands/KeyType.h"
"${CMAKE_SOURCE_DIR}/src/Commands/MoveCameraCommand.h"
"${CMAKE_SOURCE_DIR}/src/Commands/MoveCameraCommand.cpp"
)
add_executable(
Ronnie
${RONNIE_SOURCES}
)
target_include_directories(
Ronnie
PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/stb_image
)
target_link_libraries(
Ronnie
imgui::imgui
glfw
glad::glad
glm::glm
IMGUI_BINDINGS_LIB
STB_IMAGE_LIB
)
# Copy resources into build directory
add_custom_command(
TARGET
Ronnie
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
${PROJECT_BINARY_DIR}/resources
)