diff options
| author | ruki <[email protected]> | 2016-03-21 20:57:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-21 20:57:37 +0800 |
| commit | b898400a3a5f18d332ce7ef159769d8f17fd28e5 (patch) | |
| tree | 275f124aa7c17c6090d25fefb226b0678f6d231d /xmake/core/project/target.lua | |
| parent | f0623bf26279430deb6799b7816fb61996120166 (diff) | |
add project option
Diffstat (limited to 'xmake/core/project/target.lua')
| -rw-r--r-- | xmake/core/project/target.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 6b1da3215..a7fd954d3 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -27,7 +27,9 @@ local target = target or {} local os = require("base/os") local path = require("base/path") local table = require("base/table") +local option = require("project/option") local config = require("project/config") +local linker = require("platform/linker") local platform = require("platform/platform") -- get the filename from the given name and kind @@ -60,6 +62,39 @@ function target.name(self) return self._NAME end +-- get the linker with the target kind +function target.linker(self) + + -- init the linker from the given kind + local result = linker.init(self:get("kind")) + if not result then + os.raise("cannot get linker with kind: %s", self:get("kind")) + end + + -- ok? + return result + +end + +-- get the options +function target.options(self) + + -- the options + local options = {} + for _, name in ipairs(table.wrap(self:get("options"))) do + + -- get option if be enabled + local opt = nil + if config.get(name) then opt = poption.load(name) end + if nil ~= opt then + options[name] = opt + end + end + + -- ok? + return options +end + -- get the object file directory function target.objectdir(self) |
