Skip to content

[Runtimes] lay down nested swift modules ahead of CMake 4.1 #82571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented Jun 27, 2025

This is needed in order to build target variants properly with a SwiftDriver that has swiftlang/swift-driver#1856 enabled.

Addresses rdar://154410676

target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-path ${variant_module_tmp_dir}/${target}.swiftmodule>")
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftCore_VARIANT_MODULE_TRIPLE}.swiftmodule>")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftCore_VARIANT_MODULE_TRIPLE}.swiftmodule>")
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftCore_VARIANT_MODULE_TRIPLE}.swiftmodule>")

message(AUTHOR_WARNING [=[
This version of CMake supports the Swift module directory structure
Please consider checking the implementation of `emit_swift_interface``
to ensure if behaves as expected
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to ensure if behaves as expected
to ensure it behaves as expected

@edymtt edymtt force-pushed the edymtt/nested-swiftmodule-structure-before-cmake-4.1 branch from aad3856 to 33f228a Compare June 27, 2025 20:40
@edymtt edymtt changed the title [Runtimes][SwiftCore] lay down nested swift modules ahead of CMake 4.1 [Runtimes] lay down nested swift modules ahead of CMake 4.1 Jun 27, 2025
@edymtt
Copy link
Contributor Author

edymtt commented Jun 27, 2025

@swift-ci please test

@edymtt edymtt marked this pull request as ready for review June 27, 2025 20:42
DEPENDS ${target})
target_sources(${target}
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftCore_MODULE_TRIPLE}.swiftmodule>)

# Generate textual swift interfaces is library-evolution is enabled
if(SwiftCore_ENABLE_LIBRARY_EVOLUTION)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took all the feedback that @compnerd left in #80881, except for the one asking to remove the check for SwiftCore_ENABLE_LIBRARY_EVOLUTION -- both because I don't fully appreciate the background about it, and because this PR has already a lot of refactoring.

This is needed in order to build target variants properly with a
SwiftDriver that has swiftlang/swift-driver#1856

Addresses rdar://154410676
@edymtt edymtt force-pushed the edymtt/nested-swiftmodule-structure-before-cmake-4.1 branch from 33f228a to 07f9a31 Compare June 27, 2025 23:12
@edymtt
Copy link
Contributor Author

edymtt commented Jun 27, 2025

@swift-ci please test

Copy link
Member

@etcwilde etcwilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as far as I can tell. Should check with @compnerd as there may be associated changes needed in the swift-installer-scripts repo.

@edymtt
Copy link
Contributor Author

edymtt commented Jun 27, 2025

@swift-ci please smoke test macOS

@edymtt
Copy link
Contributor Author

edymtt commented Jun 27, 2025

@swift-ci please test macOS

@edymtt
Copy link
Contributor Author

edymtt commented Jun 27, 2025

@swift-ci please build toolchain Windows

edymtt added 2 commits June 30, 2025 06:52
This is needed in order to build target variants properly with a
SwiftDriver that has swiftlang/swift-driver#1856

Addresses rdar://154410676
… 4.1

This is needed in order to build target variants properly with a
SwiftDriver that has swiftlang/swift-driver#1856

Addresses rdar://154410676
@edymtt edymtt force-pushed the edymtt/nested-swiftmodule-structure-before-cmake-4.1 branch from 07f9a31 to 111cfe2 Compare June 30, 2025 13:55
@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

@swift-ci please smoke test macOS

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

@swift-ci please test macOS

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

@swift-ci please test Linux

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

@swift-ci please build toolchain Windows

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

@swift-ci please test Windows

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

Still need to cross reference with the installer scripts, but looking at the logs for the build of the Windows toolchain and perusing some local build results, it seems that the installation of experimental products is generating the existing files at the same location, and adding swiftsourceinfo files, e.g.

@@ -1,11 +1,17 @@
 -- Install configuration: "Release"
 -- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/x86_64/libswift_RegexParser.lib
+-- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/_RegexParser.swiftmodule
 -- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/_RegexParser.swiftmodule/x86_64-unknown-windows-msvc.swiftdoc
 -- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/_RegexParser.swiftmodule/x86_64-unknown-windows-msvc.swiftmodule
+-- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/_RegexParser.swiftmodule/x86_64-unknown-windows-msvc.swiftsourceinfo
 -- Installing: T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/WindowsExperimental.sdk/usr/lib/swift_static/windows/x86_64/libswift_StringProcessing.lib

@edymtt
Copy link
Contributor Author

edymtt commented Jun 30, 2025

All the phases that target for WindowsExperimental.sdk and AndroidExperimental.sdk seem to build static content under usr/lib/swift_static (except the shims), and I don't see any mention of that path in either android.wxs or windows.wxs

@edymtt edymtt merged commit 5246be5 into swiftlang:main Jul 1, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants