-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (57 loc) · 2.11 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.20 FATAL_ERROR)
if(UNIX)
# Linux-specific configuration
message(STATUS "Linux Config")
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
elseif(WIN32)
message(STATUS "Windows Config")
set(CMAKE_C_COMPILER "C:/Program Files/LLVM/bin/clang.exe")
set(CMAKE_CXX_COMPILER "C:/Program Files/LLVM/bin/clang++.exe")
else()
message(FATAL_ERROR "Unsupported operating system: ${CMAKE_SYSTEM_NAME}")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(GLX LANGUAGES C CXX)
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
endif()
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# GLFW
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/GLFW)
# Glad
set(GLAD_DIR ${CMAKE_SOURCE_DIR}/vendor/Glad)
file(GLOB GLAD_SRC ${GLAD_DIR}/src/*.c)
add_library(glad STATIC ${GLAD_SRC})
target_include_directories(glad PRIVATE ${GLAD_DIR}/include)
# spdlog
set(SPDLOG_BUILD_EXAMPLE OFF)
add_compile_definitions(FMT_USE_CONSTEXPR)
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/spdlog)
# stb_image
set(STB_DIR ${CMAKE_SOURCE_DIR}/vendor/stb)
file(GLOB STB_SRC ${STB_DIR}/*.cpp)
add_library(stb_image STATIC ${STB_SRC})
# ImGui
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/vendor/ImGui)
file(GLOB IMGUI_SRC ${IMGUI_DIR}/*.cpp)
add_library(ImGui STATIC ${IMGUI_SRC})
target_include_directories(ImGui PRIVATE ${IMGUI_DIR})
# Assimp
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF)
set(ASSIMP_BUILD_OBJ_IMPORTER ON)
set(ASSIMP_BUILD_GLTF_IMPORTER ON)
set(ASSIMP_BUILD_FBX_IMPORTER ON)
set(ASSIMP_BUILD_COLLADA_IMPORTER ON)
SET(BUILD_SHARED_LIBS OFF)
SET(ASSIMP_NO_EXPORT ON)
SET(ASSIMP_BUILD_TESTS OFF)
SET(ASSIMP_INSTALL OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/Assimp)
add_subdirectory(${CMAKE_SOURCE_DIR}/GLX)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})