Building xcode project from command line : A tutorial
Recently, I had to integrate a xcode project into a build script such that the code compiles from command line and then installs into the required location. xcode doesn’t use Makefile to build the project. It has its own build system. However, it does have a way to build the project very easily from the command line.
Use the command xcodebuild to build a xcode project from command line. From the command line go to the directory where xcode project file resides and then execute this command. Various build options can be specified with this command. For example if you are building a framework and want to install it then the following command will work
% sudo xcodebuild install configuration release DSTROOT=/root/installation/path INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES
The option INSTALL_PATH is the path from DSTROOT(Distribution Root). In our example above, after building the framework will be installed at /root/installation/path/Library/Frameworks
Also, if there are multiple targets then xcodebuild command will build the first target if no target is specified. For a complete list of options that can be used with xcodebuild use man xcodebuild