Skip to content

Instantly share code, notes, and snippets.

@dlevi309
Last active October 23, 2021 07:53
Show Gist options
  • Select an option

  • Save dlevi309/2cdc3a957a7af4306c7286f217647f89 to your computer and use it in GitHub Desktop.

Select an option

Save dlevi309/2cdc3a957a7af4306c7286f217647f89 to your computer and use it in GitHub Desktop.
Drop this script into the head directory of swift package with a CLI tool to build as an iOS target. Set NAME=ProductName
#!/bin/bash
set -e
NAME=sURL
function build() {
START=$(date +%s)
swift build --product $NAME \
-c release \
-Xswiftc "-sdk" \
-Xswiftc "$(xcrun --sdk iphoneos --show-sdk-path)" \
-Xswiftc "-target" \
-Xswiftc "arm64-apple-ios11.0" \
-Xcc "-arch" \
-Xcc "arm64" \
-Xcc "--target=arm64-apple-ios11.0" \
-Xcc "-isysroot" \
-Xcc "$(xcrun --sdk iphoneos --show-sdk-path)" \
-Xcc "-mios-version-min=10.0" \
-Xcc "-miphoneos-version-min=11.0"
mkdir built
cp .build/release/$NAME built/$NAME
END=$(date +%s)
TIME=$(($END - $START))
echo "build in $TIME seconds"
}
function main() {
build
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment