diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index a36fbbe55..3e3b4ca5d 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -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}/$/Windows64/GameHDD" + COMMENT "Ensuring GameHDD directory exists..." + VERBATIM +) + +add_dependencies(Minecraft.Client EnsureGameHDD) +set_property(TARGET EnsureGameHDD PROPERTY FOLDER "Build") \ No newline at end of file diff --git a/Minecraft.Client/cmake/AssetCopyTargets.cmake b/Minecraft.Client/cmake/AssetCopyTargets.cmake index 8bfbaafae..0b29220f0 100644 --- a/Minecraft.Client/cmake/AssetCopyTargets.cmake +++ b/Minecraft.Client/cmake/AssetCopyTargets.cmake @@ -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}/$/${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() \ No newline at end of file +endfunction() diff --git a/Minecraft.Client/cmake/CopyAssets.cmake b/Minecraft.Client/cmake/CopyAssets.cmake index d05d2f2cc..d7a2c546c 100644 --- a/Minecraft.Client/cmake/CopyAssets.cmake +++ b/Minecraft.Client/cmake/CopyAssets.cmake @@ -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() \ No newline at end of file +endif()