diff --git a/iosbuild.sh b/iosbuild.sh index 044745f0..7c5e691b 100755 --- a/iosbuild.sh +++ b/iosbuild.sh @@ -13,6 +13,9 @@ set -e +# Set this variable based on the desired minimum deployment target. +readonly IOS_MIN_VERSION=6.0 + # Extract the latest SDK version from the final field of the form: iphoneosX.Y readonly SDK=$(xcodebuild -showsdks \ | grep iphoneos | sort | tail -n 1 | awk '{print substr($NF, 9)}' @@ -118,7 +121,7 @@ for PLATFORM in ${PLATFORMS}; do SDKROOT="${PLATFORMSROOT}/" SDKROOT+="${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDK}.sdk/" CFLAGS="-arch ${ARCH2:-${ARCH}} -pipe -isysroot ${SDKROOT} -O3 -DNDEBUG" - CFLAGS+=" -miphoneos-version-min=6.0 ${EXTRA_CFLAGS}" + CFLAGS+=" -miphoneos-version-min=${IOS_MIN_VERSION} ${EXTRA_CFLAGS}" set -x export PATH="${DEVROOT}/usr/bin:${OLDPATH}" diff --git a/xcframeworkbuild.sh b/xcframeworkbuild.sh index 70770e7e..3bc16b0e 100755 --- a/xcframeworkbuild.sh +++ b/xcframeworkbuild.sh @@ -12,6 +12,11 @@ set -e +# Set these variables based on the desired minimum deployment target. +readonly IOS_MIN_VERSION=6.0 +readonly MACOSX_MIN_VERSION=10.15 +readonly MACOSX_CATALYST_MIN_VERSION=13.0 + # Extract Xcode version. readonly XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) if [[ -z "${XCODE}" ]] || [[ "${XCODE%%.*}" -lt 11 ]]; then @@ -135,10 +140,14 @@ for (( i = 0; i < $NUM_PLATFORMS; ++i )); do CFLAGS="-pipe -isysroot ${SDKROOT} -O3 -DNDEBUG" case "${PLATFORM}" in iPhone*) - CFLAGS+=" -miphoneos-version-min=6.0 -fembed-bitcode" + CFLAGS+=" -miphoneos-version-min=${IOS_MIN_VERSION} -fembed-bitcode" ;; MacOSX-Catalyst*) - CFLAGS+=" -target ${ARCH}-apple-ios13.0-macabi" + CFLAGS+=" -target" + CFLAGS+=" ${ARCH}-apple-ios${MACOSX_CATALYST_MIN_VERSION}-macabi" + ;; + MacOSX*) + CFLAGS+=" -mmacosx-version-min=${MACOSX_MIN_VERSION}" ;; esac