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.

相关推荐
天“码”行空26 分钟前
java面向对象的三大特性之一多态
java·开发语言·jvm
odoo中国2 小时前
Odoo 19 模块结构概述
开发语言·python·module·odoo·核心组件·py文件按
代码N年归来仍是新手村成员2 小时前
【Java转Go】即时通信系统代码分析(一)基础Server 构建
java·开发语言·golang
Z1Jxxx3 小时前
01序列01序列
开发语言·c++·算法
沐知全栈开发3 小时前
C语言中的强制类型转换
开发语言
关于不上作者榜就原神启动那件事3 小时前
Java中大量数据Excel导入导出的实现方案
java·开发语言·excel
坚定学代码3 小时前
基于观察者模式的ISO C++信号槽实现
开发语言·c++·观察者模式·ai
Wang's Blog3 小时前
Nodejs-HardCore: Buffer操作、Base64编码与zlib压缩实战
开发语言·nodejs
csbysj20204 小时前
C# 集合(Collection)
开发语言
csbysj20204 小时前
Lua 面向对象编程
开发语言