From 02d5e6650f0ee735ec7a4a32f2e086f181919c3e Mon Sep 17 00:00:00 2001 From: Brent Royal-Gordon Date: Tue, 28 Apr 2020 18:39:30 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20module=20triples=20for=20=E2=80=9Cios-lik?= =?UTF-8?q?e=E2=80=9D=20Mac=20Catalyst=20modules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “ios-like” build flavor is used to build modules that do not exist on macOS for Mac Catalyst. Even though they are built for the “OSX” SDK, they need to have a “MACCATALYST”-style module triple; unfortunately, the transition to naming swiftmodules by module triple in #31170 did not handle this edge case correctly. This commit handles that by piggybacking on a similar special case used to change the lib/swift subdirectory. --- stdlib/cmake/modules/SwiftSource.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/cmake/modules/SwiftSource.cmake b/stdlib/cmake/modules/SwiftSource.cmake index 84f61626b079f..8164f97a16499 100644 --- a/stdlib/cmake/modules/SwiftSource.cmake +++ b/stdlib/cmake/modules/SwiftSource.cmake @@ -362,14 +362,14 @@ function(_compile_swift_files ) # Determine the subdirectory where the binary should be placed. - compute_library_subdir(library_subdir - "${SWIFTFILE_SDK}" "${SWIFTFILE_ARCHITECTURE}") - + set(library_subdir_sdk "${SWIFTFILE_SDK}") if(maccatalyst_build_flavor STREQUAL "ios-like") - compute_library_subdir(library_subdir - "MACCATALYST" "${SWIFTFILE_ARCHITECTURE}") + set(library_subdir_sdk "MACCATALYST") endif() + compute_library_subdir(library_subdir + "${library_subdir_sdk}" "${SWIFTFILE_ARCHITECTURE}") + # If we have a custom module cache path, use it. if (SWIFT_MODULE_CACHE_PATH) list(APPEND swift_flags "-module-cache-path" "${SWIFT_MODULE_CACHE_PATH}") @@ -464,7 +464,7 @@ function(_compile_swift_files list(APPEND swift_flags "-parse-as-library") set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}") - set(module_triple ${SWIFT_SDK_${SWIFTFILE_SDK}_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE}) + set(module_triple ${SWIFT_SDK_${library_subdir_sdk}_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE}) if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS OR SWIFTFILE_SDK STREQUAL "MACCATALYST") set(specific_module_dir "${module_base}.swiftmodule")