diff options
| author | ruki <[email protected]> | 2020-10-24 00:53:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-24 00:53:07 +0800 |
| commit | a83ee200a7c905f123b780881b4067b58aa305e3 (patch) | |
| tree | 3bd02b3810f525b2a70dd024b8f864d11a6ce32c /xmake/core/tool/builder.lua | |
| parent | 1d192142d27973332edae50e0b1c4a37080ea65f (diff) | |
improve fetch packages
Diffstat (limited to 'xmake/core/tool/builder.lua')
| -rw-r--r-- | xmake/core/tool/builder.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 72c8e1932..6ebff1861 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -407,6 +407,24 @@ function builder:has_flags(flags, flagkind) return self:_tool():has_flags(flags, flagkind) end +-- map flags from name and values, e.g. linkdirs, links, defines +function builder:map_flags(name, values, opt) + local flags = {} + local mapper = self:_tool()["nf_" .. name] + if mapper then + opt = opt or {} + for _, value in ipairs(table.wrap(values)) do + local flag = mapper(self:_tool(), value, opt.target, opt.targetkind) + if flag and flag ~= "" and (not opt.check or self:has_flags(flag)) then + table.join2(flags, flag) + end + end + end + if #flags > 0 then + return flags + end +end + -- get the format of the given target kind function builder:format(targetkind) local formats = self:get("formats") |
