summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-02 09:13:40 +0800
committerruki <[email protected]>2022-07-02 09:13:40 +0800
commit841f24cf6a0b94a167f4b4c5f2ca8f6564383c0c (patch)
treeaeb14c96ec29ce0bdf6c539483a53e850dcd84e5
parentb53fd8d1ecec8055f5ec351c3ad02923e74b9dfd (diff)
add lto config for package
-rw-r--r--xmake/modules/private/action/require/impl/package.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index ca11a10d3..cf330f308 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -310,6 +310,9 @@ function _add_package_configurations(package)
if package:extraconf("configs", "pic", "default") == nil then
package:add("configs", "pic", {builtin = true, description = "Enable the position independent code.", default = true, type = "boolean"})
end
+ if package:extraconf("configs", "lto", "default") == nil then
+ package:add("configs", "lto", {builtin = true, description = "Enable the link-time build optimization.", type = "boolean"})
+ end
if package:extraconf("configs", "vs_runtime", "default") == nil then
package:add("configs", "vs_runtime", {builtin = true, description = "Set vs compiler runtime.", values = {"MT", "MTd", "MD", "MDd"}})
end
@@ -474,6 +477,7 @@ function _init_requireinfo(requireinfo, package, opt)
if project.policy("package.inherit_external_configs") then
requireinfo.configs.vs_runtime = requireinfo.configs.vs_runtime or get_config("vs_runtime")
end
+ requireinfo.configs.lto = requireinfo.configs.lto or project.policy("build.optimization.lto")
end
end
end