-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (58 loc) · 1.37 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
cmake_minimum_required(VERSION 3.16)
project(glfw-skeleton)
include(FetchContent)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(FETCHCONTENT_QUIET FALSE)
#
# glfw
#
set(GLFW_BUILD_DOCS FALSE)
set(GLFW_BUILD_EXAMPLES FALSE)
set(GLFW_BUILD_TESTS FALSE)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.3.4
GIT_PROGRESS TRUE)
#
# glad
#
FetchContent_Declare(
glad
GIT_REPOSITORY https://github.com/Dav1dde/glad
GIT_TAG v0.1.34
GIT_PROGRESS TRUE)
#
# glm
#
FetchContent_Declare(
glm
GIT_REPOSITORY https://github.com/g-truc/glm
GIT_TAG 0.9.9.8
GIT_PROGRESS TRUE)
#
# fetch dependencies
#
FetchContent_MakeAvailable(glfw glad glm)
#
# glfw-skeleton
#
set(
PROJECT_SOURCES
src/app.cpp
src/GLContext.cpp
src/Skeleton.cpp
src/util/colorhelper.cpp
src/util/pathhelper.cpp
src/util/shaderhelper.cpp)
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
add_custom_target(
copy-shaders ALL
COMMENT "Copying shaders"
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/src/shaders ${CMAKE_BINARY_DIR}/shaders)
add_dependencies(${PROJECT_NAME} glfw glad glm copy-shaders)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw glad glm)