Skip to content

Commit c59a56e

Browse files
Add root CMakeLists.txt to facilitate project structure and subdirectory access
1 parent 109a4f4 commit c59a56e

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cmake_minimum_required (VERSION 3.29)
2+
3+
project (VulkanTutorialRoot)
4+
# This is to allow the CMakeLists.txt files in attachments/ to be accessed from root level
5+
# Use command: cmake -S . -B build to configure from root level
6+
add_subdirectory(attachments)
7+
8+
# Any other subdirectories can be added here

attachments/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function (add_shaders_target TARGET)
9595
COMMAND glslang::validator
9696
ARGS --target-env vulkan1.0 ${SHADER_SOURCES} --quiet
9797
WORKING_DIRECTORY ${SHADERS_DIR}
98-
DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES}
98+
DEPENDS ${SHADER_SOURCES}
9999
COMMENT "Compiling Shaders"
100100
VERBATIM
101101
)
@@ -118,7 +118,7 @@ function (add_slang_shader_target TARGET)
118118
OUTPUT ${SHADERS_DIR}/slang.spv
119119
COMMAND ${SLANGC_EXECUTABLE} ${SHADER_SOURCES} -target spirv -profile spirv_1_4+spvRayQueryKHR -emit-spirv-directly -fvk-use-entrypoint-name ${ENTRY_POINTS} -o slang.spv
120120
WORKING_DIRECTORY ${SHADERS_DIR}
121-
DEPENDS ${SHADERS_DIR} ${SHADER_SOURCES}
121+
DEPENDS ${SHADER_SOURCES}
122122
COMMENT "Compiling Slang Shaders"
123123
VERBATIM
124124
)
@@ -165,11 +165,11 @@ function (add_chapter CHAPTER_NAME)
165165
target_link_libraries (${CHAPTER_NAME} ${CHAPTER_LIBS})
166166
endif ()
167167
if (DEFINED CHAPTER_MODELS)
168-
list(TRANSFORM CHAPTER_MODELS PREPEND "${CMAKE_SOURCE_DIR}/assets/")
168+
list(TRANSFORM CHAPTER_MODELS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/assets/")
169169
file (COPY ${CHAPTER_MODELS} DESTINATION ${CMAKE_BINARY_DIR}/${CHAPTER_NAME}/models)
170170
endif ()
171171
if (DEFINED CHAPTER_TEXTURES)
172-
list(TRANSFORM CHAPTER_TEXTURES PREPEND "${CMAKE_SOURCE_DIR}/assets/")
172+
list(TRANSFORM CHAPTER_TEXTURES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/assets/")
173173
file (COPY ${CHAPTER_TEXTURES} DESTINATION ${CMAKE_BINARY_DIR}/${CHAPTER_NAME}/textures)
174174
endif ()
175175
endfunction ()

0 commit comments

Comments
 (0)