From d0f83e55778e37afc767cf8fa382e16d6e5dc001 Mon Sep 17 00:00:00 2001 From: Akaps316 <48785708+Akaps316@users.noreply.github.com> Date: Sun, 5 Apr 2026 10:38:00 +0530 Subject: fix(xcode.application): resolve merge conflict with upstream dev - add rpath duplicate guard Co-authored-by: Qwen-Coder --- xmake/rules/xcode/application/build.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xmake/rules/xcode/application') diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua index 7d1c836fa..d55d71a9c 100644 --- a/xmake/rules/xcode/application/build.lua +++ b/xmake/rules/xcode/application/build.lua @@ -23,6 +23,7 @@ import("core.base.option") import("core.theme.theme") import("core.project.depend") import("private.tools.codesign") +import("utils.binary.rpath", {alias = "rpath_utils"}) import("utils.progress") function main (target, opt) @@ -49,8 +50,13 @@ function main (target, opt) -- @see https://github.com/xmake-io/xmake/issues/2679#issuecomment-1221839215 local targetfile = path.join(binarydir, path.filename(target:targetfile())) try { function () os.vrunv("install_name_tool", {"-delete_rpath", "@loader_path", targetfile}) end } + -- macOS uses @executable_path/../Frameworks due to Contents/MacOS/ layout + -- iOS/watchOS/tvOS/visionOS use flat bundle layout where frameworks are in the same directory as the executable local rpath = target:is_plat("macosx") and "@executable_path/../Frameworks" or "@executable_path/Frameworks" - os.vrunv("install_name_tool", {"-add_rpath", rpath, targetfile}) + local rpathdirs = rpath_utils.list(targetfile, {plat = target:plat(), arch = target:arch()}) or {} + if not table.contains(rpathdirs, rpath) then + os.vrunv("install_name_tool", {"-add_rpath", rpath, targetfile}) + end -- copy dependent dynamic libraries and frameworks for _, dep in ipairs(target:orderdeps()) do -- cgit v1.3.1