Skip to content

Commit 692619f

Browse files
committed
[build-tooling-libs] Add option to specify the swiftc compiler to build compiler sources
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.
1 parent 57807fb commit 692619f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

utils/build-tooling-libs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class Builder(object):
6767
self.host = host
6868
self.arch = arch
6969
self.native_build_dir = native_build_dir
70+
self.swiftc = args.swiftc
7071

7172
def call(self, command, env=None, without_sleeping=False):
7273
if without_sleeping:
@@ -172,7 +173,7 @@ class Builder(object):
172173
"-DSWIFT_HOST_VARIANT_SDK=" + host_sdk,
173174
"-DSWIFT_HOST_VARIANT_ARCH=" + self.arch,
174175
"-DCMAKE_Swift_COMPILER_TARGET=" + host_triple,
175-
"-DCMAKE_Swift_COMPILER=" + self.toolchain.swiftc,
176+
"-DCMAKE_Swift_COMPILER=" + self.swiftc,
176177
"-DCMAKE_C_FLAGS=" + llvm_c_flags,
177178
"-DCMAKE_CXX_FLAGS=" + llvm_c_flags,
178179
]
@@ -400,6 +401,7 @@ Example invocations:
400401
defaults.DARWIN_INSTALL_PREFIX if isDarwin else defaults.UNIX_INSTALL_PREFIX
401402
)
402403
default_ninja = toolchain.ninja
404+
default_swiftc = toolchain.swiftc
403405

404406
option("--release", store_true, help="build in release mode")
405407
option(
@@ -499,6 +501,16 @@ Example invocations:
499501
default=default_ninja,
500502
help="the path to ninja (default = %s)" % default_ninja,
501503
)
504+
option(
505+
"--swiftc",
506+
store_path,
507+
default=default_swiftc,
508+
help="""
509+
Override the swiftc compiler used to build SwiftCompilerSources.
510+
This is needed to build the most recent state of main if it uses C++ interop
511+
features that aren't in the host's toolchain yet. (default = %s)
512+
""" % default_swiftc
513+
)
502514

503515
parser = optbuilder.build()
504516
args = parser.parse_args()

0 commit comments

Comments
 (0)