diff options
| author | ruki <[email protected]> | 2025-08-31 21:32:24 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-31 21:32:24 +0800 |
| commit | 90b7015682c5523dfa252ebfbab6ed16b3e4b16a (patch) | |
| tree | 57e393d03349ca5719c0b9b38e2103096586feff | |
| parent | bdb88d2f6a7c8118018c701c9bd96d0c086ed8f3 (diff) | |
| parent | aec56a9489a2df46d675589fb98b056a4dd2aca4 (diff) | |
Merge pull request #6756 from star-hengxing/patch-1
Use ccache when debug xmake package
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index b572c2fec..e2b22f926 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -270,30 +270,24 @@ function _get_configs(package, configs, opt) end local policies = get_config("policies") + local policies_list = policies and policies:split(",") or {} if package:config("lto") and (not policies or not policies:find("build.optimization.lto", 1, true)) then - if policies then - policies = policies .. ",build.optimization.lto" - else - policies = "build.optimization.lto" - end + table.insert(policies_list, "build.optimization.lto") end if package:config("asan") and (not policies or not policies:find("build.sanitizer.address", 1, true)) then - if policies then - policies = policies .. ",build.sanitizer.address" - else - policies = "build.sanitizer.address" - end + table.insert(policies_list, "build.sanitizer.address") end if not package:use_external_includes() and (not policies or not policies:find("package.include_external_headers", 1, true)) then - if policies then - policies = policies .. ",package.include_external_headers:n" - else - policies = "package.include_external_headers:n" - end + table.insert(policies_list, "package.include_external_headers:n") + end + if policies and policies:find("package.build.ccache", 1, true) then + table.insert(configs, "--ccachedir=" .. path.join(path.directory(package:cachedir()), "build_cache")) + table.insert(policies_list, "build.ccache") end if policies then - table.insert(configs, "--policies=" .. policies) + table.insert(configs, "--policies=" .. table.concat(policies_list, ",")) end + if not package:is_plat("windows", "mingw") and package:config("pic") ~= false then table.insert(cxflags, "-fPIC") end |
