mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[android] Update to NDK 23b (#39921)
The latest Long Term Support NDK finally removed binutils, including the bfd/gold linkers and libgcc. This simplifies our Android support, including making lld the default linker for Android. Disable three reflection tests that now fail, likely related to issues with swift-reflection-dump and switching to lld.
This commit is contained in:
@@ -175,21 +175,6 @@ set(SWIFT_COMPILER_VERSION "" CACHE STRING
|
|||||||
set(CLANG_COMPILER_VERSION "" CACHE STRING
|
set(CLANG_COMPILER_VERSION "" CACHE STRING
|
||||||
"The internal version of the Clang compiler")
|
"The internal version of the Clang compiler")
|
||||||
|
|
||||||
# Which default linker to use. Prefer LLVM_USE_LINKER if it set, otherwise use
|
|
||||||
# our own defaults. This should only be possible in a unified (not stand alone)
|
|
||||||
# build environment.
|
|
||||||
if(LLVM_USE_LINKER)
|
|
||||||
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
|
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(SWIFT_USE_LINKER_default "lld")
|
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|
||||||
set(SWIFT_USE_LINKER_default "")
|
|
||||||
else()
|
|
||||||
set(SWIFT_USE_LINKER_default "gold")
|
|
||||||
endif()
|
|
||||||
set(SWIFT_USE_LINKER ${SWIFT_USE_LINKER_default} CACHE STRING
|
|
||||||
"Build Swift with a non-default linker")
|
|
||||||
|
|
||||||
option(SWIFT_DISABLE_DEAD_STRIPPING
|
option(SWIFT_DISABLE_DEAD_STRIPPING
|
||||||
"Turn off Darwin-specific dead stripping for Swift host tools." FALSE)
|
"Turn off Darwin-specific dead stripping for Swift host tools." FALSE)
|
||||||
|
|
||||||
@@ -308,8 +293,8 @@ set(SWIFT_ANDROID_API_LEVEL "" CACHE STRING
|
|||||||
|
|
||||||
set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
|
set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
|
||||||
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
|
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
|
||||||
set(SWIFT_ANDROID_NDK_GCC_VERSION "" CACHE STRING
|
set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.8" CACHE STRING
|
||||||
"The GCC version to use when building for Android. Currently only 4.9 is supported.")
|
"The Clang version to use when building for Android.")
|
||||||
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
|
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
|
||||||
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
|
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
|
||||||
|
|
||||||
@@ -748,6 +733,23 @@ set(SWIFT_HOST_VARIANT_SDK "${SWIFT_HOST_VARIANT_SDK_default}" CACHE STRING
|
|||||||
set(SWIFT_HOST_VARIANT_ARCH "${SWIFT_HOST_VARIANT_ARCH_default}" CACHE STRING
|
set(SWIFT_HOST_VARIANT_ARCH "${SWIFT_HOST_VARIANT_ARCH_default}" CACHE STRING
|
||||||
"Deployment arch for Swift host tools (the compiler).")
|
"Deployment arch for Swift host tools (the compiler).")
|
||||||
|
|
||||||
|
# Which default linker to use. Prefer LLVM_USE_LINKER if it set, otherwise use
|
||||||
|
# our own defaults. This should only be possible in a unified (not stand alone)
|
||||||
|
# build environment.
|
||||||
|
if(LLVM_USE_LINKER)
|
||||||
|
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
|
||||||
|
elseif(${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
|
||||||
|
set(SWIFT_USE_LINKER_default "lld")
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
||||||
|
set(SWIFT_USE_LINKER_default "lld")
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
set(SWIFT_USE_LINKER_default "")
|
||||||
|
else()
|
||||||
|
set(SWIFT_USE_LINKER_default "gold")
|
||||||
|
endif()
|
||||||
|
set(SWIFT_USE_LINKER ${SWIFT_USE_LINKER_default} CACHE STRING
|
||||||
|
"Build Swift with a non-default linker")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Enable additional warnings.
|
# Enable additional warnings.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -145,12 +145,9 @@ function(_add_host_variant_c_compile_link_flags name)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
|
if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
|
||||||
# lld can handle targeting the android build. However, if lld is not
|
# Make sure the Android NDK lld is used.
|
||||||
# enabled, then fallback to the linker included in the android NDK.
|
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
|
||||||
if(NOT SWIFT_USE_LINKER STREQUAL "lld")
|
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-B${tools_path}>)
|
||||||
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
|
|
||||||
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-B${tools_path}>)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
|
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
|
||||||
@@ -384,11 +381,6 @@ function(_add_host_variant_link_flags target)
|
|||||||
cxx_link_libraries)
|
cxx_link_libraries)
|
||||||
target_link_libraries(${target} PRIVATE
|
target_link_libraries(${target} PRIVATE
|
||||||
${cxx_link_libraries})
|
${cxx_link_libraries})
|
||||||
|
|
||||||
swift_android_libgcc_for_arch_cross_compile(${SWIFT_HOST_VARIANT_ARCH}
|
|
||||||
${SWIFT_HOST_VARIANT_ARCH}_LIB)
|
|
||||||
target_link_directories(${target} PRIVATE
|
|
||||||
${${SWIFT_HOST_VARIANT_ARCH}_LIB})
|
|
||||||
else()
|
else()
|
||||||
# If lto is enabled, we need to add the object path flag so that the LTO code
|
# If lto is enabled, we need to add the object path flag so that the LTO code
|
||||||
# generator leaves the intermediate object file in a place where it will not
|
# generator leaves the intermediate object file in a place where it will not
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ function(add_swift_unittest test_dirname)
|
|||||||
COMMAND "${SWIFT_SOURCE_DIR}/utils/swift-rpathize.py"
|
COMMAND "${SWIFT_SOURCE_DIR}/utils/swift-rpathize.py"
|
||||||
"$<TARGET_FILE:${test_dirname}>")
|
"$<TARGET_FILE:${test_dirname}>")
|
||||||
elseif("${SWIFT_HOST_VARIANT}" STREQUAL "android")
|
elseif("${SWIFT_HOST_VARIANT}" STREQUAL "android")
|
||||||
swift_android_libgcc_for_arch_cross_compile(${SWIFT_HOST_VARIANT_ARCH} android_system_libs)
|
|
||||||
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_DIRECTORIES
|
|
||||||
"${android_system_libs}")
|
|
||||||
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES "log")
|
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES "log")
|
||||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||||
|
|||||||
@@ -1,28 +1,7 @@
|
|||||||
function(swift_android_prebuilt_host_name prebuilt_var_name)
|
|
||||||
# Get the prebuilt suffix to create the correct toolchain path when using the NDK
|
|
||||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
|
|
||||||
set(${prebuilt_var_name} darwin-x86_64 PARENT_SCOPE)
|
|
||||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
|
|
||||||
set(${prebuilt_var_name} linux-x86_64 PARENT_SCOPE)
|
|
||||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(${prebuilt_var_name} Windows-x86_64 PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
message(SEND_ERROR "cannot cross-compile to android from ${CMAKE_HOST_SYSTEM_NAME}")
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(swift_android_libgcc_for_arch_cross_compile arch var)
|
|
||||||
set(paths)
|
|
||||||
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
|
||||||
list(APPEND paths "${SWIFT_SDK_ANDROID_ARCH_${arch}_PATH}/../lib/gcc/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}/${SWIFT_ANDROID_NDK_GCC_VERSION}.x")
|
|
||||||
endif()
|
|
||||||
set(${var} ${paths} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(swift_android_sysroot sysroot_var_name)
|
function(swift_android_sysroot sysroot_var_name)
|
||||||
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
||||||
swift_android_prebuilt_host_name(prebuilt_build)
|
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform)
|
||||||
set(${sysroot_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${prebuilt_build}/sysroot" PARENT_SCOPE)
|
set(${sysroot_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${platform}-x86_64/sysroot" PARENT_SCOPE)
|
||||||
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
|
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
|
||||||
set(${sysroot_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}" PARENT_SCOPE)
|
set(${sysroot_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
@@ -32,19 +11,8 @@ endfunction()
|
|||||||
|
|
||||||
function(swift_android_tools_path arch path_var_name)
|
function(swift_android_tools_path arch path_var_name)
|
||||||
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
||||||
swift_android_prebuilt_host_name(prebuilt_build)
|
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform)
|
||||||
if("${arch}" STREQUAL "i686")
|
set(${path_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${platform}-x86_64/bin" PARENT_SCOPE)
|
||||||
set(ndk_prebuilt_path
|
|
||||||
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
|
|
||||||
elseif("${arch}" STREQUAL "x86_64")
|
|
||||||
set(ndk_prebuilt_path
|
|
||||||
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86_64-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
|
|
||||||
else()
|
|
||||||
set(ndk_prebuilt_path
|
|
||||||
"${SWIFT_ANDROID_NDK_PATH}/toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${path_var_name} "${ndk_prebuilt_path}/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}/bin" PARENT_SCOPE)
|
|
||||||
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
|
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
|
||||||
set(${path_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}/usr/bin" PARENT_SCOPE)
|
set(${path_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}/usr/bin" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ To follow along with this guide, you'll need:
|
|||||||
Ubuntu 18.04 or Ubuntu 16.04. Before attempting to build for Android,
|
Ubuntu 18.04 or Ubuntu 16.04. Before attempting to build for Android,
|
||||||
please make sure you are able to build for Linux by following the
|
please make sure you are able to build for Linux by following the
|
||||||
instructions in the Swift project README.
|
instructions in the Swift project README.
|
||||||
2. The latest version of the Android NDK (r21e at the time of this writing,
|
2. The latest version of the Android NDK (r23b at the time of this writing),
|
||||||
only r19 or later are supported), available to download here:
|
available to download here:
|
||||||
https://developer.android.com/ndk/downloads/index.html.
|
https://developer.android.com/ndk/downloads/index.html.
|
||||||
3. An Android device with remote debugging enabled or the emulator. We require
|
3. An Android device with remote debugging enabled or the emulator. We require
|
||||||
remote debugging in order to deploy built stdlib products to the device. You
|
remote debugging in order to deploy built stdlib products to the device. You
|
||||||
@@ -73,7 +73,7 @@ Android NDK, as well as the directories that contain the `libicuucswift.so` and
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ ARM_DIR=path/to/libiconv-libicu-android/armeabi-v7a
|
$ ARM_DIR=path/to/libiconv-libicu-android/armeabi-v7a
|
||||||
$ NDK_PATH=path/to/android-ndk-r21e
|
$ NDK_PATH=path/to/android-ndk-r23b
|
||||||
$ utils/build-script \
|
$ utils/build-script \
|
||||||
-R \ # Build in ReleaseAssert mode.
|
-R \ # Build in ReleaseAssert mode.
|
||||||
--android \ # Build for Android.
|
--android \ # Build for Android.
|
||||||
@@ -99,7 +99,7 @@ Then use the built Swift compiler from the previous step to compile a Swift
|
|||||||
source file, targeting Android:
|
source file, targeting Android:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ NDK_PATH="path/to/android-ndk-r21e"
|
$ NDK_PATH="path/to/android-ndk-r23b"
|
||||||
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step
|
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step
|
||||||
# The location of the tools used to build Android binaries
|
# The location of the tools used to build Android binaries
|
||||||
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
|
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
|
||||||
@@ -153,7 +153,7 @@ adb push /path/to/libicu-android/armeabi-v7a/libicuucswift.so /data/local/tmp
|
|||||||
In addition, you'll also need to copy the Android NDK's libc++:
|
In addition, you'll also need to copy the Android NDK's libc++:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ adb push /path/to/android-ndk-r21e/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so /data/local/tmp
|
$ adb push /path/to/android-ndk-r23b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so /data/local/tmp
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, you'll need to copy the `hello` executable you built in the
|
Finally, you'll need to copy the `hello` executable you built in the
|
||||||
@@ -196,7 +196,7 @@ $ utils/build-script \
|
|||||||
-R \ # Build in ReleaseAssert mode.
|
-R \ # Build in ReleaseAssert mode.
|
||||||
-T \ # Run all tests, including on the Android device (add --host-test to only run Android tests on the linux host).
|
-T \ # Run all tests, including on the Android device (add --host-test to only run Android tests on the linux host).
|
||||||
--android \ # Build for Android.
|
--android \ # Build for Android.
|
||||||
--android-ndk ~/android-ndk-r21e \ # Path to an Android NDK.
|
--android-ndk ~/android-ndk-r23b \ # Path to an Android NDK.
|
||||||
--android-arch armv7 \ # Optionally specify Android architecture, alternately aarch64
|
--android-arch armv7 \ # Optionally specify Android architecture, alternately aarch64
|
||||||
--android-ndk-version 21 \
|
--android-ndk-version 21 \
|
||||||
--android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
|
--android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string toolchains::GenericUnix::getDefaultLinker() const {
|
std::string toolchains::GenericUnix::getDefaultLinker() const {
|
||||||
|
if (getTriple().isAndroid())
|
||||||
|
return "lld";
|
||||||
|
|
||||||
switch (getTriple().getArch()) {
|
switch (getTriple().getArch()) {
|
||||||
case llvm::Triple::arm:
|
case llvm::Triple::arm:
|
||||||
case llvm::Triple::aarch64:
|
case llvm::Triple::aarch64:
|
||||||
@@ -384,9 +387,12 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job,
|
|||||||
|
|
||||||
ArgStringList Arguments;
|
ArgStringList Arguments;
|
||||||
|
|
||||||
|
const char *AR;
|
||||||
// Configure the toolchain.
|
// Configure the toolchain.
|
||||||
const char *AR =
|
if (getTriple().isAndroid())
|
||||||
context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
|
AR = "llvm-ar";
|
||||||
|
else
|
||||||
|
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
|
||||||
Arguments.push_back("crs");
|
Arguments.push_back("crs");
|
||||||
|
|
||||||
Arguments.push_back(
|
Arguments.push_back(
|
||||||
|
|||||||
@@ -94,12 +94,9 @@ function(_add_target_variant_c_compile_link_flags)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${CFLAGS_SDK}" STREQUAL "ANDROID")
|
if("${CFLAGS_SDK}" STREQUAL "ANDROID")
|
||||||
# lld can handle targeting the android build. However, if lld is not
|
# Make sure the Android NDK lld is used.
|
||||||
# enabled, then fallback to the linker included in the android NDK.
|
swift_android_tools_path(${CFLAGS_ARCH} tools_path)
|
||||||
if(NOT SWIFT_USE_LINKER STREQUAL "lld")
|
list(APPEND result "-B" "${tools_path}")
|
||||||
swift_android_tools_path(${CFLAGS_ARCH} tools_path)
|
|
||||||
list(APPEND result "-B" "${tools_path}")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
|
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
|
||||||
@@ -407,8 +404,8 @@ function(_add_target_variant_link_flags)
|
|||||||
MACCATALYST_BUILD_FLAVOR "${LFLAGS_MACCATALYST_BUILD_FLAVOR}")
|
MACCATALYST_BUILD_FLAVOR "${LFLAGS_MACCATALYST_BUILD_FLAVOR}")
|
||||||
if("${LFLAGS_SDK}" STREQUAL "LINUX")
|
if("${LFLAGS_SDK}" STREQUAL "LINUX")
|
||||||
list(APPEND link_libraries "pthread" "dl")
|
list(APPEND link_libraries "pthread" "dl")
|
||||||
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686")
|
if("${LFLAGS_ARCH}" MATCHES "armv6|armv7|i686")
|
||||||
list(APPEND link_libraries PRIVATE "atomic")
|
list(APPEND link_libraries "atomic")
|
||||||
endif()
|
endif()
|
||||||
elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD")
|
elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD")
|
||||||
list(APPEND link_libraries "pthread")
|
list(APPEND link_libraries "pthread")
|
||||||
@@ -437,6 +434,9 @@ function(_add_target_variant_link_flags)
|
|||||||
list(APPEND link_libraries "dl" "log")
|
list(APPEND link_libraries "dl" "log")
|
||||||
# We need to add the math library, which is linked implicitly by libc++
|
# We need to add the math library, which is linked implicitly by libc++
|
||||||
list(APPEND result "-lm")
|
list(APPEND result "-lm")
|
||||||
|
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
||||||
|
list(APPEND result "-resource-dir=${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/${SWIFT_ANDROID_NDK_CLANG_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# link against the custom C++ library
|
# link against the custom C++ library
|
||||||
swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries)
|
swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries)
|
||||||
@@ -446,11 +446,6 @@ function(_add_target_variant_link_flags)
|
|||||||
list(APPEND link_libraries
|
list(APPEND link_libraries
|
||||||
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
|
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
|
||||||
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
|
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
|
||||||
|
|
||||||
swift_android_libgcc_for_arch_cross_compile(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
|
|
||||||
foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
|
|
||||||
list(APPEND library_search_directories ${path})
|
|
||||||
endforeach()
|
|
||||||
else()
|
else()
|
||||||
# If lto is enabled, we need to add the object path flag so that the LTO code
|
# If lto is enabled, we need to add the object path flag so that the LTO code
|
||||||
# generator leaves the intermediate object file in a place where it will not
|
# generator leaves the intermediate object file in a place where it will not
|
||||||
@@ -478,10 +473,17 @@ function(_add_target_variant_link_flags)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_USE_LINKER AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
|
if(SWIFT_USE_LINKER AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
|
||||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
# The linker is normally chosen based on the host, but the Android NDK only
|
||||||
list(APPEND result "-fuse-ld=${SWIFT_USE_LINKER}.exe")
|
# uses lld now.
|
||||||
|
if("${LFLAGS_SDK}" STREQUAL "ANDROID")
|
||||||
|
set(linker "lld")
|
||||||
else()
|
else()
|
||||||
list(APPEND result "-fuse-ld=${SWIFT_USE_LINKER}")
|
set(linker "${SWIFT_USE_LINKER}")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
||||||
|
list(APPEND result "-fuse-ld=${linker}.exe")
|
||||||
|
else()
|
||||||
|
list(APPEND result "-fuse-ld=${linker}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ foreach(sdk ${SWIFT_SDKS})
|
|||||||
endif()
|
endif()
|
||||||
set(libpthread -lpthread)
|
set(libpthread -lpthread)
|
||||||
set(android_libraries)
|
set(android_libraries)
|
||||||
if(sdk STREQUAL ANDROID)
|
if(${sdk} STREQUAL ANDROID)
|
||||||
set(android_libraries -llog)
|
set(android_libraries -llog)
|
||||||
set(libpthread)
|
set(libpthread)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// REQUIRES: no_asan
|
// REQUIRES: no_asan
|
||||||
|
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
|
||||||
// RUN: %empty-directory(%t)
|
// RUN: %empty-directory(%t)
|
||||||
import _Differentiation
|
import _Differentiation
|
||||||
|
|
||||||
|
|||||||
8
test/LinkerSections/function_sections-lld.swift
Normal file
8
test/LinkerSections/function_sections-lld.swift
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// REQUIRES: OS=linux-androideabi || OS=linux-android
|
||||||
|
// RUN: %empty-directory(%t)
|
||||||
|
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
|
||||||
|
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
|
||||||
|
// RUN: %FileCheck %s < %t/../../FunctionSections.map
|
||||||
|
|
||||||
|
// CHECK-NOT: .text.$s16FunctionSections5func2yyF
|
||||||
|
// CHECK: .text.$s16FunctionSections5func1yyF
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// REQUIRES: OS=linux-gnu || OS=linux-androideabi || OS=linux-android || OS=freebsd
|
// REQUIRES: OS=linux-gnu || OS=freebsd
|
||||||
// RUN: %empty-directory(%t)
|
// RUN: %empty-directory(%t)
|
||||||
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
|
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
|
||||||
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
|
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
// SR-12893
|
// SR-12893
|
||||||
// XFAIL: openbsd
|
// XFAIL: openbsd
|
||||||
|
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
|
||||||
|
|
||||||
// RUN: %empty-directory(%t)
|
// RUN: %empty-directory(%t)
|
||||||
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors%{target-shared-library-suffix} -L%t/../../.. -lBlocksRuntime
|
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors%{target-shared-library-suffix} -L%t/../../.. -lBlocksRuntime
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
// RUN: %target-swift-reflection-dump -binary-filename %t/%target-library-name(TypesToReflect) | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
|
// RUN: %target-swift-reflection-dump -binary-filename %t/%target-library-name(TypesToReflect) | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
|
||||||
|
|
||||||
// UNSUPPORTED: CPU=arm64e
|
// UNSUPPORTED: CPU=arm64e
|
||||||
|
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
|
||||||
|
|
||||||
// CHECK-32: FIELDS:
|
// CHECK-32: FIELDS:
|
||||||
// CHECK-32: =======
|
// CHECK-32: =======
|
||||||
|
|||||||
17
test/lit.cfg
17
test/lit.cfg
@@ -445,10 +445,7 @@ differentiable_programming = lit_config.params.get('differentiable_programming',
|
|||||||
if differentiable_programming is not None:
|
if differentiable_programming is not None:
|
||||||
config.available_features.add('differentiable_programming')
|
config.available_features.add('differentiable_programming')
|
||||||
|
|
||||||
# On Android, LLVM LTO is only supported when the driver uses lld.
|
config.available_features.add('lld_lto')
|
||||||
# And skip lto tests when driver uses gold linker.
|
|
||||||
if not (run_os in ['linux-android', 'linux-androideabi']) or (config.android_linker_name == 'lld'):
|
|
||||||
config.available_features.add('lld_lto')
|
|
||||||
|
|
||||||
test_options = os.environ.get('SWIFT_TEST_OPTIONS')
|
test_options = os.environ.get('SWIFT_TEST_OPTIONS')
|
||||||
if test_options:
|
if test_options:
|
||||||
@@ -1508,7 +1505,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
|
|||||||
config.android_ndk_path, "toolchains", "llvm", "prebuilt",
|
config.android_ndk_path, "toolchains", "llvm", "prebuilt",
|
||||||
prebuilt_directory)
|
prebuilt_directory)
|
||||||
tools_directory = shell_quote(make_path(
|
tools_directory = shell_quote(make_path(
|
||||||
toolchain_directory, ndk_platform_triple, "bin"))
|
toolchain_directory, "bin"))
|
||||||
lit_config.note("Testing Android " + config.variant_triple)
|
lit_config.note("Testing Android " + config.variant_triple)
|
||||||
config.target_object_format = "elf"
|
config.target_object_format = "elf"
|
||||||
config.target_shared_library_prefix = 'lib'
|
config.target_shared_library_prefix = 'lib'
|
||||||
@@ -1516,10 +1513,6 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
|
|||||||
config.target_runtime = "native"
|
config.target_runtime = "native"
|
||||||
config.target_swift_autolink_extract = inferSwiftBinary("swift-autolink-extract")
|
config.target_swift_autolink_extract = inferSwiftBinary("swift-autolink-extract")
|
||||||
config.target_sdk_name = "android"
|
config.target_sdk_name = "android"
|
||||||
android_link_paths_opt = "-L {}".format(
|
|
||||||
shell_quote(make_path(
|
|
||||||
toolchain_directory, "lib", "gcc", ndk_platform_triple,
|
|
||||||
"{}.x".format(config.android_ndk_gcc_version))))
|
|
||||||
config.resource_dir_opt = ("-resource-dir %s" % test_resource_dir)
|
config.resource_dir_opt = ("-resource-dir %s" % test_resource_dir)
|
||||||
# Since NDK r19, the headers and libraries are available in a unified
|
# Since NDK r19, the headers and libraries are available in a unified
|
||||||
# sysroot at $NDK_PATH/toolchains/llvm/prebuilt/$prebuilt_directory/sysroot,
|
# sysroot at $NDK_PATH/toolchains/llvm/prebuilt/$prebuilt_directory/sysroot,
|
||||||
@@ -1530,7 +1523,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
|
|||||||
'-sdk', config.variant_sdk, '-Xclang-linker',
|
'-sdk', config.variant_sdk, '-Xclang-linker',
|
||||||
'--target={}{}'.format(config.variant_triple, config.android_api_level),
|
'--target={}{}'.format(config.variant_triple, config.android_api_level),
|
||||||
'-tools-directory', tools_directory,
|
'-tools-directory', tools_directory,
|
||||||
android_link_paths_opt, '-use-ld=%s' % config.android_linker_name,
|
'-use-ld=%s' % config.android_linker_name,
|
||||||
config.resource_dir_opt, mcp_opt, config.swift_test_options,
|
config.resource_dir_opt, mcp_opt, config.swift_test_options,
|
||||||
config.swift_driver_test_options, swift_execution_tests_extra_flags])
|
config.swift_driver_test_options, swift_execution_tests_extra_flags])
|
||||||
config.target_codesign = "echo"
|
config.target_codesign = "echo"
|
||||||
@@ -1542,7 +1535,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
|
|||||||
config.target_swift_frontend = ' '.join([
|
config.target_swift_frontend = ' '.join([
|
||||||
config.swift_frontend,
|
config.swift_frontend,
|
||||||
'-target', config.variant_triple,
|
'-target', config.variant_triple,
|
||||||
'-sdk', config.variant_sdk, android_link_paths_opt, config.resource_dir_opt,
|
'-sdk', config.variant_sdk, config.resource_dir_opt,
|
||||||
mcp_opt, config.swift_test_options, config.swift_frontend_test_options])
|
mcp_opt, config.swift_test_options, config.swift_frontend_test_options])
|
||||||
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
|
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
|
||||||
subst_target_swift_frontend_mock_sdk_after = ""
|
subst_target_swift_frontend_mock_sdk_after = ""
|
||||||
@@ -1577,7 +1570,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
|
|||||||
'-sdk', config.variant_sdk, '-Xclang-linker',
|
'-sdk', config.variant_sdk, '-Xclang-linker',
|
||||||
'--target={}{}'.format(config.variant_triple, config.android_api_level),
|
'--target={}{}'.format(config.variant_triple, config.android_api_level),
|
||||||
'-tools-directory', tools_directory,
|
'-tools-directory', tools_directory,
|
||||||
android_link_paths_opt, config.resource_dir_opt, mcp_opt,
|
config.resource_dir_opt, mcp_opt,
|
||||||
'-use-ld=%s' % config.android_linker_name,
|
'-use-ld=%s' % config.android_linker_name,
|
||||||
config.swift_driver_test_options])
|
config.swift_driver_test_options])
|
||||||
config.target_swift_modulewrap = ' '.join([
|
config.target_swift_modulewrap = ' '.join([
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
|
|||||||
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
||||||
|
|
||||||
# --- android ---
|
# --- android ---
|
||||||
|
config.android_linker_name = "lld"
|
||||||
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
|
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
|
||||||
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
|
|
||||||
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
|
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
|
||||||
|
|
||||||
# --- Windows ---
|
# --- Windows ---
|
||||||
@@ -127,12 +127,6 @@ if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
|
|||||||
if "@SWIFT_HAVE_LIBXML2@" == "TRUE":
|
if "@SWIFT_HAVE_LIBXML2@" == "TRUE":
|
||||||
config.available_features.add('libxml2')
|
config.available_features.add('libxml2')
|
||||||
|
|
||||||
if "@SWIFT_USE_LINKER@" == "lld":
|
|
||||||
config.android_linker_name = "lld"
|
|
||||||
else:
|
|
||||||
# even if SWIFT_USE_LINKER isn't set, we cannot use BFD for Android
|
|
||||||
config.android_linker_name = "gold"
|
|
||||||
|
|
||||||
if '@SWIFT_INCLUDE_TOOLS@' == 'TRUE':
|
if '@SWIFT_INCLUDE_TOOLS@' == 'TRUE':
|
||||||
config.available_features.add('swift_tools_extra')
|
config.available_features.add('swift_tools_extra')
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ KNOWN_SETTINGS=(
|
|||||||
android-icu-uc "" "Path to libicuuc.so"
|
android-icu-uc "" "Path to libicuuc.so"
|
||||||
android-icu-uc-include "" "Path to a directory containing headers for libicuuc"
|
android-icu-uc-include "" "Path to a directory containing headers for libicuuc"
|
||||||
android-ndk "" "An absolute path to the NDK that will be used as a libc implementation for Android builds"
|
android-ndk "" "An absolute path to the NDK that will be used as a libc implementation for Android builds"
|
||||||
android-ndk-gcc-version "" "The GCC version to use when building for Android. Currently only 4.9 is supported"
|
|
||||||
|
|
||||||
## Darwin Options
|
## Darwin Options
|
||||||
darwin-crash-reporter-client "" "whether to enable CrashReporter integration"
|
darwin-crash-reporter-client "" "whether to enable CrashReporter integration"
|
||||||
@@ -520,6 +519,7 @@ function set_build_options_for_host() {
|
|||||||
# variable.
|
# variable.
|
||||||
if [[ "${PREFIX}" ]] ; then
|
if [[ "${PREFIX}" ]] ; then
|
||||||
llvm_cmake_options+=(
|
llvm_cmake_options+=(
|
||||||
|
-DCLANG_DEFAULT_LINKER:STRING="lld"
|
||||||
-DDEFAULT_SYSROOT:STRING="$(dirname ${PREFIX})"
|
-DDEFAULT_SYSROOT:STRING="$(dirname ${PREFIX})"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
@@ -1899,7 +1899,6 @@ for host in "${ALL_HOSTS[@]}"; do
|
|||||||
cmake_options=(
|
cmake_options=(
|
||||||
"${cmake_options[@]}"
|
"${cmake_options[@]}"
|
||||||
-DSWIFT_ANDROID_NDK_PATH:STRING="${ANDROID_NDK}"
|
-DSWIFT_ANDROID_NDK_PATH:STRING="${ANDROID_NDK}"
|
||||||
-DSWIFT_ANDROID_NDK_GCC_VERSION:STRING="${ANDROID_NDK_GCC_VERSION}"
|
|
||||||
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC:STRING="${ANDROID_ICU_UC}"
|
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC:STRING="${ANDROID_ICU_UC}"
|
||||||
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC_INCLUDE:STRING="${ANDROID_ICU_UC_INCLUDE}"
|
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC_INCLUDE:STRING="${ANDROID_ICU_UC_INCLUDE}"
|
||||||
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_I18N:STRING="${ANDROID_ICU_I18N}"
|
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_I18N:STRING="${ANDROID_ICU_I18N}"
|
||||||
|
|||||||
@@ -1159,15 +1159,6 @@ def create_argument_parser():
|
|||||||
help='The Android API level to target when building for Android. '
|
help='The Android API level to target when building for Android. '
|
||||||
'Currently only 21 or above is supported')
|
'Currently only 21 or above is supported')
|
||||||
|
|
||||||
option('--android-ndk-gcc-version', store,
|
|
||||||
choices=['4.8', '4.9'],
|
|
||||||
default='4.9',
|
|
||||||
help='The GCC version to use when building for Android. Currently '
|
|
||||||
'only 4.9 is supported. %(default)s is also the default '
|
|
||||||
'value. This option may be used when experimenting with '
|
|
||||||
'versions of the Android NDK not officially supported by '
|
|
||||||
'Swift')
|
|
||||||
|
|
||||||
option('--android-icu-uc', store_path,
|
option('--android-icu-uc', store_path,
|
||||||
help='Path to libicuuc.so')
|
help='Path to libicuuc.so')
|
||||||
option('--android-icu-uc-include', store_path,
|
option('--android-icu-uc-include', store_path,
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ EXPECTED_DEFAULTS = {
|
|||||||
'android_icu_uc_include': None,
|
'android_icu_uc_include': None,
|
||||||
'android_icu_data': None,
|
'android_icu_data': None,
|
||||||
'android_ndk': None,
|
'android_ndk': None,
|
||||||
'android_ndk_gcc_version': '4.9',
|
|
||||||
'android_arch': 'armv7',
|
'android_arch': 'armv7',
|
||||||
'assertions': True,
|
'assertions': True,
|
||||||
'benchmark': False,
|
'benchmark': False,
|
||||||
@@ -657,8 +656,6 @@ EXPECTED_OPTIONS = [
|
|||||||
DisableOption('--skip-build-clang-tools-extra',
|
DisableOption('--skip-build-clang-tools-extra',
|
||||||
dest='build_clang_tools_extra'),
|
dest='build_clang_tools_extra'),
|
||||||
|
|
||||||
ChoicesOption('--android-ndk-gcc-version',
|
|
||||||
choices=['4.8', '4.9']),
|
|
||||||
ChoicesOption('--compiler-vendor',
|
ChoicesOption('--compiler-vendor',
|
||||||
choices=['none', 'apple']),
|
choices=['none', 'apple']),
|
||||||
ChoicesOption('--swift-analyze-code-coverage',
|
ChoicesOption('--swift-analyze-code-coverage',
|
||||||
|
|||||||
@@ -307,7 +307,6 @@ class BuildScriptInvocation(object):
|
|||||||
"--android-arch", args.android_arch,
|
"--android-arch", args.android_arch,
|
||||||
"--android-ndk", args.android_ndk,
|
"--android-ndk", args.android_ndk,
|
||||||
"--android-api-level", args.android_api_level,
|
"--android-api-level", args.android_api_level,
|
||||||
"--android-ndk-gcc-version", args.android_ndk_gcc_version,
|
|
||||||
"--android-icu-uc", args.android_icu_uc,
|
"--android-icu-uc", args.android_icu_uc,
|
||||||
"--android-icu-uc-include", args.android_icu_uc_include,
|
"--android-icu-uc-include", args.android_icu_uc_include,
|
||||||
"--android-icu-i18n", args.android_icu_i18n,
|
"--android-icu-i18n", args.android_icu_i18n,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ Represent toolchain - the versioned executables.
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
from build_swift.build_swift import cache_utils
|
from build_swift.build_swift import cache_utils
|
||||||
@@ -62,8 +63,12 @@ _register("llvm_profdata", "llvm-profdata")
|
|||||||
_register("llvm_cov", "llvm-cov")
|
_register("llvm_cov", "llvm-cov")
|
||||||
_register("lipo", "lipo")
|
_register("lipo", "lipo")
|
||||||
_register("libtool", "libtool")
|
_register("libtool", "libtool")
|
||||||
_register("ranlib", "ranlib")
|
if 'ANDROID_DATA' in os.environ:
|
||||||
_register("ar", "ar")
|
_register("ranlib", "llvm-ranlib")
|
||||||
|
_register("ar", "llvm-ar")
|
||||||
|
else:
|
||||||
|
_register("ranlib", "ranlib")
|
||||||
|
_register("ar", "ar")
|
||||||
_register("sccache", "sccache")
|
_register("sccache", "sccache")
|
||||||
_register("swiftc", "swiftc")
|
_register("swiftc", "swiftc")
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
|
|||||||
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
||||||
|
|
||||||
# --- Android Configuration ---
|
# --- Android Configuration ---
|
||||||
|
config.android_linker_name = "lld"
|
||||||
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
|
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
|
||||||
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
|
|
||||||
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
|
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
|
||||||
|
|
||||||
# --- Windows MSVC Configuration ---
|
# --- Windows MSVC Configuration ---
|
||||||
@@ -110,12 +110,6 @@ if "@CMAKE_GENERATOR@" == "Xcode":
|
|||||||
|
|
||||||
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
|
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
|
||||||
|
|
||||||
if "@SWIFT_USE_LINKER@" == "lld":
|
|
||||||
config.android_linker_name = "lld"
|
|
||||||
else:
|
|
||||||
# even if SWIFT_USE_LINKER isn't set, we cannot use BFD for Android
|
|
||||||
config.android_linker_name = "gold"
|
|
||||||
|
|
||||||
if "@SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING@" == "TRUE":
|
if "@SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING@" == "TRUE":
|
||||||
config.available_features.add('differentiable_programming')
|
config.available_features.add('differentiable_programming')
|
||||||
if "@SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY@" == "TRUE":
|
if "@SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY@" == "TRUE":
|
||||||
|
|||||||
Reference in New Issue
Block a user