-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCmakeLists.txt
126 lines (95 loc) · 2.67 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
cmake_minimum_required(VERSION 3.21.2)
project(vkmGL VERSION 0.0.1)
message("=== [BUILD] GPU Core ===")
find_package(OpenGL REQUIRED)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party)
set(GLFW_DIR ${THIRD_PARTY_DIR}/glfw)
set(GLM_DIR ${THIRD_PARTY_DIR}/glm)
set(STB_DIR ${THIRD_PARTY_DIR}/stb_image)
set(IMGUI_DIR ${THIRD_PARTY_DIR}/imgui )
set(CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/core)
set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(IMGUI
"${IMGUI_DIR}/backends/imgui_impl_opengl3.h"
"${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp"
"${IMGUI_DIR}/backends/imgui_impl_glfw.h"
"${IMGUI_DIR}/backends/imgui_impl_glfw.cpp"
"${IMGUI_DIR}/imgui_demo.cpp"
"${IMGUI_DIR}/imgui_draw.cpp"
"${IMGUI_DIR}/imgui_tables.cpp"
"${IMGUI_DIR}/imgui_widgets.cpp"
"${IMGUI_DIR}/imgui.h"
"${IMGUI_DIR}/imgui.cpp"
)
include_directories(${CORE_DIR})
include_directories(${COMMON_DIR})
add_subdirectory(${GLFW_DIR})
set(GLAD_SOURCES "${GLFW_DIR}/deps/glad_gl.c")
set(GLAD_HEADERS "${GLFW_DIR}/deps/glad/gl.h")
set(IMGUI_SOURCES
"${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp"
"${IMGUI_DIR}/backends/imgui_impl_glfw.cpp"
"${IMGUI_DIR}/imgui_demo.cpp"
"${IMGUI_DIR}/imgui_draw.cpp"
"${IMGUI_DIR}/imgui_tables.cpp"
"${IMGUI_DIR}/imgui_widgets.cpp"
"${IMGUI_DIR}/imgui.cpp"
)
set(IMGUI_HEADERS
"${IMGUI_DIR}/backends/imgui_impl_opengl3.h"
"${IMGUI_DIR}/backends/imgui_impl_glfw.h"
"${IMGUI_DIR}/imgui.h"
)
set(SOURCES
${COMMON_DIR}/error/error_handle.cpp
${COMMON_DIR}/files/file_read.cpp
${CORE_DIR}/error/gl_error_handle.cpp
${CORE_DIR}/gl_frame_buffer.cpp
${CORE_DIR}/gl_index_buffer.cpp
${CORE_DIR}/gl_render_buffer.cpp
${CORE_DIR}/gl_render.cpp
${CORE_DIR}/gl_shader.cpp
${CORE_DIR}/gl_texture.cpp
${CORE_DIR}/gl_uniform_buffer.cpp
${CORE_DIR}/gl_vertex_array.cpp
${CORE_DIR}/gl_vertex_buffer_layout.cpp
${CORE_DIR}/gl_vertex_buffer.cpp
)
set(HEADERS
${COMMON_DIR}/error/error_handle.h
${COMMON_DIR}/files/file_read.h
${CORE_DIR}/error/gl_error_handle.h
${CORE_DIR}/include/gl_include.h
${CORE_DIR}/gl_frame_buffer.h
${CORE_DIR}/gl_index_buffer.h
${CORE_DIR}/gl_render_buffer.h
${CORE_DIR}/gl_render.h
${CORE_DIR}/gl_shader.h
${CORE_DIR}/gl_texture.h
${CORE_DIR}/gl_uniform_buffer.h
${CORE_DIR}/gl_vertex_array.h
${CORE_DIR}/gl_vertex_buffer_layout.h
${CORE_DIR}/gl_vertex_buffer.h
)
add_library(${PROJECT_NAME} STATIC
${GLAD_SOURCES}
${SOURCES}
${IMGUI_SOURCES}
${GLM_DIR}/glm
${GLAD_HEADERS}
${HEADERS}
)
target_include_directories(${PROJECT_NAME} PUBLIC
${GLAD_HEADERS}
${HEADERS}
${GLFW_DIR}/include
${GLFW_DIR}/deps
${GLM_DIR}/glm
${STB_DIR}
${IMGUI_DIR}
${IMGUI_DIR}/backends
)
target_link_libraries(${PROJECT_NAME} PUBLIC
OpenGL::GL
glfw
)