-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
66 lines (52 loc) · 1.56 KB
/
CMakeLists.txt
File metadata and controls
66 lines (52 loc) · 1.56 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
cmake_minimum_required(VERSION 4.2)
project(BLecPrototype LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include(FetchContent)
# GLFW for window and input management
FetchContent_Declare(
glfw
URL https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip
)
# GLM for mathematics (header-only, no build needed)
FetchContent_Declare(
glm
URL https://github.com/g-truc/glm/releases/download/1.0.2/glm-1.0.2.zip
)
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_MakeAvailable(glfw glm)
find_package(OpenGL REQUIRED)
# Executable with all module source files
add_executable(blec
src/main.cpp
src/window/window_manager.cpp
src/input/input_handler.cpp
src/render/renderer.cpp
src/render/font.cpp
src/render/mesh.cpp
src/render/camera.cpp
src/debug/debug_overlay.cpp
src/world/block_system.cpp
src/ui/ui_manager.cpp
)
# Include directories for headers
target_include_directories(blec PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${glm_SOURCE_DIR}
)
target_link_libraries(blec PRIVATE glfw OpenGL::GL)
if (MSVC)
target_compile_options(blec PRIVATE /W4 /permissive-)
else()
target_compile_options(blec PRIVATE -Wall -Wextra -Wpedantic)
endif()
# Optional: Build tests
option(BUILD_TESTS "Build unit tests" OFF)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(code_testing)
endif()