From 684d3338f24e41c488b985fdd80cab0d8c1b70e5 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 18 Nov 2023 11:34:05 +1300 Subject: [PATCH] Always copy hlsl files if they changed in the sources Require files to be explicitly declared in CXBXR_HEADER_EMU in order to be copied --- CMakeLists.txt | 14 ++++++++++++++ projects/cxbx/CMakeLists.txt | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d370a386e..584f04cf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,6 +469,20 @@ install(FILES ${cxbxr_INSTALL_files} DESTINATION bin ) +# Copy HLSL files to the output directory, which are loaded at runtime +set(CXBXR_HLSL_FILES ${CXBXR_HEADER_EMU}) +list(FILTER CXBXR_HLSL_FILES INCLUDE REGEX ".*/src/core/hle/D3D8/Direct3D9/[^/]+\.hlsli?") +add_custom_command( + TARGET misc-batch POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/hlsl + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/hlsl" + # These files can be edited. + # Create backup copies for convenience of restoring original shader behaviour. + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/hlsl/backup + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/hlsl/backup" +) +install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/hlsl DESTINATION bin) + set(cxbxr_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll") install(PROGRAMS ${cxbxr_GLEW_DLL} diff --git a/projects/cxbx/CMakeLists.txt b/projects/cxbx/CMakeLists.txt index 2f644119e..b33f1bea9 100644 --- a/projects/cxbx/CMakeLists.txt +++ b/projects/cxbx/CMakeLists.txt @@ -198,16 +198,3 @@ set_source_files_properties( HEADER_FILE_ONLY TRUE VS_TOOL_OVERRIDE "None" ) - -# Copy HLSL files to the output directory, which are loaded at runtime -file(GLOB CXBXR_HLSL_FILES "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/*.hlsl*") -add_custom_command( - TARGET cxbx PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory $/hlsl - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} $/hlsl - # These files can be edited. - # Create backup copies for convenience of restoring original shader behaviour. - COMMAND ${CMAKE_COMMAND} -E make_directory $/hlsl/backup - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} $/hlsl/backup -) -install(DIRECTORY $/hlsl DESTINATION bin)