summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-07-08 16:49:33 +0200
committerJan Ekström <jeebjp@gmail.com>2018-09-30 16:54:03 +0300
commit50787acb275dc0465a0cf7234ee8f9bd07f0d4d1 (patch)
tree79261f8891b240a8304c69079b2726a11673ec4e
parentb7339a7c7e7f700b00180408b5c3e289ed2ac71e (diff)
downloadmpv-50787acb275dc0465a0cf7234ee8f9bd07f0d4d1.tar.bz2
mpv-50787acb275dc0465a0cf7234ee8f9bd07f0d4d1.tar.xz
build: check for Swift version and disable dependencies if needed
-rw-r--r--waftools/checks/custom.py9
-rw-r--r--waftools/detections/compiler_swift.py4
-rw-r--r--wscript2
3 files changed, 11 insertions, 4 deletions
diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
index 06a7c70769..1cb133f27c 100644
--- a/waftools/checks/custom.py
+++ b/waftools/checks/custom.py
@@ -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
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py
index 9b0e06ed8a..cf55149291 100644
--- a/waftools/detections/compiler_swift.py
+++ b/waftools/detections/compiler_swift.py
@@ -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:
diff --git a/wscript b/wscript
index 1c4e622120..1089695ff9 100644
--- a/wscript
+++ b/wscript
@@ -915,7 +915,7 @@ standalone_features = [
'name': '--macos-cocoa-cb',
'desc': 'macOS opengl-cb backend',
'deps': 'cocoa',
- 'func': check_true
+ 'func': check_swift
}
]