Skip to content

Commit e74c829

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 e74c829

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

utils/build-tooling-libs

Lines changed: 16 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 or self.toolchain.swiftc
7071

7172
def call(self, command, env=None, without_sleeping=False):
7273
if without_sleeping:
@@ -172,10 +173,14 @@ 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
]
180+
if self.swiftc:
181+
cmake_args += [
182+
f"-DCMAKE_Swift_COMPILER={self.swiftc}"
183+
]
179184
if isEmbeddedHost:
180185
cmake_args += [
181186
"-DCMAKE_OSX_SYSROOT:PATH=" + xcrun.sdk_path(self.host),
@@ -499,6 +504,16 @@ Example invocations:
499504
default=default_ninja,
500505
help="the path to ninja (default = %s)" % default_ninja,
501506
)
507+
option(
508+
"--swiftc",
509+
store_path,
510+
default=None,
511+
help="""
512+
Override the swiftc compiler used to build SwiftCompilerSources.
513+
This is needed to build the most recent state of main if it uses C++ interop
514+
features that aren't in the host's toolchain yet.
515+
"""
516+
)
502517

503518
parser = optbuilder.build()
504519
args = parser.parse_args()

0 commit comments

Comments
 (0)