Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists.txt in project source directory not compiling shaders #117

Open
XenSakura opened this issue Jul 25, 2024 · 2 comments
Open

CMakeLists.txt in project source directory not compiling shaders #117

XenSakura opened this issue Jul 25, 2024 · 2 comments

Comments

@XenSakura
Copy link

Hello,

When attempting to run CMake in the project source directory, the shaders are not being compiled correctly with the default CMakeList provided with the project

error 2
error 1

I am not sure if this is a skill issue on my part, or if the CMakeLists.txt is genuinely broken, and I could appreciate some help.

@ArthurKValladares
Copy link

ArthurKValladares commented Aug 19, 2024

It's not, I just added execute_process(COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV}) to the inner loop to actually execute the compile command.

@FastIgnitionStudios
Copy link

It's not, I just added execute_process(COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV}) to the inner loop to actually execute the compile command.

thank you so much for this and can confirm i also am having this issue, i ended up putting the execute_process right here in the GLSL loop:

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})
message(STATUS COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV})
add_custom_command(
OUTPUT ${SPIRV}
COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV}

DEPENDS ${GLSL})

execute_process(COMMAND ${GLSL_VALIDATOR} -V ${GLSL} -o ${SPIRV}) <-----
list(APPEND SPIRV_BINARY_FILES ${SPIRV})
endforeach(GLSL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants