-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (71 loc) · 2.15 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
cmake_minimum_required(VERSION 3.16)
project(KraidEngine LANGUAGES C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
./src/**.cpp
./src/**.hpp
./src/**.h
)
file(GLOB_RECURSE THIRD_PARTY_SOURCES CONFIGURE_DEPENDS
./ThirdParty/DearImGui/**.cpp
./ThirdParty/DearImGui/**.h
)
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${THIRD_PARTY_SOURCES})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
target_link_libraries(${PROJECT_NAME} PRIVATE
"d3d12.lib"
"dxgi.lib"
"dxguid.lib"
"D3DCompiler.lib"
"dxcompiler.lib"
)
target_include_directories(${PROJECT_NAME} PRIVATE ./ThirdParty/)
target_include_directories(${PROJECT_NAME} PRIVATE ./src/)
target_precompile_headers(${PROJECT_NAME} PRIVATE
<windows.h>
<d3d12.h>
<wrl.h>
<d3d12video.h>
<dxgi1_6.h>
<dxcapi.h>
<d3d12shader.h>
<d3dcompiler.h>
<DirectXMath.h>
<unordered_map>
<string>
<vector>
<functional>
<thread>
<chrono>
<DearImGui/imgui.h>
<tinyobjloader/tiny_obj_loader.h>
<Core/Windows.h>
<Core/Rendering/D3D12/D3D12.h>
<Core/Rendering/D3D12/D3D12SDK.h>
<Core/Rendering/Rendering.h>
<Core/stdcpp.h>
)
if(MSVC)
message("msvc build")
add_compile_options(${PROJECT_NAME} /wd26495)
add_compile_options(${PROJECT_NAME} /W4 /WX)
else()
message("Clang build")
add_compile_options(${PROJECT_NAME} -Wall -Wextra -Wpedantic)
endif()
add_custom_command(
TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/ThirdParty/DXC/"
"${CMAKE_BINARY_DIR}")
add_custom_command(
TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/Resources"
"${CMAKE_BINARY_DIR}/Resources")
add_custom_command(
TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/Shaders"
"${CMAKE_BINARY_DIR}/Shaders")