Copy and install hlsl files in the cxbx project

This commit is contained in:
Anthony 2023-11-16 23:00:18 +13:00
parent a5b8f15a14
commit ae140bb6bf
3 changed files with 13 additions and 21 deletions

View File

@ -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}

View File

@ -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 $<TARGET_FILE_DIR:cxbx>/hlsl
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} $<TARGET_FILE_DIR:cxbx>/hlsl
# These files can be edited.
# Create backup copies for convenience of restoring original shader behaviour.
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:cxbx>/hlsl/backup
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} $<TARGET_FILE_DIR:cxbx>/hlsl/backup
)
install(DIRECTORY $<TARGET_FILE_DIR:cxbx>/hlsl DESTINATION bin)

View File

@ -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})