-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
52 lines (37 loc) · 1.27 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
cmake_minimum_required(VERSION 3.10)
project(OpenGLTutorial VERSION 1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_package(OpenGL REQUIRED)
# Set OpenGL directory
set(OPENGL_DIR "${CMAKE_SOURCE_DIR}/external/opengl")
# Set STB directory
set(STB_DIR "${CMAKE_SOURCE_DIR}/external/stb")
# Set CAMERA directory
set(CAMERA_DIR "${OPENGL_DIR}/camera")
# Set GLFW directory
set(GLFW_DIR "${OPENGL_DIR}/glfw")
set(GLFW_INCLUDE_DIR "${GLFW_DIR}/include")
set(GLFW_LIB_DIR "${GLFW_DIR}/lib")
set(GLFW_LIB "glfw3")
# Set GLAD directory
set(GLAD_DIR "${OPENGL_DIR}/glad")
set(GLAD_INCLUDE_DIR "${GLAD_DIR}/include")
set(GLAD_SRC "${GLAD_DIR}/src/glad.c")
# Set GLM directory
set(GLM_DIR "${OPENGL_DIR}/glm")
# Add resource files
file(GLOB JPG_FILES "${CMAKE_SOURCE_DIR}/resource/*.jpg")
foreach(JPG_FILE ${JPG_FILES})
set(JPG_SOURCES ${JPG_SOURCES} ${JPG_FILE})
endforeach()
# Add source file
set(SOURCES main.cpp "${GLAD_SRC}")
# Add executable
add_executable(Tutorial "${SOURCES}")
# Add library
target_link_libraries(Tutorial "${GLFW_LIB_DIR}/glfw3.lib")
# Add include directory
target_include_directories(
Tutorial PUBLIC "${OPENGL_DIR}" "${STB_DIR}" "${CAMERA_DIR}" "${GLM_DIR}" "${GLFW_INCLUDE_DIR}"
"${GLAD_INCLUDE_DIR}" "${GPG_SOURCES}")