[cmake] Allow overriding SwiftCompilerSources arguments from CMake. #70134
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.
The calculated arguments for compiling the SwiftCompilerSources works in the cases where the sysroot of the machine building the code is
/
or can be provided as a single directory inSWIFT_SDK_<HOST>_<ARCH>_PATH
. For some cases in which a sysroot is split into multiple directories or in some cross-compiling scenarios where the SDK layout is beyond our control, we can provide more flexibility in the build system.The changes in this commit moves the calculations around the SDK and libc++ outside the
add_swift_compiler_modules_library
, since they do not depend on the inputs. Some calculations relative to-resource-dir
depend on the Swift compiler path, which cannot be moved outside the function.The calculations outside the function are stored in a cached variable, which is later used in the function. If the need arise, anyone can provide a custom value for that variable in their CMake invocation or cache files adapted for their specific case and override the automatically calculated default.
I also rewrote a couple of
set(list ${list} …)
intolist(APPEND list …)
.This should be NFC for the Swift CI, because no value of
SWIFT_COMPILER_SOURCES_SDK_FLAGS
is provided, and the default should be the same value as before.