From a8c2e2986838dccbcc4bd218b501f0bf86b36e2c Mon Sep 17 00:00:00 2001 From: der richter Date: Sat, 20 Jul 2019 12:16:37 +0200 Subject: 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 --- waftools/detections/compiler_swift.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'waftools/detections') 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) -- cgit v1.2.3