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.

相关推荐
长安第一美人5 小时前
C 语言可变参数(...)实战:从 logger_print 到通用日志函数
c语言·开发语言·嵌入式硬件·日志·工业应用开发
Larry_Yanan5 小时前
Qt多进程(一)进程间通信概括
开发语言·c++·qt·学习
superman超哥6 小时前
仓颉语言中基本数据类型的深度剖析与工程实践
c语言·开发语言·python·算法·仓颉
不爱吃糖的程序媛6 小时前
Ascend C开发工具包(asc-devkit)技术解读
c语言·开发语言
bu_shuo6 小时前
MATLAB奔溃记录
开发语言·matlab
你的冰西瓜6 小时前
C++标准模板库(STL)全面解析
开发语言·c++·stl
徐先生 @_@|||7 小时前
(Wheel 格式) Python 的标准分发格式的生成规则规范
开发语言·python
利剑 -~7 小时前
jdk源码解析
java·开发语言
Predestination王瀞潞7 小时前
JDK安装及环境变量配置
java·linux·开发语言
lsx2024067 小时前
Python break 语句详解
开发语言