From bae28efb21b6aab6ef1cc0c53121f38fb60b29c8 Mon Sep 17 00:00:00 2001 From: Steve Loveless Date: Thu, 8 Aug 2019 10:45:52 -0700 Subject: [PATCH] Detect and use `IPHONEOS_DEPLOYMENT_TARGET` for the `-mi*os-version-min` flag If it isn't set, fallback to the previous setting of `-miphoneos-version-min=7.0` for real devices and `mios-simulator-version-min=7.0` for simulators. --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3b9343e..880437da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1627,16 +1627,19 @@ impl Build { } }; + let min_version = std::env::var("IPHONEOS_DEPLOYMENT_TARGET") + .unwrap_or_else(|_| "7.0".into()); + let sdk = match arch { ArchSpec::Device(arch) => { cmd.args.push("-arch".into()); cmd.args.push(arch.into()); - cmd.args.push("-miphoneos-version-min=7.0".into()); + cmd.args.push(format!("-miphoneos-version-min={}", min_version).into()); "iphoneos" } ArchSpec::Simulator(arch) => { cmd.args.push(arch.into()); - cmd.args.push("-mios-simulator-version-min=7.0".into()); + cmd.args.push(format!("-mios-simulator-version-min={}", min_version).into()); "iphonesimulator" } };