-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
68 lines (56 loc) · 2.13 KB
/
CMakeLists.txt
File metadata and controls
68 lines (56 loc) · 2.13 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
cmake_minimum_required(VERSION 3.22.1)
project(glCraft)
set(CMAKE_CXX_STANDARD 23)
if (CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_CXX_FLAGS "-O3")
elseif (CMAKE_BUILD_TYPE MATCHES Trace)
set(CMAKE_CXX_FLAGS "-O3")
add_compile_definitions(ENABLE_TRACING)
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "-g")
endif ()
file(GLOB_RECURSE glCraftSources src/*.cpp src/*.h)
add_executable(glCraft ${glCraftSources})
target_precompile_headers(glCraft PRIVATE src/glCraft.h)
# glfw
add_subdirectory(third_party/glfw EXCLUDE_FROM_ALL)
# GLAD
add_subdirectory(third_party/GLAD EXCLUDE_FROM_ALL)
# glm
add_subdirectory(third_party/glm EXCLUDE_FROM_ALL)
# imgui
add_library(
imgui EXCLUDE_FROM_ALL
third_party/imgui/imgui.cpp
third_party/imgui/imgui.h
third_party/imgui/imgui_demo.cpp
third_party/imgui/imgui_draw.cpp
third_party/imgui/imgui_internal.h
third_party/imgui/imgui_widgets.cpp
third_party/imgui/imstb_rectpack.h
third_party/imgui/imstb_textedit.h
third_party/imgui/imstb_truetype.h
third_party/imgui/imconfig.h
third_party/imgui/imgui_tables.cpp
third_party/imgui/backends/imgui_impl_glfw.h
third_party/imgui/backends/imgui_impl_glfw.cpp
third_party/imgui/backends/imgui_impl_opengl3.h
third_party/imgui/backends/imgui_impl_opengl3.cpp
)
include_directories(imgui third_party/imgui third_party/imgui/backends)
# include FastNoiseLite
include_directories(glCraft third_party/FastNoiseLite)
# include FrustumCulling
include_directories(glCraft third_party/FrustumCulling)
# lodepng
add_library(lodepng EXCLUDE_FROM_ALL third_party/lodepng/lodepng.h third_party/lodepng/lodepng.cpp)
include_directories(lodepng third_party/lodepng)
# link glfw to imgui and link everything to the glCraft app
target_link_libraries(imgui PRIVATE glfw)
target_link_libraries(glCraft PRIVATE glfw glm glad imgui lodepng)
# set a symlink to the assets dir
add_custom_command(
TARGET glCraft PRE_BUILD COMMAND
${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/assets ${CMAKE_CURRENT_BINARY_DIR}/assets
)