-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CMake] Replace early swift-syntax with FetchContent #68408
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
swiftlang/llvm-project#7424 |
be56a21
to
1608a93
Compare
swiftlang/llvm-project#7424 |
swiftlang/llvm-project#7424 |
Spurred by #68401, I started looking into cross-compiling swift-syntax for the native Android compiler, only to find early-swift-syntax doesn't support cross-compilation. With a tweak or two to this pull, I think it can be made to work: is that the plan? Because I don't know about macOS, but the recent shipping of swift-syntax with the linux Swift compiler means that cross-compiling the toolchain is currently broken on Unix platforms, ie swift-syntax won't be cross-compiled. Also, any plans to backport this pull to 5.9? |
1608a93
to
d9f1538
Compare
swiftlang/llvm-project#7424 |
swiftlang/llvm-project#7424 |
swiftlang/llvm-project#7424 |
d9f1538
to
89b217a
Compare
swiftlang/llvm-project#7424 |
89b217a
to
8a73327
Compare
swiftlang/llvm-project#7424 |
swiftlang/llvm-project#7424 |
Use FetchContent to include swift-syntax directly in swift. This can be thought of as an `add_subdirectory` for a directory outside the root. The default build directory will be `_deps/swiftsyntax-subbuild/`, though the modules and shared libraries will be built in `lib/swift/host` by passing down `SWIFT_HOST_LIBRARIES_DEST_DIR` to avoid copying them as we were doing previously.
And pass the value to 'swift-syntax', so they gets correct deployment target.
This used to overwrite the RUNPATH when copying libraries from earlyswiftsyntax directory. Since earlyswiftsyntax is now replaced with FetchContent, we don't need this anymore
So that swift-syntax host libraries can be installed independently.
'--install-swift-syntax' is now a sugar of '--install-swift --swift-install-component=swift-syntax-lib'
8a73327
to
1dfc10e
Compare
swiftlang/llvm-project#7424 |
swiftlang/llvm-project#7424 |
1 similar comment
swiftlang/llvm-project#7424 |
The main motivation of this PR is that single
I cannot promise anything, but I personally want this in 5.9 too. |
cmake/modules/AddPureSwift.cmake
Outdated
MACCATALYST_BUILD_FLAVOR "" | ||
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}") | ||
|
||
swift_get_host_triple(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just use SWIFT_HOST_TRIPLE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
I got the flags added locally to cross-compile this and the regex parser, will submit that once this is in. I've also backported this to 5.9, along with #68401. Since that adds more checks of |
* Move the logic to right before include(lib) because swift-syntax is a "lib" * Use function to limit the scope of variables for FetchContent * Use standard 'CMAKE_*_OUTPUT_DIRECTORY' instead of custom variable names.
Instead of calling 'get_swift_host_triple()' repeatedly, because it always return the same value.
The argument list handling was a hack and confusing.
swiftlang/llvm-project#7424 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
swiftlang/llvm-project#7424 |
[CMake] Replace early swift-syntax with FetchContent (cherry picked from commit 8dbde04) Conflicts: lib/Frontend/PrintingDiagnosticConsumer.cpp lib/Parse/ParseType.cpp
[CMake] Replace early swift-syntax with FetchContent (cherry picked from commit 8dbde04)
[CMake] Replace early swift-syntax with FetchContent (cherry picked from commit 8dbde04) Conflicts: lib/Frontend/PrintingDiagnosticConsumer.cpp lib/Parse/ParseType.cpp
Use FetchContent to include swift-syntax directly in swift. This can be thought of as an add_subdirectory for a directory outside the root.
The default build directory will be _deps/swiftsyntax-subbuild/, though the modules and shared libraries will be built in lib/swift/host by passing down SWIFT_HOST_LIBRARIES_DEST_DIR to avoid copying them as we were doing previously.