diff options
| author | ruki <[email protected]> | 2026-02-12 14:38:35 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-12 14:38:35 +0800 |
| commit | 529e5245342b028c6dbf21760f6960bd20890dea (patch) | |
| tree | 01fbdd723018f10055b686bcf68e66985ca2516b | |
| parent | 9d084db557d256923fc7f8a5daf66b21709f4bc4 (diff) | |
| parent | b97f0bdc0c796670dd3f303c8d93b24add1ab81b (diff) | |
Merge pull request #7313 from xmake-io/strip
add build.release.strip policy
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/mode/xmake.lua | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index a1aad6d97..38eaa3fa2 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -70,6 +70,8 @@ function policy.policies() ["build.sanitizer.undefined"] = {description = "Enable undefined sanitizer for c/c++ building.", type = "boolean"}, -- Enable build rpath ["build.rpath"] = {description = "Enable build rpath.", default = true, type = "boolean"}, + -- Strip symbols by default in release mode (mode.release) + ["build.release.strip"] = {description = "Strip symbols by default in release mode.", default = true, type = "boolean"}, -- Enable C++ modules for C++ building, even if no .mpp is involved in the compilation ["build.c++.modules"] = {description = "Enable C++ modules for C++ building.", type = "boolean"}, -- Enable non cascading changes (experimental) diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua index b4312eb12..7f74da28e 100644 --- a/xmake/rules/mode/xmake.lua +++ b/xmake/rules/mode/xmake.lua @@ -62,7 +62,7 @@ rule("mode.release") end -- strip all symbols - if not target:get("strip") then + if target:policy("build.release.strip") and not target:get("strip") then target:set("strip", "all") end @@ -94,7 +94,7 @@ rule("mode.releasedbg") end -- strip all symbols, but it will generate debug symbol file because debug/symbols is setted - if not target:get("strip") then + if target:policy("build.release.strip") and not target:get("strip") then target:set("strip", "all") end |
