Exclude more files and make sure GameHDD exists

This commit is contained in:
rtm516 2026-03-11 02:55:57 +00:00
parent cca184d988
commit cad2fe2965
No known key found for this signature in database
GPG key ID: 331715B8B007C67A
3 changed files with 38 additions and 6 deletions

View file

@ -83,3 +83,14 @@ add_custom_target(CopyRedist ALL
add_dependencies(Minecraft.Client CopyRedist)
set_property(TARGET CopyRedist PROPERTY FOLDER "Build")
# Make sure GameHDD exists
add_custom_target(EnsureGameHDD ALL
COMMAND ${CMAKE_COMMAND}
-E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/Windows64/GameHDD"
COMMENT "Ensuring GameHDD directory exists..."
VERBATIM
)
add_dependencies(Minecraft.Client EnsureGameHDD)
set_property(TARGET EnsureGameHDD PROPERTY FOLDER "Build")

View file

@ -10,8 +10,6 @@ set(ASSET_FOLDER_PAIRS
"Common/res" "Common/res"
"Common/Trial" "Common/Trial"
"Common/Tutorial" "Common/Tutorial"
# "Windows64/GameHDD" "Windows64/GameHDD"
"DurangoMedia" "Windows64Media" # Use Durango as a base for the Windows64 media
"Windows64Media" "Windows64Media"
)
@ -20,13 +18,22 @@ set(ASSET_EXCLUDE_FILES
"*.cpp" "*.h"
"*.xml" "*.lang"
"*.bat" "*.cmd"
"*.msscmp" "*.binka"
"*.msscmp" "*.binka" # Old audio formats
"*.swf" # These are built into the .arc
"*.resx" "*.loc"
"*.wav" # Unsupported audio format
"*.xui"
"MediaPS*" "MediaOrbis.arc" "MediaDurango.arc" # Console media
)
# Global folder exclusions applied to every folder copy
set(ASSET_EXCLUDE_FOLDERS
"Graphics"
)
# Join the exclusion patterns into a single string for passing to the copy script
list(JOIN ASSET_EXCLUDE_FILES "|" ASSET_EXCLUDE_FILES_STR)
list(JOIN ASSET_EXCLUDE_FOLDERS "|" ASSET_EXCLUDE_FOLDERS_STR)
function(setup_asset_copy_targets)
set(copy_commands "")
@ -44,6 +51,7 @@ function(setup_asset_copy_targets)
"-DCOPY_SOURCE=${CMAKE_CURRENT_SOURCE_DIR}/${src}"
"-DCOPY_DEST=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${dest}"
"-DEXCLUDE_FILES=${ASSET_EXCLUDE_FILES_STR}"
"-DEXCLUDE_FOLDERS=${ASSET_EXCLUDE_FOLDERS_STR}"
-P "${COPY_SCRIPT}"
)
endforeach()
@ -57,4 +65,4 @@ function(setup_asset_copy_targets)
add_dependencies(Minecraft.Client AssetCopyTargets)
set_property(TARGET AssetCopyTargets PROPERTY FOLDER "Build")
endfunction()
endfunction()

View file

@ -6,7 +6,8 @@
# COPY_DEST destination directory
#
# Optional:
# EXCLUDE_FILES semicolon-separated file patterns to exclude
# EXCLUDE_FILES pipe-separated file patterns to exclude
# EXCLUDE_FOLDERS pipe-separated folder patterns to exclude
if(NOT COPY_SOURCE OR NOT COPY_DEST)
message(FATAL_ERROR "COPY_SOURCE and COPY_DEST must be set.")
@ -17,6 +18,10 @@ if(EXCLUDE_FILES)
string(REPLACE "|" ";" EXCLUDE_FILES "${EXCLUDE_FILES}")
endif()
if(EXCLUDE_FOLDERS)
string(REPLACE "|" ";" EXCLUDE_FOLDERS "${EXCLUDE_FOLDERS}")
endif()
if(CMAKE_HOST_WIN32)
set(robocopy_args
"${COPY_SOURCE}" "${COPY_DEST}"
@ -27,6 +32,10 @@ if(CMAKE_HOST_WIN32)
list(APPEND robocopy_args /XF ${EXCLUDE_FILES})
endif()
if(EXCLUDE_FOLDERS)
list(APPEND robocopy_args /XD ${EXCLUDE_FOLDERS})
endif()
execute_process(
COMMAND robocopy.exe ${robocopy_args}
RESULT_VARIABLE rc
@ -42,6 +51,10 @@ elseif(CMAKE_HOST_UNIX)
list(APPEND rsync_args "--exclude=${pattern}")
endforeach()
foreach(pattern IN LISTS EXCLUDE_FOLDERS)
list(APPEND rsync_args "--exclude=${pattern}")
endforeach()
# Trailing slashes ensure rsync copies contents, not the directory itself
execute_process(
COMMAND rsync ${rsync_args} "${COPY_SOURCE}/" "${COPY_DEST}/"
@ -53,4 +66,4 @@ elseif(CMAKE_HOST_UNIX)
endif()
else()
message(FATAL_ERROR "Unsupported host platform for asset copying.")
endif()
endif()