Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Last active January 17, 2018 13:49
Show Gist options
  • Save samdmarshall/7516674 to your computer and use it in GitHub Desktop.
Save samdmarshall/7516674 to your computer and use it in GitHub Desktop.
Fat Static Library build script for iOS and OS X
This script is for generating a single static library out of iOS (device and sim) and OS X versions of the same code.
https://gist.github.com/samdmarshall/7516723
To use:
1. Create separate targets for each platform in xcode.
(The iOS device and simulator target can be the same one)
2. Add a new target of type "Mac" and "Aggregate". This can be found under "Other" in the target types list.
3. Add a new build phase to this target, "Add Run Script Phase to this Target"
4. Open Terminal.app, run this script, specifying the path to the output path of the build script
EX: ./BuildScriptGenerator.sh -o ~/Desktop
5. Open the file called "RunScriptBuildPhase.sh" in the output directory you specified
6. Copy the contents into the "Run Script" phase in the Aggregate target you just created in Xcode
7. Build the Aggregate Target
8. Add this as Dependency in your application's "Target Dependencies" build phase
9. Add the libraries found in "${BUILD_DIR}/Universal" as the libraries you want to link against in your application's "Link Binary with Libraries" phase
10. Build your application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment