-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (77 loc) · 2.33 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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_BUILD_TYPE Release)
set(PROJECT_ROOT ${CMAKE_SOURCE_DIR})
configure_file (
${CMAKE_SOURCE_DIR}/src/config.h.in
config.h
)
project(LearnOpenGL)
find_package(OpenGL REQUIRED)
IF(MSVC)
set(GLFW_LIBRARY ${CMAKE_SOURCE_DIR}/dependencies/glfw/lib/glfw3.lib)
ELSEIF(APPLE)
set(GLFW_LIBRARY ${CMAKE_SOURCE_DIR}/dependencies/glfw/lib/libglfw3_mac.a)
ELSEIF(UNIX)
set(GLFW_LIBRARY ${CMAKE_SOURCE_DIR}/dependencies/glfw/lib/libglfw3_linux.a)
ENDIF()
# Assimp
set(ZLIB_LIBRARIES zlibstatic)
set(ENABLE_BOOST_WORKAROUND ON)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_ASSIMP_TOOLS ON)
add_subdirectory(dependencies/assimp-5.0.1)
include_directories(
${CMAKE_SOURCE_DIR}/src/commons
${CMAKE_SOURCE_DIR}/dependencies/glfw/include
${CMAKE_SOURCE_DIR}/dependencies/glad/include
${CMAKE_SOURCE_DIR}/dependencies/stb_image/include
${CMAKE_SOURCE_DIR}/dependencies/glm/include
${CMAKE_SOURCE_DIR}/dependencies/assimp-5.0.1/include
${PROJECT_BINARY_DIR}
)
file (GLOB_RECURSE COMMONS CONFIGURE_DEPENDS
${CMAKE_SOURCE_DIR}/src/commons/*.h
${CMAKE_SOURCE_DIR}/src/commons/*.cpp
)
IF (APPLE)
find_library( COCOA_LIBRARY Cocoa )
find_library( IOKIT_LIBRARY IOKit )
find_library( COREVIDEO_LIBRARY CoreVideo )
link_libraries(
${OPENGL_LIBRARY}
${GLFW_LIBRARY}
${COCOA_LIBRARY}
${IOKIT_LIBRARY}
${COREVIDEO_LIBRARY})
ELSEIF(UNIX)
link_libraries(
${OPENGL_LIBRARY}
${GLFW_LIBRARY}
-lrt -lm -ldl -lX11 -lpthread -lxcb -lXau -lXdmcp
)
ELSEIF(MSVC)
link_libraries(
${OPENGL_LIBRARY}
${GLFW_LIBRARY}
${ZLIB_LIBRARIES}
assimp
)
ENDIF()
add_executable(GettingStarted
${CMAKE_SOURCE_DIR}/src/GettingStarted.cpp
${CMAKE_SOURCE_DIR}/dependencies/glad/lib/glad.c
${CMAKE_SOURCE_DIR}/dependencies/stb_image/lib/stb_image.cpp
${COMMONS}
)
add_executable(Lighting
${CMAKE_SOURCE_DIR}/src/Lighting.cpp
${CMAKE_SOURCE_DIR}/dependencies/glad/lib/glad.c
${CMAKE_SOURCE_DIR}/dependencies/stb_image/lib/stb_image.cpp
${COMMONS}
)
add_executable(ModelLoading
${CMAKE_SOURCE_DIR}/src/ModelLoading.cpp
${CMAKE_SOURCE_DIR}/dependencies/glad/lib/glad.c
${CMAKE_SOURCE_DIR}/dependencies/stb_image/lib/stb_image.cpp
${COMMONS}
)