summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-07 09:01:16 +0800
committerruki <[email protected]>2017-02-07 09:01:16 +0800
commit072f97eb86fd3626fb70325e17e028bf90766dc2 (patch)
treec7b323a7bb3d9bc38ea2eba024eff2591d0dc6c7 /xmake/core/tool/builder.lua
parent59c7e717b3e627fbfcee313f0c1d050e9bbceb5b (diff)
move some linker interfaces to builder
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index c529d2327..c0a75dac8 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -109,6 +109,51 @@ function builder:_mapflags(flags)
return results
end
+-- get the flag kinds
+function builder:_flagkinds()
+
+ -- get it
+ return self._FLAGKINDS
+end
+
+-- add flags from the configure
+function builder:_addflags_from_config(flags)
+
+ -- done
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(flags, config.get(flagkind))
+ end
+end
+
+-- add flags from the target
+function builder:_addflags_from_target(flags, target)
+
+ -- add the target flags
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(flags, self:_mapflags(target:get(flagkind)))
+ end
+
+ -- for target options?
+ if target.options then
+
+ -- add the flags for the target options
+ for _, opt in ipairs(target:options()) do
+
+ -- add the flags from the option
+ self:_addflags_from_target(flags, opt)
+ end
+ end
+end
+
+-- add flags from the platform
+function builder:_addflags_from_platform(flags)
+
+ -- add flags
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(flags, platform.get(flagkind))
+ end
+end
+
-- add flags (named) from the language
function builder:_addflags_from_language(flags, target)