Architectures&Valid Architecture

2019-02-14  本文已影响0人  unspecx

指令集相关的两个配置项


Valid Architectures (VALID_ARCHS)

A space-separated list of architectures for which the target should actually be built. For each target, this is intersected with the list specified in Architectures (ARCHS), and the resulting set is built. This allows individual targets to opt out of building for particular architectures. If the resulting set of architectures is empty, no executable will be produced.

Architectures (ARCHS)

A list of the architectures for which the product will be built. This is usually set to a predefined build setting provided by the platform. If more than one architecture is specified, a universal binary will be produced.

以上是摘自Xcode Help里关于Architectures和Valid Architectures这两个构建设置项的英文描述,可参照https://help.apple.com/xcode/mac/10.2/#/itcaec37c2a6?sub=devf0a9d5aca

设计目的

这两项设置最终决定了构建产物所支持的指令集,即它们所包含的指令集的交集。

与xcodebuild相关

默认情况下xcodebuild会读取BuildSetting里的配置项,但是我们也可以用构建命令的option -arch来指定需要的指令集,而且会覆盖项目中设置的。-arch的说明可以是xcodebuild --help查看。

-arch ARCH                                               
build each target for the architecture ARCH; this will override architectures defined in the project

多个指令集构建时,追加多个-arch即可,如下:

xcodebuild -target ${target_Name} -configuration Release -sdk iphoneos -arch armv7s -arch arm64
上一篇 下一篇

猜你喜欢

热点阅读