File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,14 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
120120# ---- Compile Shaders ----
121121if (Vulkan_FOUND)
122122 add_dependencies (${PROJECT_NAME} RAYX_CORE_COMPILE_SHADER)
123- set (RAYX_CORE_SHADER ${CMAKE_BINARY_DIR} /bin/Shaders/comp.spv)
124- file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR} /bin/Shaders)
123+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
124+ set (OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG} /Shaders)
125+ else ()
126+ set (OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE} /Shaders)
127+ endif ()
128+ set (RAYX_CORE_SHADER ${OUTPUT_DIR} /comp.spv)
129+
130+ file (MAKE_DIRECTORY ${OUTPUT_DIR} )
125131 add_custom_command (
126132 OUTPUT
127133 ${RAYX_CORE_SHADER}
Original file line number Diff line number Diff line change @@ -71,7 +71,11 @@ if(Vulkan_FOUND)
7171 # ---- Compile Shaders ----
7272 # Function to compile shaders
7373 function (compile_shaders target shaders_dir)
74- set (OUTPUT_DIR "${CMAKE_BINARY_DIR} /bin/shaders" )
74+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
75+ set (OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG} /Shaders)
76+ else ()
77+ set (OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE} /Shaders)
78+ endif ()
7579 file (MAKE_DIRECTORY ${OUTPUT_DIR} )
7680 # Get a list of all shader files in the specified directory
7781 file (GLOB SHADER_FILES "${shaders_dir} /*.frag" "${shaders_dir} /*.vert" )
@@ -85,7 +89,7 @@ if(Vulkan_FOUND)
8589 string (SUBSTRING ${SHADER_EXT} 1 -1 SHADER_STAGE) # Remove the leading '.' from the extension
8690
8791 # Set output file name
88- set (OUTPUT_FILE " ${CMAKE_BINARY_DIR} /bin/Shaders/ ${SHADER_NAME} _${SHADER_STAGE} .spv" )
92+ set (OUTPUT_FILE ${OUTPUT_DIR} / ${SHADER_NAME} _${SHADER_STAGE} .spv)
8993
9094 # Create a custom command for each shader file
9195 add_custom_command (
You can’t perform that action at this time.
0 commit comments