Last active
August 29, 2015 14:20
-
-
Save cfr/cc4dc625e69b034f60d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# put this script in rpath/build, so .xcodeproj is one level up | |
# path to .swift files is supposed to be the same as the project name | |
ROOT=.. | |
MODULE=$(find $ROOT -maxdepth 1 -name '*xcodeproj' -exec sh -c "echo \$(basename {} .xcodeproj)" \;) | |
SOURCES=$ROOT/$MODULE/*swift | |
OBJECTS=./*\.o | |
SDK=$(xcrun --show-sdk-path --sdk iphoneos) | |
xcrun swiftc -target arm64-apple-ios8.3 -emit-object $SOURCES -sdk $SDK -module-name $MODULE | |
ar rcs lib$MODULE.arm64.a $OBJECTS | |
xcrun swiftc -target armv7-apple-ios8.3 -emit-object $SOURCES -sdk $SDK -module-name $MODULE | |
ar rcs lib$MODULE.armv7.a $OBJECTS | |
xcrun swiftc -target armv7s-apple-ios8.3 -emit-object $SOURCES -sdk $SDK -module-name $MODULE | |
ar rcs lib$MODULE.armv7s.a $OBJECTS | |
xcrun swiftc -target i386-apple-ios8.3 -emit-object $SOURCES -sdk $(xcrun --show-sdk-path --sdk iphonesimulator) -module-name $MODULE | |
ar rcs lib$MODULE.i386.a $OBJECTS | |
xcrun swiftc -target x86_64-apple-ios8.3 -emit-object $SOURCES -sdk $(xcrun --show-sdk-path --sdk iphonesimulator) -module-name $MODULE | |
ar rcs lib$MODULE.x86_64.a $OBJECTS | |
lipo -create lib$MODULE.x86_64.a lib$MODULE.i386.a lib$MODULE.arm64.a lib$MODULE.armv7.a lib$MODULE.armv7s.a -o lib$MODULE.a | |
xcrun swiftc -target arm64-apple-ios8.3 -emit-module $SOURCES -sdk $SDK -module-name $MODULE | |
mv $MODULE.swiftmodule $MODULE.arm64.swiftmodule | |
xcrun swiftc -target armv7-apple-ios8.3 -emit-module $SOURCES -sdk $SDK -module-name $MODULE | |
mv $MODULE.swiftmodule $MODULE.armv7.swiftmodule | |
xcrun swiftc -target armv7s-apple-ios8.3 -emit-module $SOURCES -sdk $SDK -module-name $MODULE | |
mv $MODULE.swiftmodule $MODULE.armv7s.swiftmodule | |
xcrun swiftc -target i386-apple-ios8.3 -emit-module $SOURCES -sdk $(xcrun --show-sdk-path --sdk iphonesimulator) -module-name $MODULE | |
mv $MODULE.swiftmodule $MODULE.i386.swiftmodule | |
xcrun swiftc -target x86_64-apple-ios8.3 -emit-module $SOURCES -sdk $(xcrun --show-sdk-path --sdk iphonesimulator) -module-name $MODULE | |
mv $MODULE.swiftmodule $MODULE.x86_64.swiftmodule | |
rm -f *\.o *\.*\.a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment