Skip to content

Commit c4c48c0

Browse files
authored
[android] Update to LTS NDK 25b (#60938)
Also, remove `SWIFT_ANDROID_NDK_CLANG_VERSION` and just extract the resource directory from the NDK using `file(GLOB)`.
1 parent 762e0ba commit c4c48c0

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,6 @@ set(SWIFT_ANDROID_API_LEVEL "" CACHE STRING
404404

405405
set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
406406
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
407-
set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.9" CACHE STRING
408-
"The Clang version to use when building for Android.")
409407
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
410408
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
411409

cmake/caches/Runtime-Android-aarch64.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ set(SWIFT_SDK_ANDROID_ARCHITECTURES aarch64 CACHE STRING "")
2323

2424
# NOTE(compnerd) this is lollipop, which seems to still have decent usage.
2525
set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "")
26-
# NOTE(compnerd) this matches the value from the NDK r24.
27-
set(SWIFT_ANDROID_NDK_CLANG_VERSION 14.0.1 CACHE STRING "" FORCE)

cmake/caches/Runtime-Android-armv7.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ set(SWIFT_SDK_ANDROID_ARCHITECTURES armv7 CACHE STRING "")
2323

2424
# NOTE(compnerd) this is lollipop, which seems to still have decent usage.
2525
set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "")
26-
# NOTE(compnerd) this matches the value from the NDK r24.
27-
set(SWIFT_ANDROID_NDK_CLANG_VERSION 14.0.1 CACHE STRING "" FORCE)
28-

docs/Android.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ To follow along with this guide, you'll need:
3636
instructions in the Swift project README.
3737
2. The latest build of the Swift compiler for your Linux distro, available at
3838
https://www.swift.org/download/ or sometimes your distro package manager.
39-
3. The latest version of the Android LTS NDK (r23c at the time of this writing),
39+
3. The latest version of the Android LTS NDK (r25b at the time of this writing),
4040
available to download here:
4141
https://developer.android.com/ndk/downloads
4242
4. An Android device with remote debugging enabled or the emulator. We require
@@ -54,7 +54,7 @@ and the prebuilt Swift toolchain (add --skip-early-swift-driver if you already
5454
have a Swift toolchain in your path):
5555

5656
```
57-
$ NDK_PATH=path/to/android-ndk-r23c
57+
$ NDK_PATH=path/to/android-ndk-r25b
5858
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2022-05-31-a-ubuntu20.04/usr/bin
5959
$ git checkout swift-DEVELOPMENT-SNAPSHOT-2022-05-31-a
6060
$ utils/build-script \
@@ -83,7 +83,7 @@ Then use the standalone Swift stdlib from the previous step to compile a Swift
8383
source file, targeting Android:
8484

8585
```
86-
$ NDK_PATH="path/to/android-ndk-r23c"
86+
$ NDK_PATH="path/to/android-ndk-r25b"
8787
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2022-05-31-a-ubuntu20.04/usr/bin
8888
$ $SWIFT_PATH/swiftc \ # The prebuilt Swift compiler you downloaded
8989
# The location of the tools used to build Android binaries
@@ -133,7 +133,7 @@ $ adb push build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift/android/libBlo
133133
In addition, you'll also need to copy the Android NDK's libc++:
134134

135135
```
136-
$ adb push /path/to/android-ndk-r23c/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp
136+
$ adb push /path/to/android-ndk-r25b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp
137137
```
138138

139139
Finally, you'll need to copy the `hello` executable you built in the
@@ -176,7 +176,7 @@ $ utils/build-script \
176176
-R \ # Build in ReleaseAssert mode.
177177
-T \ # Run all tests, including on the Android device (add --host-test to only run Android tests on the Linux host).
178178
--android \ # Build for Android.
179-
--android-ndk ~/android-ndk-r23c \ # Path to an Android NDK.
179+
--android-ndk ~/android-ndk-r25b \ # Path to an Android NDK.
180180
--android-arch aarch64 \ # Optionally specify Android architecture, alternately armv7
181181
--android-api-level 21
182182
```

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ function(_add_target_variant_link_flags)
464464
# We need to add the math library, which is linked implicitly by libc++
465465
list(APPEND result "-lm")
466466
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
467-
list(APPEND result "-resource-dir=${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/${SWIFT_ANDROID_NDK_CLANG_VERSION}")
467+
file(GLOB RESOURCE_DIR ${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/*)
468+
list(APPEND result "-resource-dir=${RESOURCE_DIR}")
468469
endif()
469470

470471
# link against the custom C++ library

0 commit comments

Comments
 (0)