summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/vsxmake/getinfo.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-08-20 15:56:56 +0800
committerOpportunityLiu <[email protected]>2019-08-20 15:56:56 +0800
commit58d8987b3030d211c468283b67ef31a937596128 (patch)
tree0c1133c5ef0607911f3739a6a963e0a74c09b510 /xmake/plugins/project/vsxmake/getinfo.lua
parenta0d6bcacb190ce0538ded1c15336b6abdafbb7c2 (diff)
add vsxmake support
Diffstat (limited to 'xmake/plugins/project/vsxmake/getinfo.lua')
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 53200dd2c..0508ebbd8 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.semver")
+import("core.base.hashset")
import("core.project.config")
import("core.project.cache")
import("core.project.project")
@@ -129,6 +130,37 @@ function _get_values(target, name)
return table.unique(values)
end
+-- add search directories for all dependent shared libraries on windows
+function _make_runpath(target)
+
+ local searchdirs = hashset.new()
+ local pathenv = {}
+
+ local function insert(dir)
+ if not path.is_absolute(dir) then
+ dir = path.absolute(dir, os.projectdir())
+ end
+ if searchdirs:insert(dir) then
+ table.insert(pathenv, dir)
+ end
+ end
+
+ for _, linkdir in ipairs(target:get("linkdirs")) do
+ insert(linkdir)
+ end
+ for _, opt in ipairs(target:orderopts()) do
+ for _, linkdir in ipairs(opt:get("linkdirs")) do
+ insert(linkdir)
+ end
+ end
+ for _, dep in ipairs(target:orderdeps()) do
+ if dep:targetkind() == "shared" then
+ insert(dep:targetdir())
+ end
+ end
+ return pathenv
+end
+
-- make target info
function _make_targetinfo(mode, arch, target)
@@ -183,6 +215,7 @@ function _make_targetinfo(mode, arch, target)
local defs = table.imap(table.wrap(v), function(_, v) return vformat(v) end)
runenvs[k] = path.joinenv(defs)
end
+ runenvs["PATH"] = path.joinenv(_make_runpath(target)) .. ";" .. (runenvs["PATH"] or "$([System.Environment]::GetEnvironmentVariable('PATH'))")
local runenvstr = {}
for k, v in pairs(runenvs) do
table.insert(runenvstr, k .. "=" .. v)