mirror of https://github.com/mpv-player/mpv
build: check for Swift version and disable dependencies if needed
(cherry picked from commit 50787acb27
)
This commit is contained in:
parent
46969b449a
commit
89e52a228c
|
@ -4,7 +4,7 @@ from waflib import Utils
|
|||
import os
|
||||
|
||||
__all__ = ["check_pthreads", "check_iconv", "check_lua",
|
||||
"check_cocoa", "check_wl_protocols"]
|
||||
"check_cocoa", "check_wl_protocols", "check_swift"]
|
||||
|
||||
pthreads_program = load_fragment('pthreads.c')
|
||||
|
||||
|
@ -111,3 +111,10 @@ def check_cocoa(ctx, dependency_identifier):
|
|||
])
|
||||
|
||||
return res
|
||||
|
||||
def check_swift(ctx, dependency_identifier):
|
||||
if ctx.env.SWIFT_VERSION:
|
||||
major = int(ctx.env.SWIFT_VERSION.split('.')[0])
|
||||
if major >= 3:
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -11,8 +11,8 @@ 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)
|
||||
swift_version = __run([ctx.env.SWIFT, '-version']).split(' ')[3].split('.')[:2]
|
||||
major, minor = [int(n) for n in swift_version]
|
||||
ctx.env.SWIFT_VERSION = __run([ctx.env.SWIFT, '-version']).split(' ')[3]
|
||||
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
|
||||
if major >= 3 and minor >= 1 or major >= 4:
|
||||
|
|
Loading…
Reference in New Issue