diff options
author | der richter <der.richter@gmx.de> | 2019-07-20 12:16:37 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2019-07-21 18:13:07 +0300 |
commit | a8c2e2986838dccbcc4bd218b501f0bf86b36e2c (patch) | |
tree | 0f9ce3f16cc72c47dd70e9961e6c9b9f1cdabd43 /waftools | |
parent | 0602f082cb9775b4c9c8e256b1cb9de218a3b5fc (diff) | |
download | mpv-a8c2e2986838dccbcc4bd218b501f0bf86b36e2c.tar.bz2 mpv-a8c2e2986838dccbcc4bd218b501f0bf86b36e2c.tar.xz |
cocoa-cb: migrate to swift 5 with swift 4 fallback
this migrates our current swift code to version 5 and 4. building is
support from 10.12.6 and xcode 9.1 onwards.
dynamic linking is the new default, since Apple removed static libs
from their new toolchains and it's the recommended way.
additionally the found macOS SDK version is printed since it's an
important information for finding possible errors now.
Fixes #6470
Diffstat (limited to 'waftools')
-rw-r--r-- | waftools/detections/compiler_swift.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py index 956fff8870..1759052d53 100644 --- a/waftools/detections/compiler_swift.py +++ b/waftools/detections/compiler_swift.py @@ -21,9 +21,9 @@ def __add_swift_flags(ctx): verRe = re.compile("(?i)version\s?([\d.]+)") ctx.env.SWIFT_VERSION = verRe.search(__run([ctx.env.SWIFT, '-version'])).group(1) - # the -swift-version parameter is only supported on swift 3.1 and newer - if StrictVersion(ctx.env.SWIFT_VERSION) >= StrictVersion("3.1"): - ctx.env.SWIFT_FLAGS.extend([ "-swift-version", "3" ]) + # prevent possible breakages with future swift versions + if StrictVersion(ctx.env.SWIFT_VERSION) >= StrictVersion("6.0"): + ctx.env.SWIFT_FLAGS.extend([ "-swift-version", "5" ]) if ctx.is_debug_build(): ctx.env.SWIFT_FLAGS.append("-g") @@ -109,7 +109,7 @@ def __find_swift_library(ctx): ctx.end_msg(False) enableStatic = getattr(ctx.options, 'enable_swift-static') - if (enableStatic or enableStatic == None) and 'SWIFT_LIB_STATIC' in swift_libraries: + if (enableStatic) and 'SWIFT_LIB_STATIC' in swift_libraries: __add_static_swift_library_linking_flags(ctx, swift_libraries['SWIFT_LIB_STATIC']) else: __add_dynamic_swift_library_linking_flags(ctx, swift_libraries['SWIFT_LIB_DYNAMIC']) @@ -136,7 +136,6 @@ def __find_macos_sdk(ctx): sdk_version = __run(['xcrun', '--sdk', 'macosx', '--show-sdk-version' ]) if sdk: - ctx.end_msg(sdk) ctx.env.MACOS_SDK = sdk build_version = '10.10.0' @@ -161,6 +160,8 @@ def __find_macos_sdk(ctx): ctx.env.MACOS_SDK_VERSION = build_version else: ctx.env.MACOS_SDK_VERSION = sdk_version + + ctx.end_msg(sdk + ' (version found: ' + ctx.env.MACOS_SDK_VERSION + ')') else: ctx.end_msg(False) |