简体   繁体   English

xcodebuild:模拟器还是设备?

[英]xcodebuild: simulator or device?

如何指定xcodebuild (命令行工具)是要为模拟器还是设备构建?

An Xcode build from the command line looks like:从命令行构建的 Xcode 如下所示:

xcodebuild -configuration ${BUILD_TYPE} -target ${TARGET_NAME} -arch ${CPU_ARCHITECTURE} -sdk ${SIMULATOR_OR_IOS_SDK} 

BUILD_TYPE is something like "Release" or "Debug" (those are the defaults, you may have added others to the project) BUILD_TYPE类似于“Release”或“Debug”(这些是默认值,您可能已将其他人添加到项目中)

TARGET_NAME is the name of the target you are building (by default the same name as your project) TARGET_NAME是您正在构建的目标的名称(默认情况下与您的项目名称相同)

CPU_ARCHITECTURE is the CPU you are building for, one of: CPU_ARCHITECTURE是您正在构建的 CPU,其中之一:

i386 , armv6 , armv7 i386armv6armv7

Use i386 for simulator builds, and use either armv6 or armv7 for device builds - note that some other devices cannot run armv7 code, so usually when building libraries it's a good idea to build all of these architectures and then glue them together using lipo .将 i386 用于模拟器构建,并使用 armv6 或 armv7 进行设备构建 - 请注意,某些其他设备无法运行 armv7 代码,因此通常在构建库时,最好构建所有这些架构,然后使用lipo将它们粘合在一起。

SIMULATOR_OR_IOS_SDK is what you are looking for, it's either iphoneos or iphonesimulator . SIMULATOR_OR_IOS_SDK就是您要找的,它是iphoneosiphonesimulator Those values use the latest version of the SDK that the installed Xcode supports, you can get a list of supported SDK's with:这些值使用已安装的 Xcode 支持的最新版本的 SDK,您可以使用以下命令获取受支持的 SDK 列表:

xcodebuild -showsdks

Which returns a list like:它返回一个列表,如:

Mac OS X SDKs:
    Current Mac OS                  -sdk 
    Mac OS X 10.6                   -sdk macosx10.6

iOS SDKs:
    iOS 4.2                         -sdk iphoneos4.2

iOS Simulator SDKs:
    Simulator - iOS 3.2             -sdk iphonesimulator3.2
    Simulator - iOS 4.0             -sdk iphonesimulator4.0
    Simulator - iOS 4.1             -sdk iphonesimulator4.1
    Simulator - iOS 4.2             -sdk iphonesimulator4.2

xcodebuild has more flags than that, but those are the ones you'd commonly use after using Xcode to set up the build properties. xcodebuild有更多的标志,但这些是您在使用 Xcode 设置构建属性后通常使用的标志。 You don't have to use all of them, but it's probably a good idea to be clear about what you are building - otherwise I believe your last settings are used.您不必全部使用它们,但清楚您正在构建的内容可能是一个好主意 - 否则我相信您的最后设置已被使用。

i find the -xcconfig flag quite useful.我发现-xcconfig标志非常有用。 this option allows you to specify a path to an xcconfig (build settings file).此选项允许您指定 xcconfig(构建设置文件)的路径。 within an xcconfig, you may #include other xcconfig files.在 xcconfig 中,您可以#include其他 xcconfig 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM