-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
88 lines (72 loc) · 2.45 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
86
87
88
cmake_minimum_required(VERSION 3.25.3)
project(heatshimmer)
set(CMAKE_CXX_STANDARD 20)
find_program(GLSLC glslc)
function(add_shader TARGET SHADER)
set(current-shader-path ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER})
get_filename_component(current-output-file ${SHADER}.spv NAME)
set(current-output-path ${CMAKE_BINARY_DIR}/${current-output-file})
get_filename_component(current-output-dir ${current-output-path} DIRECTORY)
file(MAKE_DIRECTORY ${current-output-dir})
add_custom_command(
OUTPUT ${current-output-path}
COMMAND ${GLSLC} -o ${current-output-path} ${current-shader-path}
DEPENDS ${current-shader-path}
IMPLICIT_DEPENDS CXX ${current-shader-path}
VERBATIM
)
set_source_files_properties(${current-output-path} PROPERTIES GENERATED TRUE)
target_sources(${TARGET} PRIVATE ${current-output-path})
endfunction(add_shader)
# C++ sources
add_executable(${PROJECT_NAME}
src/main.cpp
src/render/hid.cpp
src/render/hid.h
src/render/renderer.cpp
src/render/renderer.h
src/render/util.h
src/render/util.cpp
src/render/vulkan/instance.cpp
src/render/vulkan/instance.h
src/render/vulkan/device.cpp
src/render/vulkan/device.h
src/render/vulkan/pipeline.cpp
src/render/vulkan/pipeline.h
src/render/vulkan/swapchain.h
src/render/vulkan/swapchain.cpp
src/math/vec.cpp
src/math/vec.h
src/render/vulkan/vertex.h
src/math/mat.cpp
src/math/mat.h
src/render/vulkan/uniform.h
src/file/netpbm.cpp
src/file/netpbm.h
src/render/vulkan/cmd_buffer.cpp
src/render/vulkan/cmd_buffer.h
src/render/error.cpp
src/render/error.h
src/structure/world.cpp
src/structure/world.h
src/render/model.cpp
src/render/model.h
src/structure/object.cpp
src/structure/object.h
src/math/hash.cpp
src/math/hash.h
)
include_directories(src)
# C++ dependencies
find_package(SDL2 REQUIRED)
target_include_directories(${PROJECT_NAME} PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES})
find_package(Vulkan REQUIRED)
message(STATUS "Vulkan_INCLUDE_DIRS=${Vulkan_INCLUDE_DIRS}")
target_include_directories(${PROJECT_NAME} PUBLIC ${Vulkan_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} Vulkan::Vulkan)
# Shaders
add_shader(${PROJECT_NAME} src/shader/base.frag)
add_shader(${PROJECT_NAME} src/shader/base.vert)
# Options
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Werror -Wpedantic)