Skip to content

Commit 529e524

Browse files
authored
Merge pull request #7313 from xmake-io/strip
add build.release.strip policy
2 parents 9d084db + b97f0bd commit 529e524

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

xmake/core/project/policy.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ function policy.policies()
7070
["build.sanitizer.undefined"] = {description = "Enable undefined sanitizer for c/c++ building.", type = "boolean"},
7171
-- Enable build rpath
7272
["build.rpath"] = {description = "Enable build rpath.", default = true, type = "boolean"},
73+
-- Strip symbols by default in release mode (mode.release)
74+
["build.release.strip"] = {description = "Strip symbols by default in release mode.", default = true, type = "boolean"},
7375
-- Enable C++ modules for C++ building, even if no .mpp is involved in the compilation
7476
["build.c++.modules"] = {description = "Enable C++ modules for C++ building.", type = "boolean"},
7577
-- Enable non cascading changes (experimental)

xmake/rules/mode/xmake.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ rule("mode.release")
6262
end
6363

6464
-- strip all symbols
65-
if not target:get("strip") then
65+
if target:policy("build.release.strip") and not target:get("strip") then
6666
target:set("strip", "all")
6767
end
6868

@@ -94,7 +94,7 @@ rule("mode.releasedbg")
9494
end
9595

9696
-- strip all symbols, but it will generate debug symbol file because debug/symbols is setted
97-
if not target:get("strip") then
97+
if target:policy("build.release.strip") and not target:get("strip") then
9898
target:set("strip", "all")
9999
end
100100

0 commit comments

Comments
 (0)