From 817a890a672256bd3b95e1b73a6ccf1e96c63f96 Mon Sep 17 00:00:00 2001 From: Eric Miotto Date: Fri, 5 Dec 2025 12:57:38 -0800 Subject: [PATCH] CMake Android: ensure _Builtin_float is built before _math _math would be able to build against either the Swift or the clang module for _Builtin_float; however the build will fail if the Swift module is present but does not contain the architectures we need, with errors like ``` :0: error: could not find module '_Builtin_float' for target 'armv7-unknown-linux-android'; found: aarch64-unknown-linux-android, x86_64-unknown-linux-android, at: /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/lib/swift/android/_Builtin_float.swiftmodule/armv7-unknown-linux-android ``` In other words, in this situation we are not falling back to the clang module. Addresses rdar://165768601 --- Runtimes/Overlay/Android/Math/CMakeLists.txt | 3 ++- stdlib/public/Platform/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Runtimes/Overlay/Android/Math/CMakeLists.txt b/Runtimes/Overlay/Android/Math/CMakeLists.txt index 075804523729a..ba847fec39171 100644 --- a/Runtimes/Overlay/Android/Math/CMakeLists.txt +++ b/Runtimes/Overlay/Android/Math/CMakeLists.txt @@ -5,7 +5,8 @@ set_target_properties(swift_math PROPERTIES Swift_MODULE_NAME _math) target_link_libraries(swift_math PRIVATE SwiftAndroid - swiftCore) + swiftCore + swift_Builtin_float) install(TARGETS swift_math EXPORT SwiftOverlayTargets diff --git a/stdlib/public/Platform/CMakeLists.txt b/stdlib/public/Platform/CMakeLists.txt index 083b5578eb42c..db93862fc44d7 100644 --- a/stdlib/public/Platform/CMakeLists.txt +++ b/stdlib/public/Platform/CMakeLists.txt @@ -167,6 +167,7 @@ add_swift_target_library(swift_math ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_O LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}" TARGET_SDKS "ANDROID" INSTALL_IN_COMPONENT sdk-overlay + SWIFT_MODULE_DEPENDS_ANDROID _Builtin_float DEPENDS android_modulemap) add_swift_target_library(swiftAndroid ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY