-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (51 loc) · 1.71 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
cmake_minimum_required( VERSION 3.10 )
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(GLRenderer)
find_package(OpenGL REQUIRED)
set(EXTERNAL_DIR 3rdParty)
if(UNIX AND NOT APPLE)
set (LINUX TRUE)
endif()
if(WIN32)
set(GLFW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/glfw-3.4.bin.WIN64)
set(GLFW_LIBS ${GLFW_DIR}/lib-vc2022/glfw3.lib)
set(ASSIMP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/assimp)
elseif(APPLE)
set(GLFW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/glfw-3.4.bin.MACOS)
set(GLFW_LIBS ${GLFW_DIR}/lib-universal/libglfw.3.dylib)
set(ASSIMP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/assimp)
set(ASSIMP_LIBS ${ASSIMP_DIR}/bin/libassimp.5.dylib)
endif()
#set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ASSIMP_INJECT_DEBUG_POSTFIX OFF CACHE BOOL "" FORCE)
set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE)
set(GLAD_DIR ${EXTERNAL_DIR}/glad)
set(GLM_DIR ${EXTERNAL_DIR}/glm)
set(STB_DIR ${EXTERNAL_DIR}/stb)
set(IMGUI_DIR ${EXTERNAL_DIR}/imgui)
include_directories(src)
include_directories(${GLAD_DIR}/include)
include_directories(${GLFW_DIR}/include)
include_directories(${ASSIMP_DIR}/include)
include_directories(${GLM_DIR})
include_directories(${STB_DIR})
include_directories(${IMGUI_DIR} ${IMGUI_DIR}/backends)
# glm double dir is required for correct include namespace
add_subdirectory(3rdParty/glm/glm glm EXCLUDE_FROM_ALL)
add_subdirectory(3rdParty/assimp assimp EXCLUDE_FROM_ALL)
file (GLOB SOURCES
src/*.cpp
src/*/*.cpp
src/*/*/*.cpp
${IMGUI_DIR}/*.cpp
${IMGUI_DIR}/backends/*.cpp
${GLAD_DIR}/src/glad.c
)
add_executable(GLRenderer ${SOURCES})
target_link_libraries(GLRenderer
${GLFW_LIBS}
glm::glm
assimp
)