-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (58 loc) · 3 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
cmake_minimum_required (VERSION 3.0)
macro(add_snippet Name Directory Default)
option(ENABLE_${Name} "Enable snippet ${Name}" ${Default})
if(ENABLE_${Name})
set(sample_build_root "${CMAKE_BINARY_DIR}/${Name}")
set(CONF_NAME ${Name})
set(CONF_DIRECTORY ${Directory})
configure_file("CMakeLists.txt.in" "${sample_build_root}/CMakeLists.txt" @ONLY)
add_subdirectory(${sample_build_root} "${sample_build_root}/build")
unset(CONF_DIRECTORY)
unset(CONF_NAME)
unset(sample_build_root)
endif()
unset(ENABLE_${Name})
endmacro()
project(VulkanSamples)
if(NOT MSVC OR MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Only MSVC 2015 target is supported!")
endif()
set(VULKAN_INCLUDE $ENV{VULKAN_SDK}/Include CACHE PATH "Vulkan include directory")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(VULKAN_LIBRARY $ENV{VULKAN_SDK}/Lib/vulkan-1.lib CACHE PATH "Vulkan library")
else()
set(VULKAN_LIBRARY $ENV{VULKAN_SDK}/Lib32/vulkan-1.lib CACHE PATH "Vulkan library")
endif()
if(NOT EXISTS ${VULKAN_INCLUDE}/vulkan/vulkan.hpp)
message(FATAL_ERROR "Vulkan inlcudes is not found!")
endif()
if(NOT EXISTS ${VULKAN_LIBRARY})
message(FATAL_ERROR "Vulkan library is not found!")
endif()
set(SHADERS_DIR "${CMAKE_SOURCE_DIR}/shaders")
set(RESOURCES_DIR "${CMAKE_SOURCE_DIR}/res")
set(COMMON_DIR ${CMAKE_SOURCE_DIR}/samples/Common)
list(APPEND COMMON_INCLUDES ${COMMON_DIR})
if(WIN32)
add_definitions("/DWIN32_LEAN_AND_MEAN")
add_definitions("/DNOMINMAX")
endif()
add_subdirectory(${CMAKE_SOURCE_DIR}/samples/common)
add_snippet(01_Context ${CMAKE_SOURCE_DIR}/samples/01_Context ON)
add_snippet(02_CommandBuffers ${CMAKE_SOURCE_DIR}/samples/02_CommandBuffers ON)
add_snippet(03_Window ${CMAKE_SOURCE_DIR}/samples/03_Window ON)
add_snippet(04_DynamicCommands ${CMAKE_SOURCE_DIR}/samples/04_DynamicCommands ON)
add_snippet(05_SimpleTriangle ${CMAKE_SOURCE_DIR}/samples/05_SimpleTriangle ON)
add_snippet(06_AdvancedQuad ${CMAKE_SOURCE_DIR}/samples/06_AdvancedQuad ON)
add_snippet(07_SimpleShading ${CMAKE_SOURCE_DIR}/samples/07_SimpleShading ON)
add_snippet(08_InteractiveCube ${CMAKE_SOURCE_DIR}/samples/08_InteractiveCube ON)
add_snippet(09_Texture ${CMAKE_SOURCE_DIR}/samples/09_Texture ON)
add_snippet(12_Animation ${CMAKE_SOURCE_DIR}/samples/12_Animation ON)
add_snippet(13_GeometryShader ${CMAKE_SOURCE_DIR}/samples/13_GeometryShader ON)
add_snippet(14_FurRendering ${CMAKE_SOURCE_DIR}/samples/14_FurRendering ON)
add_snippet(17_RayTracing ${CMAKE_SOURCE_DIR}/samples/17_RayTracing ON)
add_snippet(18_RT_RayMarching ${CMAKE_SOURCE_DIR}/samples/18_RT_RayMarching ON)
add_snippet(10_ComputePipeline ${CMAKE_SOURCE_DIR}/samples/10_ComputePipeline ON)
add_snippet(11_HeatComputation ${CMAKE_SOURCE_DIR}/samples/11_HeatComputation ON)
add_snippet(15_MultiplyMatrix ${CMAKE_SOURCE_DIR}/samples/15_MultiplyMatrix ON)
add_snippet(16_Blur ${CMAKE_SOURCE_DIR}/samples/16_Blur ON)