-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
91 lines (70 loc) · 2.32 KB
/
Copy pathCMakeLists.txt
File metadata and controls
91 lines (70 loc) · 2.32 KB
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
cmake_minimum_required(VERSION 3.23)
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()
project(Planet VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE)
include(FetchContent)
option(GLFW_BUILD_EXAMPLES "Disable GLFW examples" OFF)
option(GLFW_BUILD_TESTS "Disable GLFW tests" OFF)
option(GLFW_BUILD_DOCS "Disable GLFW docs" OFF)
option(GLFW_INSTALL "Disable GLFW install targets" OFF)
set(GLM_TEST_ENABLE OFF CACHE BOOL "" FORCE)
set(GLM_BUILD_LIBRARY OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE)
set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE)
set(ASSIMP_WARNINGS_AS_ERRORS OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG 1.0.1
)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.4
)
FetchContent_Declare(
assimp
GIT_REPOSITORY https://github.com/assimp/assimp.git
GIT_TAG v5.4.3
)
FetchContent_MakeAvailable(glm glfw assimp)
FetchContent_Declare(
stb
GIT_REPOSITORY https://github.com/nothings/stb.git
)
FetchContent_GetProperties(stb)
if(NOT stb_POPULATED)
FetchContent_Populate(stb)
endif()
if(NOT TARGET stb::stb)
add_library(stb_headers INTERFACE)
target_include_directories(stb_headers INTERFACE ${stb_SOURCE_DIR})
add_library(stb::stb ALIAS stb_headers)
endif()
set(GLAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glad-generated)
add_library(glad STATIC ${GLAD_DIR}/src/gl.c)
target_include_directories(glad PUBLIC ${GLAD_DIR}/include)
set_target_properties(glad PROPERTIES FOLDER "thirdparty")
add_library(compiler_options INTERFACE)
target_compile_features(compiler_options INTERFACE cxx_std_17)
if(MSVC)
target_compile_options(compiler_options INTERFACE /permissive- /Zc:preprocessor /W4 /EHsc)
else()
target_compile_options(compiler_options INTERFACE -Wall -Wextra -Wpedantic)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_executable(planet ${CMAKE_SOURCE_DIR}/src/asterriod.cpp)
target_link_libraries(
planet
PRIVATE
dependencies
compiler_options
)
target_precompile_headers(planet PRIVATE ${CMAKE_SOURCE_DIR}/pch/precompile.h)