summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-17 16:36:12 +0800
committerOpportunityLiu <[email protected]>2019-07-19 11:48:32 +0800
commit482dfde9fd5cfa7ca02d70d76baf4b3a25f1d2b1 (patch)
tree2e7009c6149d2fec6141b1b7db8b95cfd2d161b6
parent8a976c88c7b9da0a306fbbeac22870a7b00b4682 (diff)
add values from opts and packages
-rw-r--r--xmake/core/base/table.lua15
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua23
2 files changed, 26 insertions, 12 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 9af47b5a8..3fc5d92c8 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -258,17 +258,10 @@ function table.unique(array, barrier)
end
-- add unique item
- if type(v) == "string" then
- if not exists[v] then
- exists[v] = true
- table.insert(unique, v)
- end
- else
- local key = "\"" .. tostring(v) .. "\""
- if not exists[key] then
- exists[key] = true
- table.insert(unique, v)
- end
+ if not exists[v] then
+ -- v will not be nil
+ exists[v] = true
+ table.insert(unique, v)
end
end
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 1f9760f1a..205e0ac4b 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -97,13 +97,34 @@ end
function _get_values(target, name)
local values = table.wrap(target:get(name))
+
+ -- from deps
for _, dep in irpairs(target:orderdeps()) do
local depinherit = target:extraconf("deps", dep:name(), "inherit")
if depinherit == nil or depinherit then
table.join2(values, dep:get(name, {interface = true}))
end
end
- return values
+
+ -- from opts
+ for _, opt in ipairs(target:orderopts()) do
+ table.join2(values, table.wrap(opt:get(name)))
+ end
+
+ -- from packages
+ for _, pkg in ipairs(target:orderpkgs()) do
+ -- uses them instead of the builtin configs if exists extra package config
+ -- e.g. `add_packages("xxx", {links = "xxx"})`
+ local configinfo = target:pkgconfig(pkg:name())
+ if configinfo and configinfo[name] then
+ table.join2(values, configinfo[name])
+ else
+ -- uses the builtin package configs
+ table.join2(values, pkg:get(name))
+ end
+ end
+
+ return table.unique(values)
end
-- make target info