Skip to content

Commit 5ef3df7

Browse files
committed
build: link to ICU by full path on Android
Use the variable that holds the path to the ICU libraries to link against ICU rather than hardcoding the names. This restores control to the ICU linking to the way that traditional CMake `find_package` based linking works.
1 parent af54147 commit 5ef3df7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,10 @@ function(_add_variant_link_flags)
462462
list(APPEND link_libraries "bsd" "atomic")
463463
list(APPEND result "-Wl,-Bsymbolic")
464464
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
465-
list(APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift")
465+
list(APPEND link_libraries "dl" "log" "atomic")
466466
# We need to add the math library, which is linked implicitly by libc++
467467
list(APPEND result "-lm")
468+
468469
if("${LFLAGS_ARCH}" MATCHES armv7)
469470
set(android_libcxx_path "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a")
470471
elseif("${LFLAGS_ARCH}" MATCHES aarch64)
@@ -476,8 +477,17 @@ function(_add_variant_link_flags)
476477
else()
477478
message(SEND_ERROR "unknown architecture (${LFLAGS_ARCH}) for android")
478479
endif()
479-
list(APPEND link_libraries "${android_libcxx_path}/libc++abi.a")
480-
list(APPEND link_libraries "${android_libcxx_path}/libc++_shared.so")
480+
481+
# link against the custom C++ library
482+
list(APPEND link_libraries
483+
${android_libcxx_path}/libc++abi.a
484+
${android_libcxx_path}/libc++_shared.so)
485+
486+
# link against the ICU libraries
487+
list(APPEND link_libraries
488+
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
489+
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
490+
481491
swift_android_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
482492
foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
483493
list(APPEND library_search_directories ${path})

0 commit comments

Comments
 (0)