From 33e4aadbf2aa5e69d16606994ddbd58df289f32c Mon Sep 17 00:00:00 2001 From: kindem Date: Thu, 15 Jan 2026 21:10:14 +0800 Subject: [PATCH 1/5] fix: runtime dep property in exported targets --- CMake/Target.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/Target.cmake b/CMake/Target.cmake index 86123845..0ba69a91 100644 --- a/CMake/Target.cmake +++ b/CMake/Target.cmake @@ -487,7 +487,7 @@ function(exp_add_library) string(REPLACE ">" "]" runtime_dep_files "${runtime_dep_files}") set_target_properties( ${arg_NAME} PROPERTIES - EXPORT_PROPERTIES "runtime_dep" + EXPORT_PROPERTIES "RUNTIME_DEP" RUNTIME_DEP "${runtime_dep_files}" ) endif () From 3f7576134efbca4fbd9955bd2587b7aee41dec2c Mon Sep 17 00:00:00 2001 From: kindem Date: Sun, 18 Jan 2026 22:19:57 +0800 Subject: [PATCH 2/5] fix: dll not copy after update issue (which cause failed to attach debugger) --- CMake/Target.cmake | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/CMake/Target.cmake b/CMake/Target.cmake index 0ba69a91..a53eaf97 100644 --- a/CMake/Target.cmake +++ b/CMake/Target.cmake @@ -15,7 +15,7 @@ endif() function(exp_gather_target_runtime_dependencies_recurse) set(options "") - set(singleValueArgs NAME OUT_RUNTIME_DEP) + set(singleValueArgs NAME OUT_RUNTIME_DEP OUT_DEP_TARGET) set(multiValueArgs "") cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -54,18 +54,21 @@ function(exp_gather_target_runtime_dependencies_recurse) list(APPEND result_runtime_dep $) endif () + list(APPEND result_dep_target ${l}) exp_gather_target_runtime_dependencies_recurse( NAME ${l} OUT_RUNTIME_DEP temp_runtime_dep + OUT_DEP_TARGET temp_dep_target ) - foreach(t ${temp_runtime_dep}) - list(APPEND result_runtime_dep ${t}) - endforeach() + list(APPEND result_runtime_dep ${temp_runtime_dep}) + list(APPEND result_dep_target ${temp_dep_target}) endforeach() endif() list(REMOVE_DUPLICATES result_runtime_dep) + list(REMOVE_DUPLICATES result_dep_target) set(${arg_OUT_RUNTIME_DEP} ${result_runtime_dep} PARENT_SCOPE) + set(${arg_OUT_DEP_TARGET} ${result_dep_target} PARENT_SCOPE) endfunction() function(exp_process_runtime_dependencies) @@ -77,26 +80,41 @@ function(exp_process_runtime_dependencies) exp_gather_target_runtime_dependencies_recurse( NAME ${arg_NAME} OUT_RUNTIME_DEP runtime_deps + OUT_DEP_TARGET dep_targets ) foreach (d ${arg_DEP_TARGET}) list(APPEND runtime_deps $) exp_gather_target_runtime_dependencies_recurse( NAME ${d} OUT_RUNTIME_DEP dep_target_runtime_deps + OUT_DEP_TARGET dep_dep_targets ) list(APPEND runtime_deps ${dep_target_runtime_deps}) + list(APPEND dep_targets ${dep_dep_targets}) endforeach () + foreach(r ${runtime_deps}) - add_custom_command( - TARGET ${arg_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${r} $ - ) - if (NOT ${arg_NOT_INSTALL}) - install( - FILES ${r} DESTINATION ${CMAKE_INSTALL_PREFIX}/${SUB_PROJECT_NAME}/Binaries - ) - endif () + list(APPEND copy_commands COMMAND ${CMAKE_COMMAND} -E copy_if_different ${r} $) endforeach() + if (NOT "${copy_commands}" STREQUAL "") + set(custom_target_name ${arg_NAME}.CopyRuntimeDeps) + add_custom_target( + ${custom_target_name} + ${copy_commands} + ) + + add_dependencies(${arg_NAME} ${custom_target_name}) + foreach (t ${dep_targets}) + add_dependencies(${custom_target_name} ${t}) + endforeach () + + set_target_properties(${custom_target_name} PROPERTIES FOLDER ${AUX_TARGETS_FOLDER}) + endif () + if (NOT ${arg_NOT_INSTALL} AND NOT "${runtime_deps}" STREQUAL "") + install( + FILES ${runtime_deps} DESTINATION ${CMAKE_INSTALL_PREFIX}/${SUB_PROJECT_NAME}/Binaries + ) + endif () endfunction() function(exp_expand_resource_path_expression) From 58a12a4760cb5ef76b135b42ac824353ee2ea81f Mon Sep 17 00:00:00 2001 From: kindem Date: Sun, 18 Jan 2026 22:23:45 +0800 Subject: [PATCH 3/5] fix: install static mirror tool lib --- Tool/MirrorTool/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Tool/MirrorTool/CMakeLists.txt b/Tool/MirrorTool/CMakeLists.txt index 75b78cfe..97e2009a 100644 --- a/Tool/MirrorTool/CMakeLists.txt +++ b/Tool/MirrorTool/CMakeLists.txt @@ -5,7 +5,6 @@ exp_add_library( PUBLIC_INC Include PUBLIC_LIB Mirror PUBLIC_MERGE_LIB libclang::libclang clipp::clipp - NOT_INSTALL ) file(GLOB exe_sources ExeSrc/*.cpp) From 2ebdec3a302ad41ddeac5035c7273460d1437dab Mon Sep 17 00:00:00 2001 From: kindem Date: Sun, 18 Jan 2026 22:38:43 +0800 Subject: [PATCH 4/5] feat: install engine cmake libs --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ba03855..8ac7d687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,3 +27,9 @@ add_subdirectory(Sample) if (${BUILD_EDITOR}) add_subdirectory(Editor) endif() + +file(GLOB engine_cmake_libs CMake/*.cmake) +install( + FILES ${engine_cmake_libs} + DESTINATION ${SUB_PROJECT_NAME}/CMake +) From 603368a69313e4409be0a45002538ae418c48f69 Mon Sep 17 00:00:00 2001 From: kindem Date: Sun, 18 Jan 2026 22:46:52 +0800 Subject: [PATCH 5/5] feat: update project template cmake --- Editor/Resource/ProjectTemplates/Default/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Editor/Resource/ProjectTemplates/Default/CMakeLists.txt b/Editor/Resource/ProjectTemplates/Default/CMakeLists.txt index 91ab9c5e..e048152f 100644 --- a/Editor/Resource/ProjectTemplates/Default/CMakeLists.txt +++ b/Editor/Resource/ProjectTemplates/Default/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 3.25) +cmake_minimum_required(VERSION %{cmakeMinVersion}) project(%{projectName}%) -include(ExternalProject) -include(GenerateExportHeader) +%{commonCMakeScripts}