From ae140bb6bf48c4e3f34e5d44efefd6c81b29fff6 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 16 Nov 2023 23:00:18 +1300 Subject: [PATCH] Copy and install hlsl files in the cxbx project --- CMakeLists.txt | 10 ---------- projects/cxbx/CMakeLists.txt | 13 +++++++++++++ projects/misc/batch.cmake | 11 ----------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fbf746dc..d370a386e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,16 +469,6 @@ install(FILES ${cxbxr_INSTALL_files} DESTINATION bin ) -install(FILES - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl" - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/CxbxVertexShaderPassthrough.hlsl" - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionPixelShader.hlsl" - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionPixelShader.hlsli" - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionVertexShaderState.hlsli" - "${CMAKE_SOURCE_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionVertexShader.hlsl" - DESTINATION bin/hlsl -) - 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 b33f1bea9..2f644119e 100644 --- a/projects/cxbx/CMakeLists.txt +++ b/projects/cxbx/CMakeLists.txt @@ -198,3 +198,16 @@ 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) diff --git a/projects/misc/batch.cmake b/projects/misc/batch.cmake index c6752b30b..e3678c490 100644 --- a/projects/misc/batch.cmake +++ b/projects/misc/batch.cmake @@ -27,14 +27,3 @@ message("Runtime Build Directory: ${TargetRunTimeDir}") # Copy glew32.dll to build type's folder. set(CXBXR_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll") file(COPY ${CXBXR_GLEW_DLL} DESTINATION ${TargetRunTimeDir}) - -# 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*") -set(HlslOutputDir ${TargetRunTimeDir}/hlsl) -file(MAKE_DIRECTORY ${HlslOutputDir}) -file(COPY ${CXBXR_HLSL_FILES} DESTINATION ${HlslOutputDir}) -# These files can be edited. -# Create backup copies for convenience of restoring original shader behaviour. -set(HlslBackupOutputDir ${HlslOutputDir}/backup) -file(MAKE_DIRECTORY ${HlslBackupOutputDir}) -file(COPY ${CXBXR_HLSL_FILES} DESTINATION ${HlslBackupOutputDir})