-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (35 loc) · 1.1 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
cmake_minimum_required(VERSION 3.16)
project(CS171-hw1 LANGUAGES C CXX)
option(USE_FILESYSTEM "use std::filesystem" off)
# glfw
option(GLFW_BUILD_TESTS off)
option(GLFW_BUILD_EXAMPLES off)
option(GLFW_BUILD_DOCS off)
add_subdirectory(libs/glfw)
include_directories(libs/glfw/include)
list(APPEND LIBRARIES glfw ${glfw_LIBRARIES})
# glad
set(GLAD_INCLUDE libs/glad/include)
include_directories(${GLAD_INCLUDE})
file(GLOB SRC
${PROJECT_SOURCE_DIR}/libs/imgui/*.h
${PROJECT_SOURCE_DIR}/libs/imgui/*.cpp
)
# glm
add_subdirectory(libs/glm)
list(APPEND LIBRARIES glm::glm)
# add filesystem
if (USE_FILESYSTEM)
list(APPEND DEFINES -DUSE_FILESYSTEM)
if (NOT MSVC)
list(APPEND LIBRARIES stdc++fs)
endif()
endif()
# set source files and add executable
file(GLOB SRC_FILES src/*.cpp)
add_executable(main ${SRC} ${SRC_FILES} ${INTERNAL_SRC_FILES} src/glad.c)
target_include_directories(main PRIVATE include)
target_compile_features(main PRIVATE cxx_std_17)
target_compile_definitions(main PRIVATE ${DEFINES})
target_link_libraries(main PRIVATE ${LIBRARIES})
include_directories(${PROJECT_SOURCE_DIR}/libs/imgui)