Add CMake build of SwiftPM dependencies #5233
Open
+208
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building this project as a SwiftPM package on Windows requires first building a few dependencies as CMake projects (zlib, libxml, and curl). On Linux this is not required because these projects ship with the OS, but on Windows they don't ship with the OS or the toolchain. Normally, you must build each project manually with CMake and point the SwiftPM build at the build products via environment variables. This adds a new CMake option to the swift-corelibs-foundation project that, instead of building SCL-F itself via CMake, it checks out and builds these 3 dependencies via CMake and outputs the commands to run to set the appropriate environment variables. This CMake option can be triggered via a slightly modified version of the normal CMake build command:
At the end, the command will print and output like the following:
After running the
set
commands, you can runswift test
in this repo on Windows and it will build successfully.