-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Build-Script]: Extend Swift cmake options #81364
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-Script]: Extend Swift cmake options #81364
Conversation
@AnthonyLatsis, this should help simplify #81284. |
@swift-ci please test |
preset=bootstrap_stage0 |
Bootstrap preset failed with unrelated failure:
|
The existing swift-cmake-options flag overwrites all flags computed by build-script. Sometimes it is useful to be able to append additional CMake flags without overwriting the existing flags. This patch adds `--extra-swift-cmake-options` that adds the specified flags to the Swift CMake configuration instead of overwriting them. This also adds a similar `--extra-llvm-cmake-options`, which adds the new flags to the end, allowing one to replace and overwrite CMake flags that build-script computed. Due to the parameter passing mechanisms in build-script-impl, while this behavior would be useful for Swift, it is not immediately apparent how one would best implement this at this time.
9269b5a
to
004a738
Compare
@swift-ci please test |
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.
Awesome, thank you!
The existing
swift-cmake-options
flag overwrites all flags computed by build-script
Where does this happen? They appear to be added to the front here:
Lines 1604 to 1609 in 78234e2
# Add any specific cmake options specified by build-script | |
product_cmake_options_name=$(to_varname "${product%%_*}")_CMAKE_OPTIONS | |
product_cmake_options=(${!product_cmake_options_name}) # convert to array | |
cmake_options+=("${product_cmake_options[@]}") | |
Some of the options are computed in swift.py inside of the Python bits of build-script. Those are passed to build-script-impl via the build-script-impl only picks up the last instance of a flag, so that's the one we see. e.g
results in a build-script-impl invocation with the following flags:
While I don't mind the idea of fixing that so that swift.py merges all of the flags and build-script (python) doesn't pass |
I see, thanks for clarifying. |
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.
Thanks a lot for this improvement! Looking forward to adopt it in a fix I need for the compiler-rt logic.
The existing
swift-cmake-options
flag overwrites all flags computed by build-script. Sometimes it is useful to be able to append additional CMake flags without overwriting the existing flags. This patch adds--extra-swift-cmake-options
that adds the specified flags to the Swift CMake configuration instead of overwriting them.This also adds a similar
--extra-llvm-cmake-options
, which adds the new flags to the end, allowing one to replace and overwrite CMake flags that build-script computed.Due to the parameter passing mechanisms in build-script-impl, while this behavior would be useful for Swift, it is not immediately apparent how one would best implement this at this time.