summaryrefslogtreecommitdiff
path: root/xmake/rules/xcode/application
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-23 22:33:47 +0800
committerruki <[email protected]>2022-08-23 22:33:47 +0800
commitcc0dfe3d9eca8e11bb6c555c36edf3117d80559a (patch)
tree3a0bd0c9f04fe61db9927c2dc1bec0cc7bc3c06b /xmake/rules/xcode/application
parent3e51aca6b415fdec57c23b1ad430e29a7c1864a5 (diff)
fix load framework
Diffstat (limited to 'xmake/rules/xcode/application')
-rw-r--r--xmake/rules/xcode/application/build.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua
index bb4ca080b..b39c3546e 100644
--- a/xmake/rules/xcode/application/build.lua
+++ b/xmake/rules/xcode/application/build.lua
@@ -31,11 +31,13 @@ import("utils.progress")
-- os.vcp(frameworkdir, frameworksdir, {symlink = true})
function _copy_frameworks(frameworkdir, frameworksdir)
os.mkdir(frameworksdir)
+ local frameworkdir_dst = path.join(frameworksdir, path.filename(frameworkdir))
+ os.tryrm(frameworkdir_dst)
for _, filepath in ipairs(os.filedirs(path.join(frameworkdir, "*"))) do
if path.filename(filepath) == "Versions" then
- _copy_frameworks(filepath, path.join(frameworksdir, "Versions"))
+ _copy_frameworks(filepath, frameworkdir_dst)
else
- local dstpath = path.join(frameworksdir, path.filename(filepath))
+ local dstpath = path.join(frameworkdir_dst, path.filename(filepath))
os.tryrm(dstpath)
os.cp(filepath, dstpath, {symlink = true})
end
@@ -64,6 +66,12 @@ function main (target, opt)
end
os.vcp(target:targetfile(), path.join(binarydir, path.filename(target:targetfile())))
+ -- change rpath
+ -- @see https://github.com/xmake-io/xmake/issues/2679#issuecomment-1221839215
+ local targetfile = path.join(binarydir, path.filename(target:targetfile()))
+ os.vrunv("install_name_tool", {"-delete_rpath", "@loader_path", targetfile})
+ os.vrunv("install_name_tool", {"-add_rpath", "@executable_path/../Frameworks", targetfile})
+
-- copy dependent dynamic libraries and frameworks
for _, dep in ipairs(target:orderdeps()) do
if dep:kind() == "shared" then