-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (81 loc) · 2.81 KB
/
CMakeLists.txt
File metadata and controls
97 lines (81 loc) · 2.81 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
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.15)
project(graphite)
# C++ standard version
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
# Options
option(GRAPHITE_SAMPLES "Include Graphite samples directory." ON)
set(GRAPHITE_PLATFORM "Vulkan")
# Library target
add_library(graphite)
# Add compiler definitions
target_compile_definitions(graphite PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
target_compile_definitions(graphite PRIVATE $<$<CONFIG:Release>:NDEBUG=1>)
# Target build platform
if(GRAPHITE_PLATFORM STREQUAL "Vulkan")
set(PLATFORM_EXT vk)
set(PLATFORM vulkan)
endif()
target_compile_definitions(graphite PUBLIC PLATFORM_EXT=${PLATFORM_EXT})
target_compile_definitions(graphite PUBLIC PLATFORM=${PLATFORM})
# Samples directory
if(GRAPHITE_SAMPLES)
add_subdirectory("sample")
set(GRAPHITE_IMGUI_DIR "${CMAKE_SOURCE_DIR}/sample/extern/imgui/")
endif()
# ImGUI support
if(GRAPHITE_IMGUI_DIR)
# Sources
target_sources(graphite
PRIVATE "${GRAPHITE_IMGUI_DIR}/backends/imgui_impl_vulkan.cpp"
)
# Includes
target_include_directories(graphite
PUBLIC "${GRAPHITE_IMGUI_DIR}"
PUBLIC "${GRAPHITE_IMGUI_DIR}/backends"
)
target_compile_definitions(graphite PUBLIC GRAPHITE_IMGUI=1)
endif()
# Include directories
target_include_directories(graphite PUBLIC "./src/")
target_include_directories(graphite PUBLIC "./src/platform/")
target_include_directories(graphite PUBLIC "./src/core/")
# Source file directories
set(CORE_DIR src/core/graphite)
set(PLATFORM_DIR src/platform)
# Core source files
target_sources(graphite PRIVATE
# Core components
${CORE_DIR}/gpu_adapter.cc
${CORE_DIR}/vram_bank.cc
${CORE_DIR}/render_graph.cc
${CORE_DIR}/nodes/node.cc
${CORE_DIR}/nodes/compute_node.cc
${CORE_DIR}/nodes/raster_node.cc
# Utils
${CORE_DIR}/utils/debug.cc
${CORE_DIR}/utils/result.cc
)
# Core platform-specific source files
target_sources(graphite PRIVATE
# Core components
${PLATFORM_DIR}/${PLATFORM}/gpu_adapter_${PLATFORM_EXT}.cc
${PLATFORM_DIR}/${PLATFORM}/vram_bank_${PLATFORM_EXT}.cc
${PLATFORM_DIR}/${PLATFORM}/render_graph_${PLATFORM_EXT}.cc
${PLATFORM_DIR}/${PLATFORM}/imgui_${PLATFORM_EXT}.cc
)
# Additional platform-specific source files
if(GRAPHITE_PLATFORM STREQUAL "Vulkan")
target_sources(graphite PRIVATE
# Wrapper components
${PLATFORM_DIR}/vulkan/api_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/descriptor_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/device_selection_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/queue_selection_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/extensions_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/pipeline_cache_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/shader_vk.cc
${PLATFORM_DIR}/vulkan/wrapper/translate_vk.cc
)
endif()
# External dependencies
add_subdirectory("extern")