From eb07c0fc0e6ef172dbde2542b11be7040a973679 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 9 Oct 2025 22:43:04 +0800 Subject: reuse rand32 --- xmake/core/package/package.lua | 4 ++-- xmake/plugins/project/cmake/cmakelists.lua | 4 ++-- xmake/rules/c++/unity_build/unity_build.lua | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 3f9917850..4e89c0cd7 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -830,9 +830,9 @@ function _instance:builddir() if self:is_local() then local name = self:name():lower():gsub("::", "_") local rootdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, self:version_str()) - builddir = path.join(rootdir, "cache", "build_" .. hash.rand64()) + builddir = path.join(rootdir, "cache", "build_" .. hash.rand32()) else - builddir = "build_" .. hash.rand64() + builddir = "build_" .. hash.rand32() end self._BUILDDIR = builddir end diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index a4d8361e1..a339a654e 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -1074,7 +1074,7 @@ function _add_target_link_libraries(cmakelists, target, outputdir) local has_links = #target:objectfiles() > objectfiles_set:size() - local key = target:name() .. "_" .. hash.rand64() + local key = target:name() .. "_" .. hash.rand32() if has_links then cmakelists:print("add_library(target_objectfiles_%s OBJECT IMPORTED GLOBAL)", key) cmakelists:print("set_property(TARGET target_objectfiles_%s PROPERTY IMPORTED_OBJECTS", key) @@ -1244,7 +1244,7 @@ function _add_target_custom_commands_for_batchcmds(cmakelists, target, outputdir -- -- @see https://gitlab.kitware.com/cmake/cmake/-/issues/17802 -- - local key = target:name() .. "_" .. hash.rand64() + local key = target:name() .. "_" .. hash.rand32() cmakelists:print("add_custom_command(OUTPUT output_%s", key) for _, cmd in ipairs(cmds) do local command = _get_command_string(cmd, outputdir) diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua index d5f5b060c..3df2d75b4 100644 --- a/xmake/rules/c++/unity_build/unity_build.lua +++ b/xmake/rules/c++/unity_build/unity_build.lua @@ -36,7 +36,7 @@ function _merge_unityfile(target, sourcefile_unity, sourcefiles, opt) sourcefile_unity = path.absolute(sourcefile_unity) sourcefile = path.relative(sourcefile, path.directory(sourcefile_unity)) if uniqueid then - unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.rand64()) + unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.rand32()) end unityfile:print("#include \"%s\"", sourcefile) if uniqueid then -- cgit v1.3.1 From acf77581eac34c02a22004da6808754257159cd2 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 9 Oct 2025 22:57:44 +0800 Subject: show stack in module test --- tests/projects/c++/modules/test_base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/projects/c++/modules/test_base.lua b/tests/projects/c++/modules/test_base.lua index 0a0d07dae..6abbeecee 100644 --- a/tests/projects/c++/modules/test_base.lua +++ b/tests/projects/c++/modules/test_base.lua @@ -103,7 +103,7 @@ function build_tests(toolchain_name, opt) end os.exec("xmake clean -a") - os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-c --yes " .. policies .. flags) + os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-cD --yes " .. policies .. flags) if opt.build then opt.build() else -- cgit v1.3.1 From af2c3462e2897f203d2f846fc1802b192e4e12ad Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 9 Oct 2025 22:58:25 +0800 Subject: reuse hash64 in unitybuild --- xmake/plugins/project/cmake/cmakelists.lua | 4 ++-- xmake/rules/c++/unity_build/unity_build.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index a339a654e..a4d8361e1 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -1074,7 +1074,7 @@ function _add_target_link_libraries(cmakelists, target, outputdir) local has_links = #target:objectfiles() > objectfiles_set:size() - local key = target:name() .. "_" .. hash.rand32() + local key = target:name() .. "_" .. hash.rand64() if has_links then cmakelists:print("add_library(target_objectfiles_%s OBJECT IMPORTED GLOBAL)", key) cmakelists:print("set_property(TARGET target_objectfiles_%s PROPERTY IMPORTED_OBJECTS", key) @@ -1244,7 +1244,7 @@ function _add_target_custom_commands_for_batchcmds(cmakelists, target, outputdir -- -- @see https://gitlab.kitware.com/cmake/cmake/-/issues/17802 -- - local key = target:name() .. "_" .. hash.rand32() + local key = target:name() .. "_" .. hash.rand64() cmakelists:print("add_custom_command(OUTPUT output_%s", key) for _, cmd in ipairs(cmds) do local command = _get_command_string(cmd, outputdir) diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua index 3df2d75b4..d5f5b060c 100644 --- a/xmake/rules/c++/unity_build/unity_build.lua +++ b/xmake/rules/c++/unity_build/unity_build.lua @@ -36,7 +36,7 @@ function _merge_unityfile(target, sourcefile_unity, sourcefiles, opt) sourcefile_unity = path.absolute(sourcefile_unity) sourcefile = path.relative(sourcefile, path.directory(sourcefile_unity)) if uniqueid then - unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.rand32()) + unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.rand64()) end unityfile:print("#include \"%s\"", sourcefile) if uniqueid then -- cgit v1.3.1