OS X Man Pages
|
|
This manual page is for Mac OS X version 10.7Choose a version: Reading manual pagesManual pages are intended as a quick referencefor people who already understand a technology.
|
XCODEBUILD(1) BSD General Commands Manual XCODEBUILD(1)
NAME
xcodebuild -- build Xcode projects and workspaces
SYNOPSIS
xcodebuild [-project projectname] [-target targetname ...] [-configuration configurationname]
[-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...]
[-userdefault=value ...]
xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname]
[-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...]
[-userdefault=value ...]
xcodebuild -version [-sdk [sdkfullpath | sdkname]] [infoitem]
xcodebuild -showsdks
xcodebuild -list [-project projectname | -workspace workspacename]
DESCRIPTION
xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an
Xcode workspace.
Usage
To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the
directory containing the projectname.xcodeproj package). If you have multiple projects in the this
directory you will need to use -project to indicate which project should be built. By default,
xcodebuild builds the first target listed in the project, with the default build configuration. The
order of the targets is a property of the project and is the same for all users of the project.
To build an Xcode workspace, you must pass both the -workspace and -scheme options to define the build.
The parameters of the scheme will control which targets are built and how they are built, although you
may pass other options to xcodebuild to override some parameters of the scheme.
There are also several parameters to display info about the installed version of Xcode or about
projects or workspaces in the local directory, but which do not initiate a build. These include
-version, -showsdks, and -usage.
Options
-project projectname
Build the project specified by projectname. Required if there are multiple project files in the
same directory.
-target targetname
Build the target specified by targetname.
-alltargets
Build all the targets in the specified project.
-workspace workspacename
Build the workspace specified by workspacename.
-scheme schemename
Build the scheme specified by schemename. Required if building a workspace.
-configuration configurationname
Use the build configuration specified by configurationname when building each target.
-arch architecture
Use the architecture specified by architecture when building each target.
-sdk [<sdkfullpath> | <sdkname>]
Build an Xcode project or workspace against the specified SDK, using build tools appropriate for
that SDK. The argument may be an absolute path to an SDK, or the canonical name of an SDK.
-showsdks
Lists all available SDKs that Xcode knows about, including their canonical names suitable for use
with -sdk. Does not initiate a build.
-list
Lists the targets and configurations in a project, or the schemes in a workspace. Does not initi-ate initiate
ate a build.
buildaction ...
Specify a build action (or actions) to perform on the target. Available build actions are:
build Build the target in the build root (SYMROOT). This is the default build action.
archive Archive a scheme from the build root (SYMROOT). This requires specifying a workspace
and scheme.
installsrc Copy the source of the project to the source root (SRCROOT).
install Build the target and install it into the target's installation directory in the dis-tribution distribution
tribution root (DSTROOT).
clean Remove build products and intermediate files from the build root (SYMROOT).
-xcconfig filename
Load the build settings defined in filename when building all targets. These settings will over-ride override
ride all other settings, including settings passed individually on the command line.
setting=value
Set the build setting setting to value.
-userdefault=value
Set the user default default to value.
-version
Display version information for this install of Xcode. Does not initiate a build. When used in
conjunction with -sdk, the version of the specified SDK is displayed, or all SDKs if -sdk is
given no argument. Additionally, a single line of the reported version information may be
returned if infoitem is specified.
-usage
Displays usage information for xcodebuild.
Environment Variables
The following environment variables affect the execution of xcodebuild:
XCODE_XCCONFIG_FILE
Set to a path to a file, build settings in that file will be loaded and used when
building all targets. These settings will override all other settings, including set-tings settings
tings passed individually on the command line, and those in the file passed with the
-xcconfig option.
EXAMPLES
xcodebuild clean install
Cleans the build directory; then builds and installs the first target in the Xcode project in
the directory from which xcodebuild was started.
xcodebuild -target MyTarget OBJROOT=/Build/MyProj/Obj.root SYMROOT=/Build/MyProj/Sym.root
Builds the target MyTarget in the Xcode project in the directory from which xcodebuild was
started, putting intermediate files in the directory /Build/MyProj/Obj.root and the products
of the build in the directory /Build/MyProj/Sym.root.
xcodebuild -sdk macosx10.6
Builds the Xcode project in the directory from which xcodebuild was started against the Mac OS
X 10.6 SDK. The canonical names of all available SDKs can be viewed using the -showsdks
option.
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme
Builds the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace.
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme archive
Archives the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace.
Mac OS X June 9, 2010 Mac OS X
|
Reporting Problems
The way to report a problem with this manual page depends on the type of problem:
-
Content errors
- Report errors in the content of this documentation with the feedback links below. Bug reports
- Report bugs in the functionality of the described tool or API through Bug Reporter. Formatting problems
- Report formatting mistakes in the online version of these pages with the feedback links below.
Provide Feedback
本文深入解析了Xcode命令行工具xcodebuild的使用方法,包括其命令参数、工作流程以及如何构建Xcode项目和工作空间。通过实例演示了如何清理、安装、构建和归档目标,以及如何指定SDK、配置、架构等参数。

1074

被折叠的 条评论
为什么被折叠?



