summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-02 21:48:49 +0800
committerruki <[email protected]>2022-07-02 21:48:49 +0800
commit7d245d6fdbd5d6b13ab774507b5f610c564794d0 (patch)
tree1f3359ef9a1f4417c90fb765c13815fdbbab0be0
parent74be527086e0255db6c971d5d55575627f2401a9 (diff)
add lto to meson
-rw-r--r--xmake/modules/package/tools/meson.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index f419086d5..f76604735 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -59,10 +59,15 @@ function _get_configs(package, configs, opt)
table.insert(configs, "-Dbuildtype=" .. (package:debug() and "debug" or "release"))
-- add -fpic
- if package:is_plat("linux") and package:config("pic") then
+ if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "-Db_staticpic=true")
end
+ -- add lto
+ if package:config("lto") then
+ table.insert(configs, "-Db_lto=true")
+ end
+
-- add vs_runtime flags
if package:is_plat("windows") then
table.insert(configs, "-Db_vscrt=" .. package:config("vs_runtime"):lower())