Package (fat lib universal) - Apple
Xmake Version
2.9.4
Operating System Version and Architecture
Windows 10
Describe Bug
I went to dig into the source code, in package.lua there is a condition on the SDKs: iphoneos, watchos, macosx instead of it actually being on the platforms, despite the variable called 'plat', also it should be added in the condition of the platforms for tvos, xros and modify the value of the sdk present by the value of the platform and not the sdk. For the moment when run the command via --arch="arm64,x86_64", it always takes the latest architecture and never does a fat lib universal. The condition should be based on the values ​​of the platforms, for: iOS, macOS, tvOS, visionOS, watchOS.
package.lua : local plat = args.plat ... if plat == "iphoneos" or plat == "watchos" or plat == "macosx" then
Exemple command : xmake m package --plat=iphoneos --arch="arm64,x86_64" -f "--appledev=simulator --target_minver=12.0 --mode=debug --kind=static --yes
Expected Behavior
No
Project Configuration
No config
Additional Information and Error Logs
No error log
?
?
There is a problem regarding the universal fat lib package for Apple, the source code that does this is located in package.lua, this does not package anything. If we put --arch"arm64,x86_64", with a 'lipo -info mylib.a" we only see x86_64. Via xmake m package. I suppose that they test in the condition on the SDKs and not on the values ​​of the platforms, and the condition is also missing on tvOS and visionOS.
it works for me.
ruki-2:test ruki$ xmake m package --plat=iphoneos --arch="arm64,x86_64" -f "--appledev=simulator -
-target_minver=12.0 --mode=debug --kind=static"
checking for Xcode directory ... /Applications/Xcode.app
checking for Codesign Identity of Xcode ... Apple Development: [email protected] (T3NA4MRVPU)
checking for Mobile Provision of Xcode ... iphone_ent
checking for SDK version of Xcode for iphoneos (arm64) ... 17.0
checking for Minimal target version of Xcode for iphoneos (arm64) ... 12.0
[ 50%]: cache compiling.debug src/foo.cpp
[ 62%]: archiving.debug libfoo.a
[ 75%]: cache compiling.debug src/main.cpp
[ 87%]: linking.debug test
[100%]: build ok, spent 2.978s
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for iphoneos (x86_64) ... 17.0
checking for Minimal target version of Xcode for iphoneos (x86_64) ... 12.0
[ 50%]: cache compiling.debug src/foo.cpp
[ 62%]: archiving.debug libfoo.a
[ 75%]: cache compiling.debug src/main.cpp
[ 87%]: linking.debug test
[100%]: build ok, spent 1.664s
ruki-2:test ruki$ file build/foo.pkg/iphoneos/
arm64/ universal/ x86_64/
ruki-2:test ruki$ file build/foo.pkg/iphoneos/universal/lib/debug/libfoo.a
build/foo.pkg/iphoneos/universal/lib/debug/libfoo.a: Mach-O universal binary with 2 architectures: [x86_64:current ar archive random library] [arm64:current ar archive random library]
build/foo.pkg/iphoneos/universal/lib/debug/libfoo.a (for architecture x86_64): current ar archive random library
build/foo.pkg/iphoneos/universal/lib/debug/libfoo.a (for architecture arm64): current ar archive random library