From 66af7fc1e8c55c60fb2d1a242c66a1ecdfa28361 Mon Sep 17 00:00:00 2001 From: Warwick Date: Tue, 28 Nov 2023 11:49:09 +0000 Subject: [PATCH] Added the compilation of shaders to the build process. --- CMakeLists.txt | 4 ++++ compile_shaders.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00d6161..7a81fa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,3 +33,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ${GLFW_LIBRARIES} ${Vulkan_LIBRARIES} ${GLM_LIBRARY_DIRS}) + +add_custom_command(TARGET ${PROJECT_NAME} + PRE_BUILD + COMMAND ./compile_shaders.sh) diff --git a/compile_shaders.sh b/compile_shaders.sh index 9c266fd..08a2e37 100755 --- a/compile_shaders.sh +++ b/compile_shaders.sh @@ -1,3 +1,7 @@ #!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +cd $SCRIPT_DIR + glslc shaders/shader.vert -o shaders/shader.vert.spv glslc shaders/shader.frag -o shaders/shader.frag.spv