diff options
| author | ruki <[email protected]> | 2018-04-28 22:20:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-04-28 22:20:41 +0800 |
| commit | cc90fd75c503493fdced6c7acce517e6874f44b8 (patch) | |
| tree | 1455135641304354c2d92112532140a2913ac40f /xmake/core/project | |
| parent | d94f0728facb33a2cddebb19b8a9c953f6cdde06 (diff) | |
compile echo umdf dll
Diffstat (limited to 'xmake/core/project')
| -rw-r--r-- | xmake/core/project/target.lua | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 722516bb6..09d0a8ada 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -147,13 +147,37 @@ end -- set the value to the target info function target:set(name_or_info, ...) + + -- set values to the given key? if type(name_or_info) == "string" then - local args = ... - if args ~= nil then - self._INFO[name_or_info] = table.unwrap(table.unique(table.join(...))) + + -- get extra config + local values = {...} + local extra_config = values[#values] + if table.is_dictionary(extra_config) then + table.remove(values) + else + extra_config = nil + end + + -- set values + local name = name_or_info + if #values > 0 then + self._INFO[name] = table.unwrap(table.unique(values)) else - self._INFO[name_or_info] = nil + self._INFO[name] = nil end + + -- save extra config + if extra_config then + self._INFO["__extra_" .. name] = self._INFO["__extra_" .. name] or {} + local extrascope = self._INFO["__extra_" .. name] + for _, value in ipairs(values) do + extrascope[value] = extra_config + end + end + + -- set a dictionary values elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:set(name, info) @@ -163,9 +187,34 @@ end -- add the value to the target info function target:add(name_or_info, ...) + + -- add values to the given key? if type(name_or_info) == "string" then - local info = table.wrap(self._INFO[name_or_info]) - self._INFO[name_or_info] = table.unwrap(table.unique(table.join(info, ...))) + + -- get extra config + local values = {...} + local extra_config = values[#values] + if table.is_dictionary(extra_config) then + table.remove(values) + else + extra_config = nil + end + + -- add values + local name = name_or_info + local info = table.wrap(self._INFO[name]) + self._INFO[name] = table.unwrap(table.unique(table.join(info, values))) + + -- save extra config + if extra_config then + self._INFO["__extra_" .. name] = self._INFO["__extra_" .. name] or {} + local extrascope = self._INFO["__extra_" .. name] + for _, value in ipairs(values) do + extrascope[value] = extra_config + end + end + + -- add a dictionary values elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:add(name, info) |
