XcodeBuild¶
The XcodeBuild build helper is a wrapper around the command line invocation of Xcode. It
will abstract the calls like xcodebuild -project app.xcodeproj -configuration <config>
-arch <arch> ...
The XcodeBuild helper can be used like:
from conan import conanfile
from conan.tools.apple import XcodeBuild
class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
def build(self):
xcodebuild = XcodeBuild(self)
xcodebuild.build("app.xcodeproj")
Reference¶
- XcodeBuild.build(xcodeproj, target=None)¶
Call to
xcodebuildto build a Xcode project.- Parameters:
xcodeproj – the xcodeproj file to build.
target – the target to build, in case this argument is passed to the
build()method it will add the-targetargument to the build system call. If not passed, it will build all the targets passing the-alltargetsargument instead.
- Returns:
the return code for the launched
xcodebuildcommand.
The Xcode.build() method internally implements a call to xcodebuild like:
$ xcodebuild -project app.xcodeproj -configuration <configuration> -arch <architecture> <sdk> <verbosity> -target <target>/-alltargets
Where:
configurationis the configuration, typically Release or Debug, which will be obtained fromsettings.build_type.architectureis the build architecture, a mapping from thesettings.archto the common architectures defined by Apple ‘i386’, ‘x86_64’, ‘armv7’, ‘arm64’, etc.sdkis set based on the values of theos.sdkandos.sdk_versiondefining theSDKROOTXcode build setting according to them. For example, settingos.sdk=iOSand os.sdk_version=8.3` will passSDKROOT=iOS8.3to the build system. In case you defined thetools.apple:sdk_pathin your [conf] this value will take preference and will directly passSDKROOT=<tools.apple:sdk_path>so take into account that for this case the skd located in that path should set youros.sdkandos.sdk_versionsettings values.verbosityis the verbosity level for the build and can take value ‘verbose’ or ‘quiet’ if set bytools.build:verbosityin your [conf]
conf¶
tools.build:verbosity(ortools.compilation:verbosityas fallback) which acceptsquietorverbose, and sets the-verboseor-quietflags inXcodeBuild.install()tools.apple:sdk_pathpath for the sdk location, will set theSDKROOTvalue with preference over composing the value from theos.sdkandos.sdk_versionsettings.