summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-27 00:43:26 +0800
committerruki <[email protected]>2018-11-26 22:20:36 +0800
commitb01f8aea133afbd401ee93b694f32828cc4a4f0c (patch)
tree4777137be952e460b65d36b19fa3edd5be577521 /xmake/core/tool/builder.lua
parent6c56467b2938a414f62311133fe8a0edb3aaa5c6 (diff)
add package extra config info
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index bc6d16aa4..653f7cbe1 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -115,6 +115,21 @@ function builder:_flagkinds()
return self._FLAGKINDS
end
+-- inherts from target packages
+function builder:_inherit_from_targetpkgs(values, target, name)
+ for _, pkg in ipairs(target:packages()) do
+ -- uses them instead of the builtin configs if exists extra package config
+ -- e.g. `add_packages("xxx", {links = "xxx"})`
+ local configinfo = target:pkgconfig(pkg:name())
+ if configinfo and configinfo[name] then
+ table.join2(values, configinfo[name])
+ else
+ -- uses the builtin package configs
+ table.join2(values, pkg:get(name))
+ end
+ end
+end
+
-- inherts from target deps
function builder:_inherit_from_target(values, target, name)
table.join2(values, target:get(name))
@@ -122,9 +137,7 @@ function builder:_inherit_from_target(values, target, name)
for _, opt in ipairs(target:options()) do
table.join2(values, opt:get(name))
end
- for _, opt in ipairs(target:packages()) do
- table.join2(values, opt:get(name))
- end
+ self:_inherit_from_targetpkgs(values, target, name)
end
end
@@ -333,9 +346,7 @@ function builder:_addflags_from_language(flags, target, getters)
for _, opt in ipairs(target:options()) do
table.join2(results, table.wrap(opt:get(name)))
end
- for _, pkg in ipairs(target:packages()) do
- table.join2(results, table.wrap(pkg:get(name)))
- end
+ self:_inherit_from_targetpkgs(results, target, name)
-- is option? get flagvalues of option with given flagname
elseif target:type() == "option" then