File tree Expand file tree Collapse file tree 4 files changed +29
-18
lines changed Expand file tree Collapse file tree 4 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 1+ macro (GENERATE_SHADER_RESOURCES _output_file)
2+ string (REPLACE ";" "\\ ;" SHADER_FILES_ARG "${ARGN} " )
3+ add_custom_command (OUTPUT
4+ "${_output_file} "
5+
6+ COMMAND ${CMAKE_COMMAND}
7+
8+ ARGS
9+ -D "SHADER_FILES=${SHADER_FILES_ARG} "
10+ -D "OUTPUT_FILE=${_output_file} "
11+ -P "${PROJECTM_SOURCE_DIR} /cmake/GenerateShaderResourcesScript.cmake"
12+
13+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
14+ DEPENDS # Watch scripts and shader files for changes
15+ ${PROJECTM_SOURCE_DIR} /cmake/ShaderResources.hpp.in
16+ ${PROJECTM_SOURCE_DIR} /cmake/GenerateShaderResources.cmake
17+ ${PROJECTM_SOURCE_DIR} /cmake/GenerateShaderResourcesScript.cmake
18+ ${ARGN}
19+ )
20+ endmacro ()
Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.20 FATAL_ERROR)
1+ cmake_minimum_required (VERSION 3.21 FATAL_ERROR)
22
33# Run as custom command in script mode if any shader file has changed.
44# Recreates the BuiltInTransitionsResources.hpp file accordingly.
55
66set (STATIC_SHADER_CONTENTS "" )
7+
8+ # Windows fix: the backslash is needed to escape the list in the script argument on UNIX shells,
9+ # but Windows keeps it and passes it on to CMake, breaking its use as a list separator.
10+ string (REPLACE "\\ ;" ";" SHADER_FILES "${SHADER_FILES} " )
11+
712foreach (shader_file IN LISTS SHADER_FILES)
813 cmake_path(GET shader_file FILENAME _shader_name)
914 cmake_path(GET shader_file EXTENSION _shader_type)
@@ -16,4 +21,4 @@ foreach(shader_file IN LISTS SHADER_FILES)
1621
1722endforeach ()
1823
19- configure_file (BuiltInTransitionsResources .hpp.in ${OUTPUT_DIR} /BuiltInTransitionsResources.hpp @ONLY)
24+ configure_file (${CMAKE_CURRENT_LIST_DIR} /ShaderResources .hpp.in " ${OUTPUT_FILE} " @ONLY)
File renamed without changes.
Original file line number Diff line number Diff line change @@ -10,27 +10,13 @@ set(TRANSITION_SHADER_FILES
1010 TransitionShaders/TransitionShaderMainGlsl330.frag
1111 )
1212
13- string (REPLACE ";" "\\ ;" TRANSITION_SHADER_FILES_ARG "${TRANSITION_SHADER_FILES} " )
14- add_custom_command (OUTPUT
15- ${CMAKE_CURRENT_BINARY_DIR} /BuiltInTransitionsResources.hpp
16-
17- COMMAND ${CMAKE_COMMAND}
18-
19- ARGS
20- -D SHADER_FILES="${TRANSITION_SHADER_FILES_ARG} "
21- -D OUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
22- -P ${CMAKE_CURRENT_SOURCE_DIR} /GenerateBuiltInTransitionsResources.cmake
23-
24- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
25- DEPENDS # Files watched for changes:
13+ include (GenerateShaderResources)
14+ generate_shader_resources(${CMAKE_CURRENT_BINARY_DIR} /BuiltInTransitionsResources.hpp
2615 ${TRANSITION_SHADER_FILES}
27- BuiltInTransitionsResources.hpp.in
28- GenerateBuiltInTransitionsResources.cmake
2916 )
3017
3118add_library (Renderer OBJECT
3219 ${CMAKE_CURRENT_BINARY_DIR} /BuiltInTransitionsResources.hpp
33- BuiltInTransitionsResources.hpp.in
3420 CopyTexture.cpp
3521 CopyTexture.hpp
3622 FileScanner.cpp
You can’t perform that action at this time.
0 commit comments