summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-22 00:37:37 +0800
committerruki <[email protected]>2018-11-21 21:45:46 +0800
commite940f6ee0d984a69ccc253f30a14cc0da991d05e (patch)
treefba1288008dc4282ebf0d232839211606ed31caf /xmake/core/tool/builder.lua
parente18261cb79944a7797e174816f345e4ed2a20d1d (diff)
attach package info
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua26
1 files changed, 21 insertions, 5 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index e7defb63e..4f332b9ab 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -198,9 +198,16 @@ function builder:_addflags_from_config(flags)
end
-- add flags from the option
-function builder:_addflags_from_option(flags, target)
+function builder:_addflags_from_option(flags, opt)
for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(flags, self:_mapflags(target:get(flagkind)))
+ table.join2(flags, self:_mapflags(opt:get(flagkind)))
+ end
+end
+
+-- add flags from the package
+function builder:_addflags_from_package(flags, pkg)
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(flags, self:_mapflags(pkg:get(flagkind)))
end
end
@@ -225,11 +232,18 @@ function builder:_addflags_from_target(flags, target)
targetflags = {}
self:_addflags_from_language(targetflags, target)
- -- add the flags for the target options
+ -- add flags for the target
if target:type() == "target" then
+
+ -- add flags from options
for _, opt in ipairs(target:options()) do
self:_addflags_from_option(targetflags, opt)
end
+
+ -- add flags from packages
+ for _, pkg in ipairs(target:packages()) do
+ self:_addflags_from_package(targetflags, pkg)
+ end
end
-- add the target flags
@@ -310,13 +324,15 @@ function builder:_addflags_from_language(flags, target, getters)
end
, option = function (name)
- -- is target? get flagvalues of the attached options
+ -- is target? get flagvalues of the attached options and packages
local results = {}
if target:type() == "target" then
-
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
-- is option? get flagvalues of option with given flagname
elseif target:type() == "option" then