-
Notifications
You must be signed in to change notification settings - Fork 344
Fix CMake build on Linux #238
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
@swift-ci please test platform |
ping @natecook1000 |
@swift-ci Please test |
@gmittert Thanks for the contribution! I don't think our CI testing exercises the CMake build path yet — can you tell me the configuration where you're seeing this go wrong, so that I can verify locally? |
@compnerd Would you mind giving this a review? |
@@ -5,4 +5,4 @@ set_target_properties(ArgumentParserTestHelpers PROPERTIES | |||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) | |||
target_link_libraries(ArgumentParserTestHelpers PUBLIC | |||
ArgumentParser | |||
XCTest) | |||
XCTest Foundation) |
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.
Nit: would be nice to do one entry per line
CMakeLists.txt
Outdated
find_package(XCTest QUIET) | ||
find_package(dispatch QUIET CONFIG REQUIRED) | ||
find_package(Foundation QUIET CONFIG REQUIRED) | ||
find_package(XCTest QUIET CONFIG REQUIRED) |
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'm worried about this part of the change. With this it is impossible to actually build with a prebuilt toolchain image. The CONFIG
is fine, the REQUIRED
is the piece that worries me.
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'll remove both the QUIET and the REQUIRED then. My main concern was that it was silently failing and was a pain to debug why.
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.
The thing is that it isn't an absolutely required thing - so the non QUIET
form could be confusing too. But I would be fine with it being non-quiet as long as it is not required.
@natecook1000 The precise invocation I use is a little complex since we have a lot of infrastructure to support cross compiling so I'm unfortunately not able to give you a command to run, but it's something like:
But really the important part is configuring via setting Xyz_DIR to locally build projects instead of building against a prebuilt toolchain. |
- TestHelpers has a implicit dependency on Foundation through ArgumentParser, so it needs to link against Foundation - The find package calls should be REQUIRED and CONFIG so they can take advantage of CMake configs
@gmittert - most of that is specific to the setup that you are building in. (e.g. the caches). I think that it is probably easier to explain with the CI I have setup on Azure (https://github.com/compnerd/swift-build/blob/master/swift-argument-parser.yml)
This is Windows specific, but very easy to generalize to other platforms. The important thing is to use a swift compiler from a swift build tree rather than than from an installed image. |
Alright, updated the line spacing and removed REQUIRED. @compnerd exactly, my particular set up isn't particularly optimized for external reproducibility, but the important part is building against locally built dependencies a la the Windows build. |
@swift-ci please test platform |
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.
LGTM
Thanks to you both! @swift-ci Please test |
ArgumentParser, so it needs to link against Foundation
advantage of CMake configs
Checklist