Skip to content

[CMake] Replace early swift-syntax with FetchContent #66043

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

Closed
wants to merge 1 commit into from

Conversation

bnbarham
Copy link
Contributor

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.

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please test

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please build toolchain

endif()

set(BUILD_SHARED_LIBS_OLD "${BUILD_SHARED_LIBS}")
set(BUILD_SHARED_LIBS ON)
Copy link
Member

Choose a reason for hiding this comment

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

Can this version of SwiftSyntax be used for building SourceKit-LSP? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally the SwiftSyntax used for LSP and the stress tester would be the one built from the just-built compiler rather than this one.

Copy link
Member

Choose a reason for hiding this comment

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

It should match whatever was used to build the compiler installed in the toolchain.

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 suppose what I should have said was "right now we...". @etcwilde brought up cross-compiling and that's a good point. So... maybe 🤔?

Comment on lines +176 to +183
target_link_directories(${name} PUBLIC
"${SWIFT_HOST_LIBRARIES_DEST_DIR}")
Copy link
Contributor Author

@bnbarham bnbarham May 21, 2023

Choose a reason for hiding this comment

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

This is some difference between lld and ld64. ld64 seems perfectly happy if the shared library is specified on the command line and there's a -l<thatLib> in LC_LINKER_OPTION but lld certainly isn't. It's the same auto linking issue as #64409. We didn't hit this before because we were adding the lib/swift/host from the early swift syntax build directory (and also only people using lld would hit it anyway).

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please clean test

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please clean build toolchain

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please test

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please test

@bnbarham bnbarham force-pushed the fetch-content branch 2 times, most recently from 8d812cc to 92ae57f Compare May 31, 2023 16:29
@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please test

@bnbarham
Copy link
Contributor Author

swiftlang/swift-syntax#1682

@swift-ci please test macOS platform

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.
@bnbarham
Copy link
Contributor Author

@rintaro has taken this over in #68408

@bnbarham bnbarham closed this Sep 27, 2023
@bnbarham bnbarham deleted the fetch-content branch September 27, 2023 04:04
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