-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
58 lines (47 loc) · 1.65 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
cmake_minimum_required(VERSION 3.25.0)
project(DeferredRender)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CXX_STANDARD_REQUIRED ON)
if (MSVC)
# Ignore warnings about missing pdb
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4099")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4099")
endif()
find_package(OpenGL REQUIRED)
find_package(glad REQUIRED)
find_package(stb REQUIRED)
find_package(glm REQUIRED)
find_package(fmtlog REQUIRED)
find_package(SDL2 REQUIRED)
# App
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/*.cxx
${CMAKE_CURRENT_SOURCE_DIR}/source/*.h
${CMAKE_CURRENT_SOURCE_DIR}/source/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/source/*.glsl
)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_FILES})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
)
target_link_libraries(${PROJECT_NAME}
PUBLIC glad::glad
PUBLIC OpenGL::GL
PUBLIC stb::stb
PUBLIC fmtlog::fmtlog
PUBLIC glm::glm
PUBLIC SDL2::SDL2
)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/WX /W2>
# $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
)
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})