mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 21:27:08 +00:00
build: more reliable way of getting the Swift version from a string
Fixes #6212
This commit is contained in:
parent
facc63b862
commit
6fbd933108
@ -1,3 +1,4 @@
|
||||
import re
|
||||
from waflib import Utils
|
||||
|
||||
def __run(cmd):
|
||||
@ -11,7 +12,9 @@ def __add_swift_flags(ctx):
|
||||
ctx.env.SWIFT_FLAGS = ('-frontend -c -sdk %s -enable-objc-interop'
|
||||
' -emit-objc-header -parse-as-library'
|
||||
' -target x86_64-apple-macosx10.10') % (ctx.env.MACOS_SDK)
|
||||
ctx.env.SWIFT_VERSION = __run([ctx.env.SWIFT, '-version']).split(' ')[3]
|
||||
|
||||
ver = re.compile("(?i)version\s?([\d.]+)")
|
||||
ctx.env.SWIFT_VERSION = ver.search(__run([ctx.env.SWIFT, '-version'])).group(1)
|
||||
major, minor = [int(n) for n in ctx.env.SWIFT_VERSION.split('.')[:2]]
|
||||
|
||||
# the -swift-version parameter is only supported on swift 3.1 and newer
|
||||
|
Loading…
Reference in New Issue
Block a user