-
Notifications
You must be signed in to change notification settings - Fork 66
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
build: initial support for building with CMake #76
Conversation
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.
Lots of leading newlines that should probably be the license header assuming those are still required.
Do you know if the macro bits are macro-macros, or are they support within Swift-Build for building macros for projects that Swift-Build is building?
SwiftDriver | ||
TSCBasic) | ||
|
||
target_include_directories(SWBMacro PUBLIC |
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.
What is going on here? What bits aren't getting picked up by the linking?
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.
I do not understand why these are not getting picked up. There are two cases where I had to explicitly workaround the target_link_libraries
being insufficient.
I've tested this only on Windows so far with:
|
Thanks, really appreciate your work here! I'll see if I can test this on some of the other platforms |
@owenv I can guarantee that it won't work on Linux at least! The missing piece is the |
I know it's not typical CMake convention, but could we consider using some kind of wildcard pattern to pick up the swift files instead of listing them individually? |
We can't do that reliably. The wild-carding (glob) would be applied at configure time. Any changes after the initial configuration (renaming, removal, addition) would be ignored. |
As noted on the comment above: Globbing source files does not work and frequently causes issues with files being mysteriously omitted from the library when people try: https://discourse.cmake.org/t/cmake-doesnt-register-new-files-when-i-add-new-files Dirtying the CMakeLists.txt file is what tells Ninja/underlying build system that it needs to re-run CMake to get the new definition of the target when doing incremental builds. |
I haven't done any serious CMake work in 10+ years and had some slight hope the situation with wildcards might've improved since then, but I guess we'll just have to deal with the static lists for now. Thanks for confirming. |
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.
I won't claim to be a CMake expert, but this set of changes lgtm
This change now depends on #95. I believe that we are building everything but the tests now. |
002a6f6
to
322ea2d
Compare
@swift-ci please smoke test |
@swift-ci please test |
Add support for building with CMake which is required to get the toolchain bootstrapped. This partially addresses swiftlang#7.
@swift-ci please test |
Okay, this is finally ready. I've built with CMake and SPM locally. SPM's warnings about the unrecognized files are also gone. I think that we can go ahead and get this merged. We cannot enable the CI checks for this yet as this requires an updated toolchain on the Linux builders. That issue can be followed along at swiftlang/swift#79117 |
@swift-ci please test macOS |
Add support for building with CMake which is required to get the toolchain bootstrapped. This partially addresses #7.