aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuglioIsStupid <guglioisbusiness@gmail.com>2026-03-02 19:04:36 -0500
committerGitHub <noreply@github.com>2026-03-03 07:04:36 +0700
commit3dce71ef321499bf63be98111ab04e7f0773f6a1 (patch)
tree278a860509ce320e7f93ce0e594c3bce339dbd18
parentdea460381fd80af44d1d84ec6444a056000a3365 (diff)
Copy assets fix (#207)
* Update CopyAssets to ignore source files and only copy used files. * Forgot the debug copy assets * Remove leftovers from testing * Fix ClientSources.cmake to include WinsockNetLayer.cpp * Ignore xml and lang files in output, also remove Layout directory as it only includes a useless binary * Debug & Release use the same file structure
-rw-r--r--cmake/ClientSources.cmake1
-rw-r--r--cmake/CopyAssets.cmake68
2 files changed, 47 insertions, 22 deletions
diff --git a/cmake/ClientSources.cmake b/cmake/ClientSources.cmake
index f56b7ef0..c75b3bf3 100644
--- a/cmake/ClientSources.cmake
+++ b/cmake/ClientSources.cmake
@@ -476,6 +476,7 @@ set(MINECRAFT_CLIENT_SOURCES
"Windows64/Windows64_App.cpp"
"Windows64/Windows64_Minecraft.cpp"
"Windows64/Windows64_UIController.cpp"
+ "Windows64/Network/WinsockNetLayer.cpp"
"WitchModel.cpp"
"WitchRenderer.cpp"
"WitherBossModel.cpp"
diff --git a/cmake/CopyAssets.cmake b/cmake/CopyAssets.cmake
index 47b19ca7..a0252f73 100644
--- a/cmake/CopyAssets.cmake
+++ b/cmake/CopyAssets.cmake
@@ -12,9 +12,28 @@ set(_project_dir "${PROJECT_SOURCE_DIR}/Minecraft.Client")
function(copy_tree_if_exists src_rel dst_rel)
set(_src "${_project_dir}/${src_rel}")
set(_dst "${OUTPUT_DIR}/${dst_rel}")
+
if(EXISTS "${_src}")
file(MAKE_DIRECTORY "${_dst}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${_src}" "${_dst}")
+ file(GLOB_RECURSE _files RELATIVE "${_src}" "${_src}/*")
+
+ foreach(_file IN LISTS _files) # if not a source file
+ if(NOT _file MATCHES "\\.(cpp|c|h|hpp|xml|lang)$")
+ set(_full_src "${_src}/${_file}")
+ set(_full_dst "${_dst}/${_file}")
+
+ if(IS_DIRECTORY "${_full_src}")
+ file(MAKE_DIRECTORY "${_full_dst}")
+ else()
+ get_filename_component(_dst_dir "${_full_dst}" DIRECTORY)
+ file(MAKE_DIRECTORY "${_dst_dir}")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+ "${_full_src}" "${_full_dst}"
+ )
+ endif()
+ endif()
+ endforeach()
endif()
endfunction()
@@ -25,10 +44,15 @@ endfunction()
function(copy_file_if_exists src_rel dst_rel)
set(_src "${PROJECT_SOURCE_DIR}/${src_rel}")
set(_dst "${OUTPUT_DIR}/${dst_rel}")
+
+ get_filename_component(_dst_dir "${_dst}" DIRECTORY)
+ file(MAKE_DIRECTORY "${_dst_dir}")
+
if(EXISTS "${_src}")
- get_filename_component(_dst_dir "${_dst}" DIRECTORY)
- file(MAKE_DIRECTORY "${_dst_dir}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${_src}" "${_dst}")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+ "${_src}" "${_dst}"
+ )
endif()
endfunction()
@@ -46,24 +70,24 @@ function(copy_first_existing dst_rel)
endif()
endfunction()
-if(CONFIGURATION STREQUAL "Debug")
- copy_tree_if_exists("Durango/Sound" "Durango/Sound")
- copy_tree_if_exists("music" "music")
- copy_tree_if_exists("Windows64/GameHDD" "Windows64/GameHDD")
- copy_tree_if_exists("Common/Media" "Common/Media")
- copy_tree_if_exists("Common/res" "Common/res")
- copy_tree_if_exists("Common/Trial" "Common/Trial")
- copy_tree_if_exists("Common/Tutorial" "Common/Tutorial")
-else()
- copy_tree_if_exists("music" "music")
- copy_tree_if_exists("Windows64/GameHDD" "Windows64/GameHDD")
- copy_tree_if_exists("Common/Media" "Common/Media")
- copy_tree_if_exists("Common/res" "Common/res")
- copy_tree_if_exists("Common/Trial" "Common/Trial")
- copy_tree_if_exists("Common/Tutorial" "Common/Tutorial")
- copy_tree_if_exists("DurangoMedia" "Windows64Media")
- copy_tree_if_exists("Windows64Media" "Windows64Media")
-endif()
+function(remove_directory_if_exists rel_path)
+ set(_dir "${OUTPUT_DIR}/${rel_path}")
+ if(EXISTS "${_dir}")
+ file(REMOVE_RECURSE "${_dir}")
+ endif()
+endfunction()
+
+copy_tree_if_exists("Durango/Sound" "Windows64/Sound")
+copy_tree_if_exists("music" "music")
+copy_tree_if_exists("Windows64/GameHDD" "Windows64/GameHDD")
+copy_file_if_exists("Minecraft.Client/Common/Media/MediaWindows64.arc" "Common/Media/MediaWindows64.arc")
+copy_tree_if_exists("Common/res" "Common/res")
+copy_tree_if_exists("Common/Trial" "Common/Trial")
+copy_tree_if_exists("Common/Tutorial" "Common/Tutorial")
+copy_tree_if_exists("DurangoMedia" "Windows64Media")
+copy_tree_if_exists("Windows64Media" "Windows64Media")
+
+remove_directory_if_exists("Windows64Media/Layout")
# Some runtime code asserts if this directory tree is missing.
ensure_dir("Windows64/GameHDD")