Reputation: 1467
I work on a project from multiple machines and prefer to use Xcode as my IDE, even though I build with the SCons build tool.
I followed the guidance of this discussion to sync my project .pbxproj file using Git. This works ok. New source files show up in the project tree, etc. I have the build working fine on one machine or the other.
I am running into a problem in that the scons build tool is installed at a different absolute path on different machines. It is not in whatever path XCode is using either.
Can anyone tell me how to use an environment variable or other means in the XCode target settings for an external build tool target so that I can specify the correct build tool location and also build products directory? The goal is that the .pbxproj file works on both my machines without modification, but an environment variable would be set differently on each machine.
Thanks.
Upvotes: 1
Views: 2045
Reputation: 1467
Ok, so I came up with a working solution using a level of indirection. XCode first calls bash shell giving a script name to run that is located in the same directory as my Xcode project file. The script has the smarts to specify the build tool path using values of environment variables set in my environment.plist file. Environment variables set there, propagate to the bash shell process environment.
Specifics: In the target settings, Custom Build Command portion, I have
Build Tool: "bash"
Arguments: "build_script $PRODUCT_NAME"
Directory: empty
The file build_script is a bash script saved in the same directory as my XCode project file. It is basically just changes directory to where my source code repository is and then calls the scons build tool, getting the path to scons from an environment variable.
Upvotes: 1