“架构"和“架构"有什么区别?和“有效架构"在 Xcode 构建设置中? [英] What's the difference between "Architectures" and "Valid Architectures" in Xcode Build Settings?

查看:38
本文介绍了“架构"和“架构"有什么区别?和“有效架构"在 Xcode 构建设置中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们的含义是什么,我可以将它们设置为不同的值吗?

What's the meaning of them and can I set them in different values?

推荐答案

架构是您想要构建的架构,有效架构是您可以使用代码库构建的架构.

Architectures are the ones you want to build, valid architectures are the ones you could conceive of building with your codebase.

因此,也许您只想为 armv7s 构建二进制文件,但相同的源代码可以为 armv7 和 armv6 编译良好.所以VALID_ARCHS = armv6 armv7 armv7s,但你设置ARCHS = armv7s 因为这就是你想要用你的代码构建的全部内容.

So maybe you only want to build your binary for armv7s, but the same source code would compile fine for armv7 and armv6. So VALID_ARCHS = armv6 armv7 armv7s, but you set ARCHS = armv7s because that's all you actually want to build with your code.

或者,在 Apple 语言中:

Or, in Apple-ese:

ARCHS(架构)

以空格分隔的标识符列表.指定二进制文件所针对的体系结构(ABI、处理器模型).当此构建设置指定多个架构时,生成的二进制文件可能包含每个指定架构的目标代码.

Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies more than one architecture, the generated binary may contain object code for each of the specified architectures.

和:

VALID_ARCHS(有效架构)

VALID_ARCHS (Valid Architectures)

以空格分隔的标识符列表.指定可以为其构建二进制文件的体系结构.在构建过程中,此列表与 ARCHS 构建设置的值相交;结果列表指定了二进制文件可以运行的架构.如果生成的架构列表为空,则目标不会生成二进制文件.

Space-separated list of identifiers. Specifies the architectures for which the binary may be built. During the build, this list is intersected with the value of ARCHS build setting; the resulting list specifies the architectures the binary can run on. If the resulting architecture list is empty, the target generates no binary.

来源:Xcode 构建设置参考

在实践中,您将 VALID_ARCHS 放在一边,不必担心更改它,只需摆弄 ARCHS 来设置您想要构建的架构.通常,您只将调试版本设置为 NATIVE_ARCH,因为您只想为将要测试/运行它的机器构建调试版本,并为您的所有体系结构发布版本计划支持.

In practice, you leave VALID_ARCHS alone and don't worry about changing it, and just fiddle with ARCHS to set the architectures you want to build. Typically, you set a Debug build to just NATIVE_ARCH, since you only want to build the debug version for the machine you'll be testing/running it on, and Release builds for the full spectrum of architectures you plan to support.

这篇关于“架构"和“架构"有什么区别?和“有效架构"在 Xcode 构建设置中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆