mirror of
https://github.com/apple/swift.git
synced 2025-12-25 12:15:36 +01:00
This adds an Android target for the stdlib. It is also the first example of cross-compiling outside of Darwin. Mailing list discussions: 1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html 2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html The Android variant of Swift may be built using the following `build-script` invocation: ``` $ utils/build-script \ -R \ # Build in ReleaseAssert mode. --android \ # Build for Android. --android-ndk ~/android-ndk-r10e \ # Path to an Android NDK. --android-ndk-version 21 \ --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \ --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \ --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \ --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/ ``` Android builds have the following dependencies, as can be seen in the build script invocation: 1. An Android NDK of version 21 or greater, available to download here: http://developer.android.com/ndk/downloads/index.html. 2. A libicu compatible with android-armv7.
15 lines
436 B
Swift
15 lines
436 B
Swift
// RUN: %swift -parse %s -verify -D FOO -D BAR -target armv7-none-linux-androideabi -disable-objc-interop -D FOO -parse-stdlib
|
|
// RUN: %swift-ide-test -test-input-complete -source-filename=%s -target armv7-none-linux-androideabi
|
|
|
|
#if os(Linux)
|
|
// This block should not parse.
|
|
// os(Android) does not imply os(Linux).
|
|
let i: Int = "Hello"
|
|
#endif
|
|
|
|
#if arch(arm) && os(Android) && _runtime(_Native)
|
|
class C {}
|
|
var x = C()
|
|
#endif
|
|
var y = x
|