diff --git a/cmake/bgfxToolUtils.cmake b/cmake/bgfxToolUtils.cmake index 85942852..210b2ad3 100644 --- a/cmake/bgfxToolUtils.cmake +++ b/cmake/bgfxToolUtils.cmake @@ -215,7 +215,7 @@ if(TARGET bgfx::texturec) add_custom_command( OUTPUT ${ARG_OUTPUT} # COMMAND bgfx::texturec ${CLI} # - MAIN_DEPENDENCY ${ARG_INPUT} # + MAIN_DEPENDENCY ${ARG_FILE} # ) endfunction() endif() @@ -279,12 +279,12 @@ if(TARGET bgfx::geometryc) # --packnormal if(ARG_PACKNORMAL) - list(APPEND CLI "--packnormal ${ARG_PACKNORMAL}") + list(APPEND CLI "--packnormal" "${ARG_PACKNORMAL}") endif() # --packuv if(ARG_PACKUV) - list(APPEND CLI "--packuv" ${ARG_PACKUV}) + list(APPEND CLI "--packuv" "${ARG_PACKUV}") endif() # --tangent @@ -352,7 +352,7 @@ if(TARGET bgfx::geometryc) add_custom_command( OUTPUT ${ARG_OUTPUT} # COMMAND bgfx::geometryc ${CLI} # - MAIN_DEPENDENCY ${ARG_INPUT} # + MAIN_DEPENDENCY ${ARG_FILE} # ) endfunction() endif() @@ -539,15 +539,23 @@ if(TARGET bgfx::shaderc) set(${ARG_OUT} ${CLI} PARENT_SCOPE) endfunction() + # extensions consistent with those listed under bgfx/runtime/shaders + function(_bgfx_get_profile_path_ext PROFILE PROFILE_PATH_EXT) + string(REPLACE 300_es essl PROFILE ${PROFILE}) + string(REPLACE 120 glsl PROFILE ${PROFILE}) + string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) + string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) + set(${PROFILE_PATH_EXT} ${PROFILE} PARENT_SCOPE) + endfunction() + + # extensions consistent with embedded_shader.h function(_bgfx_get_profile_ext PROFILE PROFILE_EXT) string(REPLACE 300_es essl PROFILE ${PROFILE}) string(REPLACE 120 glsl PROFILE ${PROFILE}) string(REPLACE spirv spv PROFILE ${PROFILE}) string(REPLACE metal mtl PROFILE ${PROFILE}) - string(REPLACE s_3_0 dx9 PROFILE ${PROFILE}) string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) - set(${PROFILE_EXT} ${PROFILE} PARENT_SCOPE) endfunction() @@ -602,11 +610,12 @@ if(TARGET bgfx::shaderc) set(COMMANDS "") set(MKDIR_COMMANDS "") foreach(PROFILE ${PROFILES}) + _bgfx_get_profile_path_ext(${PROFILE} PROFILE_PATH_EXT) _bgfx_get_profile_ext(${PROFILE} PROFILE_EXT) if(ARGS_AS_HEADERS) set(HEADER_PREFIX .h) endif() - set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_EXT}/${SHADER_FILE_BASENAME}.bin${HEADER_PREFIX}) + set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT}/${SHADER_FILE_BASENAME}.bin${HEADER_PREFIX}) set(PLATFORM_I ${PLATFORM}) if(PROFILE STREQUAL "spirv") set(PLATFORM_I LINUX) @@ -635,7 +644,7 @@ if(TARGET bgfx::shaderc) ${CMAKE_COMMAND} -E make_directory - ${ARGS_OUTPUT_DIR}/${PROFILE_EXT} + ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT} ) list(APPEND COMMANDS COMMAND bgfx::shaderc ${CLI}) endforeach()