Running a script in Xcode while compiling is a great way to have multiple targets with different resource and alike. After adding your script you might run into a permission denied error.
You need to add permission to the file. Open up a terminal and navigate to the location of the .sh file. Now use chmod
chmod 755 targetSetup.sh
Now the permission is set so it can be executed in Xcode.
For setting up a run script in Xcode take a look here http://runscriptbuildphase.com/