-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (40 loc) · 2 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
cmake_minimum_required(VERSION 3.19)
set(CMAKE_CXX_STANDARD 20)
project(vulkanapp)
macro(shader)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/shaders_bin/${ARGV0}.spv
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/shaders/${ARGV0} ${CMAKE_CURRENT_SOURCE_DIR}/shaders/common.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/brdf.glsl
COMMAND /usr/bin/glslc
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/shaders/${ARGV0} -o ${CMAKE_CURRENT_SOURCE_DIR}/shaders_bin/${ARGV0}.spv -O --target-env=vulkan1.2
COMMENT building shaders
VERBATIM)
SET(shader_src ${shader_src} ${CMAKE_CURRENT_SOURCE_DIR}/shaders_bin/${ARGV0}.spv)
endmacro()
shader("triangle.vert")
shader("triangle.frag")
shader("raygen.rgen")
shader("miss.rmiss")
shader("hit.rchit")
file(GLOB_RECURSE src CONFIGURE_DEPENDS "src/*.cpp")
add_executable(vulkanapp ${src} ${shader_src})
target_include_directories(vulkanapp PRIVATE include)
#target_precompile_headers(vulkanapp PRIVATE "include/precomp.h")
add_subdirectory(${CMAKE_SOURCE_DIR}/external/glfw)
link_directories(${CMAKE_SOURCE_DIR}/external/glfw)
include_directories(vulkanapp PUBLIC ${CMAKE_SOURCE_DIR}/external/glfw/include/)
target_link_libraries(vulkanapp glfw)
add_subdirectory(${CMAKE_SOURCE_DIR}/external/glm)
link_directories(${CMAKE_SOURCE_DIR}/external/glm)
include_directories(vulkanpp PUBLIC ${CMAKE_SOURCE_DIR}/external/glm/glm/)
target_link_libraries(vulkanapp glm)
add_subdirectory(${CMAKE_SOURCE_DIR}/external/spdlog)
link_directories(${CMAKE_SOURCE_DIR}/external/spdlog)
include_directories(vulkanapp PRIVATE ${CMAKE_SOURCE_DIR}/external/spdlog/include/)
target_link_libraries(vulkanapp spdlog)
add_subdirectory(${CMAKE_SOURCE_DIR}/external/RayTracingDenoiser)
link_directories(${CMAKE_SOURCE_DIR}/external/RayTracingDenoiser)
include_directories(vulkanapp PRIVATE ${CMAKE_SOURCE_DIR}/external/RayTracingDenoiser/Include/)
target_link_libraries(vulkanapp spdlog)
find_package(Vulkan REQUIRED)
target_link_libraries(vulkanapp Vulkan::Vulkan)