Skip to content

Commit 02d5e66

Browse files
committed
Fix module triples for “ios-like” Mac Catalyst modules
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 swiftlang#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.
1 parent 3d3daa1 commit 02d5e66

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ function(_compile_swift_files
362362
)
363363

364364
# Determine the subdirectory where the binary should be placed.
365-
compute_library_subdir(library_subdir
366-
"${SWIFTFILE_SDK}" "${SWIFTFILE_ARCHITECTURE}")
367-
365+
set(library_subdir_sdk "${SWIFTFILE_SDK}")
368366
if(maccatalyst_build_flavor STREQUAL "ios-like")
369-
compute_library_subdir(library_subdir
370-
"MACCATALYST" "${SWIFTFILE_ARCHITECTURE}")
367+
set(library_subdir_sdk "MACCATALYST")
371368
endif()
372369

370+
compute_library_subdir(library_subdir
371+
"${library_subdir_sdk}" "${SWIFTFILE_ARCHITECTURE}")
372+
373373
# If we have a custom module cache path, use it.
374374
if (SWIFT_MODULE_CACHE_PATH)
375375
list(APPEND swift_flags "-module-cache-path" "${SWIFT_MODULE_CACHE_PATH}")
@@ -464,7 +464,7 @@ function(_compile_swift_files
464464
list(APPEND swift_flags "-parse-as-library")
465465

466466
set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}")
467-
set(module_triple ${SWIFT_SDK_${SWIFTFILE_SDK}_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE})
467+
set(module_triple ${SWIFT_SDK_${library_subdir_sdk}_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE})
468468
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS OR
469469
SWIFTFILE_SDK STREQUAL "MACCATALYST")
470470
set(specific_module_dir "${module_base}.swiftmodule")

0 commit comments

Comments
 (0)