Swift Package is built as a universal binary in main project

Swift Package is built as a universal binary in main project

Hi,

Following line from Xcode build log shows that Xcode is building swift package dependencies as universal binaries

复制代码

CreateUniversalBinary .../UIComponents.o normal arm64\ x86_64 (in target 'UIComponents' from project 'PlatformPackages')

Also confirmed with lipo

复制代码

lipo -info UIComponents.o Architectures in the fat file: UIComponents.o are: x86_64 arm64

Is it possible to build swift package for active architecture only? Or for selected architectures based on configuration.

created

Dec '21
*

last reply

Apr '22

29 days later

Jon_Shier

Jan '22

AFAIK, Swift packages in Xcode are built for the active architecture in debug mode and universally in release mode and there's no way to control the behavior. You may try changing the setting in your project, but I don't believe Xcode's SPM integration passes that setting through.

1

NeoNachoBoris Buegling

Jan '22

That is correct, packages behave like projects do by default here and there's no control over the build setting. Build settings of client projects generally don't apply to packages in any way.

2 Replies

1

shahzadmajeed

Jan '22

Could swift package itself specify build settings in Package.swift?

2 months later

TorustThomas Roughton

1

Mar '22

NeoNacho:

Build settings of client projects generally don't apply to packages in any way.

For what it's worth, I've filed FB9915302 about this. It's a major workflow issue for apps which need to be built with optimisations to run well enough to be tested -- the compile times are very lengthy regardless and building for architectures you're not going to use only makes it worse.

I'll also add that per-target optimisation settings would be very useful -- it's often the case that I'm working on a particular package and want that to be built in debug mode, but still need other packages it depends on to be in release mode so the app is usable.

1

1 month later

shahzadmajeed

Apr '22

@Torust just curious if you heard back from Apple on this?

TorustThomas Roughton

Apr '22

Nothing at this stage.

相关推荐
JJJennie77713 分钟前
Gemini 3.7 Flash 上线,Google 想让 AI 多干活
开发语言·javascript·ecmascript
wuyk5551 小时前
Python 第三章:列表 List
服务器·开发语言·python
Evand J1 小时前
【MATLAB例程,车联网7】CACC网联车辆协同控制:ACC对比、V2X时延丢包与队列稳定性,附例程下载链接
开发语言·matlab·车联网
要努力点2 小时前
Python入门第六课
开发语言·python
萧瑟余晖3 小时前
Java深入解析篇三十三之消息队列
java·开发语言
IT爱学堂3 小时前
尚硅谷Java+AI大模型应用开发革新版本 2025年3月
java·开发语言·人工智能
C++ 老炮儿的技术栈3 小时前
Qt5.9.1 Windows 完整开发环境搭建流程
开发语言·c++·windows·qt·编辑器·代码化
xcLeigh3 小时前
Go入门:无类型常量与类型常量的区别
服务器·开发语言·golang
泡沫冰@3 小时前
GO 语言基础
开发语言·算法·golang