-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
91 lines (80 loc) · 2.16 KB
/
CMakeLists.txt
File metadata and controls
91 lines (80 loc) · 2.16 KB
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
cmake_minimum_required(VERSION 3.15)
project(cg_voxel LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)
# GLFW
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG master
)
# GLM
FetchContent_Declare(
glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG bf71a834948186f4097caa076cd2663c69a10e1e
)
# ImGui
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG docking
)
# Make available
FetchContent_MakeAvailable(glfw glm imgui)
# OpenGL
find_package(OpenGL REQUIRED)
# GLAD (local v2.x)
add_library(glad STATIC
external/glad/src/glad.c
)
target_include_directories(glad PUBLIC external/glad/include)
# ImGui setup
add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
)
target_include_directories(imgui PUBLIC
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
target_link_libraries(imgui PUBLIC glfw OpenGL::GL glad)
# Output dir
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Your executable
add_executable(${PROJECT_NAME}
main.cpp
Camera.cpp Camera.hpp
World/Chunk.cpp World/Chunk.hpp
Enums.hpp
Utils/Shader.cpp
Utils/Shader.hpp
Utils/ShaderProgram.cpp
Utils/ShaderProgram.hpp
Engine.cpp
Engine.hpp
Utils/Input.cpp
Utils/Input.hpp
Utils/Vertex.hpp
Constants.hpp
Rendering/Mesh.hpp
Rendering/ChunkMesh.cpp
Rendering/ChunkMesh.hpp
Ray.hpp
)
# Link everything
target_link_libraries(${PROJECT_NAME}
PRIVATE glad
PRIVATE glm::glm
PRIVATE glfw
PRIVATE OpenGL::GL
PRIVATE imgui
)