Merge pull request #42593 from bruvzg/ios_sdk_ver_check

[3.2] Add iOS SDK version check.
This commit is contained in:
Rémi Verschelde 2020-10-20 15:12:59 +02:00 committed by GitHub
commit 3b4005026d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -702,6 +702,24 @@ def CommandNoCache(env, target, sources, command, **args):
return result
def get_darwin_sdk_version(platform):
sdk_name = ""
if platform == "osx":
sdk_name = "macosx"
elif platform == "iphone":
sdk_name = "iphoneos"
elif platform == "iphonesimulator":
sdk_name = "iphonesimulator"
else:
raise Exception("Invalid platform argument passed to get_darwin_sdk_version")
try:
return float(decode_utf8(subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-version"]).strip()))
except (subprocess.CalledProcessError, OSError):
print("Failed to find SDK version while running xcrun --sdk {} --show-sdk-version.".format(sdk_name))
raise
def detect_darwin_sdk_path(platform, env):
sdk_name = ""
if platform == "osx":

View file

@ -1,6 +1,6 @@
import os
import sys
from methods import detect_darwin_sdk_path
from methods import detect_darwin_sdk_path, get_darwin_sdk_version
def is_active():
@ -14,6 +14,9 @@ def get_name():
def can_build():
if sys.platform == "darwin" or ("OSXCROSS_IOS" in os.environ):
if get_darwin_sdk_version("iphone") < 13.0:
print("Detected iOS SDK version older than 13")
return False
return True
return False