Skip to content

Commit ba1b3c6

Browse files
committed
[ToolingLibs] Build tooling libs with libswift
* In CMakeLists.txt, use `CMAKE_Swift_COMPILER` to build SwiftCompilerModuels when `BOOTSTRAPPING_MODE` is `HOSTTOOLS` * in `utils/build-tooling-libs`, specify necessary CMake options to enable libswift integration
1 parent 60860c2 commit ba1b3c6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ set(SWIFT_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
730730
set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
731731
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
732732
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
733+
# This is the normal case. We are not cross-compiling.
733734
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
734735
set(SWIFT_EXEC_FOR_SWIFT_MODULES "${CMAKE_Swift_COMPILER}")
735736
elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
@@ -744,6 +745,12 @@ elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
744745
else()
745746
set(BOOTSTRAPPING_MODE "HOSTTOOLS")
746747
endif()
748+
elseif(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
749+
# We are building using a pre-installed host toolchain but not bootstrapping
750+
# the Swift modules. This happens when building using 'build-tooling-libs'
751+
# where we haven't built a new Swift compiler. Use the Swift compiler from the
752+
# pre-installed host toolchain to build the Swift modules.
753+
set(SWIFT_EXEC_FOR_SWIFT_MODULES "${CMAKE_Swift_COMPILER}")
747754
endif()
748755

749756
if(BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|.*-WITH-HOSTLIBS")

utils/build-tooling-libs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class Builder(object):
172172
"-DSWIFT_HOST_VARIANT_SDK=" + host_sdk,
173173
"-DSWIFT_HOST_VARIANT_ARCH=" + self.arch,
174174
"-DCMAKE_Swift_COMPILER_TARGET=" + host_triple,
175+
"-DCMAKE_Swift_COMPILER=" + self.toolchain.swiftc,
175176
"-DCMAKE_C_FLAGS=" + llvm_c_flags,
176177
"-DCMAKE_CXX_FLAGS=" + llvm_c_flags,
177178
]
@@ -262,6 +263,13 @@ class Builder(object):
262263
"-DCLANG_INCLUDE_TESTS=FALSE",
263264
"-DSWIFT_INCLUDE_TESTS=FALSE",
264265
]
266+
cmake_args += [
267+
"-DBOOTSTRAPPING_MODE=HOSTTOOLS",
268+
"-DEXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR=" +
269+
os.path.join(SWIFT_SOURCE_ROOT,
270+
"swift-experimental-string-processing"),
271+
]
272+
265273
llvm_src_path = os.path.join(SWIFT_SOURCE_ROOT, "llvm") \
266274
if isSwiftContainedInLLVMProject \
267275
else os.path.join(SWIFT_SOURCE_ROOT, "llvm-project", "llvm")

0 commit comments

Comments
 (0)