-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (43 loc) · 1.57 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
# CMakeList.txt : CMake project for big_satellite_lab, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
set (CMAKE_CXX_STANDARD 17)
project ("big_satellite_lab")
find_package(Vulkan REQUIRED)
add_subdirectory(vulkan-renderer/third_party)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
add_subdirectory(src)
target_compile_definitions(big_satellite_lab PRIVATE TRACY_ENABLE)
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")
set(GLSL_VALIDATOR "$ENV{VULKAN_SDK}/Bin/glslangValidator.exe")
else()
set(GLSL_VALIDATOR "$ENV{VULKAN_SDK}/Bin32/glslangValidator.exe")
endif()
## We're gonna use glslc instead of glslang
##set(GLSLC "C:/VulkanSDK/1.2.162.0/Bin/glslc.exe")
set(GLSLC "${Vulkan_GLSLC_EXECUTABLE}")
## find all the shader files under the shaders folder
file(GLOB_RECURSE GLSL_SOURCE_FILES
"${PROJECT_SOURCE_DIR}/shaders/*.frag"
"${PROJECT_SOURCE_DIR}/shaders/*.vert"
"${PROJECT_SOURCE_DIR}/shaders/*.comp"
)
## iterate each shader
foreach(GLSL ${GLSL_SOURCE_FILES})
message(STATUS "BUILDING SHADER")
get_filename_component(FILE_NAME ${GLSL} NAME)
set(SPIRV "${PROJECT_SOURCE_DIR}/shaders/${FILE_NAME}.spv")
message(STATUS ${GLSL})
##execute glslang command to compile that specific shader
add_custom_command(
OUTPUT ${SPIRV}
## COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV}
COMMAND ${GLSLC} ${GLSL} -o ${SPIRV} -O0
DEPENDS ${GLSL})
list(APPEND SPIRV_BINARY_FILES ${SPIRV})
endforeach(GLSL)
add_custom_target(
Shaders
DEPENDS ${SPIRV_BINARY_FILES}
)