Skip to content

[build-tooling-libs] Add option to specify the swiftc compiler to build compiler sources #60362

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion utils/build-tooling-libs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Builder(object):
self.host = host
self.arch = arch
self.native_build_dir = native_build_dir
self.swiftc_path = args.swiftc_path

def call(self, command, env=None, without_sleeping=False):
if without_sleeping:
Expand Down Expand Up @@ -172,7 +173,7 @@ class Builder(object):
"-DSWIFT_HOST_VARIANT_SDK=" + host_sdk,
"-DSWIFT_HOST_VARIANT_ARCH=" + self.arch,
"-DCMAKE_Swift_COMPILER_TARGET=" + host_triple,
"-DCMAKE_Swift_COMPILER=" + self.toolchain.swiftc,
"-DCMAKE_Swift_COMPILER=" + self.swiftc_path,
"-DCMAKE_C_FLAGS=" + llvm_c_flags,
"-DCMAKE_CXX_FLAGS=" + llvm_c_flags,
]
Expand Down Expand Up @@ -400,6 +401,7 @@ Example invocations:
defaults.DARWIN_INSTALL_PREFIX if isDarwin else defaults.UNIX_INSTALL_PREFIX
)
default_ninja = toolchain.ninja
default_swiftc = toolchain.swiftc

option("--release", store_true, help="build in release mode")
option(
Expand Down Expand Up @@ -499,6 +501,16 @@ Example invocations:
default=default_ninja,
help="the path to ninja (default = %s)" % default_ninja,
)
option(
"--swiftc-path",
store_path,
default=default_swiftc,
help="""
Override the swiftc compiler used to build SwiftCompilerSources.
This is needed to build the most recent state of main if it uses C++ interop
features that aren't in the host's toolchain yet. (default = %s)
""" % default_swiftc
)

parser = optbuilder.build()
args = parser.parse_args()
Expand Down