summaryrefslogtreecommitdiff
path: root/tests/projects/objc/iosapp_framework_rpath/test.lua
diff options
context:
space:
mode:
authorAkaps316 <[email protected]>2026-04-03 19:54:54 +0530
committerAkaps316 <[email protected]>2026-04-04 20:24:39 +0530
commite43e3e3ff780d130a1e1402ed9eabf0aa54c5c1d (patch)
treeda7d68aab4b2aa406f71ac4f713bd2be29000d24 /tests/projects/objc/iosapp_framework_rpath/test.lua
parent39fd35ea9d5d14079e4669b85423d488c9097cd4 (diff)
fix(xcode.application): use the correct framework rpath for iOS apps
Use @executable_path/Frameworks for iphoneos application bundles when embedding dependent frameworks. The existing @executable_path/../Frameworks rpath is correct for macOS app layout, but incorrect for iOS where the executable lives directly in MyApp.app and embedded frameworks live in MyApp.app/Frameworks. Add a regression test that builds an iOS simulator app with an embedded framework and verifies the generated LC_RPATH.
Diffstat (limited to 'tests/projects/objc/iosapp_framework_rpath/test.lua')
-rw-r--r--tests/projects/objc/iosapp_framework_rpath/test.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/projects/objc/iosapp_framework_rpath/test.lua b/tests/projects/objc/iosapp_framework_rpath/test.lua
new file mode 100644
index 000000000..41e770e68
--- /dev/null
+++ b/tests/projects/objc/iosapp_framework_rpath/test.lua
@@ -0,0 +1,30 @@
+function main(t)
+ if not is_host("macosx") then
+ return t:skip("wrong host platform")
+ end
+
+ os.execv("xmake", {"f", "-p", "iphoneos", "-a", "arm64", "--appledev=simulator", "-c"})
+ os.execv("xmake", {"-vD"})
+
+ import("utils.binary.rpath")
+ local appfile = "build/iphoneos/arm64/release/demo.app/demo"
+ local rpaths = rpath.list(appfile)
+ local found_ios = false
+ local found_macos = false
+ if rpaths then
+ for _, p in ipairs(rpaths) do
+ if p == "@executable_path/Frameworks" then
+ found_ios = true
+ end
+ if p == "@executable_path/../Frameworks" then
+ found_macos = true
+ end
+ end
+ end
+ if not found_ios then
+ raise("missing iOS framework rpath @executable_path/Frameworks")
+ end
+ if found_macos then
+ raise("found macOS-style framework rpath in iOS app")
+ end
+end