Skip to content

Commit 2783443

Browse files
authored
Merge pull request #40106 from eeckstein/fix-bootstrapping-build
cmake: fix some problems related to bootstrapping
2 parents ef10aca + bbef99e commit 2783443

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

libswift/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ else()
4545
DEPENDS "bootstrapping1-all")
4646

4747
if(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
48-
if(EXISTS "${CMAKE_BINARY_DIR}/bootstrapping0/lib/swift/macos/Swift.swiftmodule" OR
49-
EXISTS "${CMAKE_BINARY_DIR}/bootstrapping1/lib/swift/macos/Swift.swiftmodule")
50-
messsage(FATAL_ERROR "Please clean the ${CMAKE_BINARY_DIR}/bootstrapping[01] directories")
51-
endif()
48+
file(GLOB module_dirs "${CMAKE_BINARY_DIR}/bootstrapping*/lib/swift/macosx/*.swiftmodule")
49+
foreach(module_dir ${module_dirs})
50+
message(WARNING "${module_dir} found from a previous 'bootstrapping' build: removing")
51+
file(REMOVE_RECURSE "${module_dir}")
52+
endforeach()
5253
endif()
5354
else()
5455
message(FATAL_ERROR "Unknown LIBSWIFT_BUILD_MODE '${LIBSWIFT_BUILD_MODE}'")

stdlib/public/core/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ endif()
288288
if(SWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING)
289289
list(APPEND swift_stdlib_compile_flags "-enforce-exclusivity=checked")
290290
endif()
291+
set(compile_flags_for_final_build)
291292
if(SWIFT_ENABLE_ARRAY_COW_CHECKS)
292-
list(APPEND swift_stdlib_compile_flags "-DCOW_CHECKS_ENABLED")
293+
list(APPEND compile_flags_for_final_build "-DCOW_CHECKS_ENABLED")
293294
endif()
294295

295296
# STAGING: Temporarily avoids having to write #fileID in Swift.swiftinterface.
@@ -318,16 +319,16 @@ set(swiftCore_common_options
318319
${SWIFTLIB_SOURCES}
319320
GYB_SOURCES
320321
${SWIFTLIB_GYB_SOURCES}
321-
SWIFT_COMPILE_FLAGS
322-
${swift_stdlib_compile_flags} -Xcc -DswiftCore_EXPORTS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
323322
LINK_FLAGS
324323
${swift_core_link_flags}
325324
PRIVATE_LINK_LIBRARIES
326325
${swift_core_private_link_libraries}
327326
INCORPORATE_OBJECT_LIBRARIES
328327
${swift_core_incorporate_object_libraries}
329328
FRAMEWORK_DEPENDS
330-
${swift_core_framework_depends})
329+
${swift_core_framework_depends}
330+
SWIFT_COMPILE_FLAGS
331+
${swift_stdlib_compile_flags} -Xcc -DswiftCore_EXPORTS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS})
331332

332333
# The copy_shim_headers target dependency is required to let the
333334
# build system know that there's a rule to produce the shims
@@ -375,6 +376,7 @@ endif()
375376
add_swift_target_library(swiftCore
376377
${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
377378
${swiftCore_common_options}
379+
${compile_flags_for_final_build}
378380
FILE_DEPENDS
379381
${swiftCore_common_dependencies}
380382
INSTALL_IN_COMPONENT

utils/build-presets.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ skip-test-tvos-host
216216
skip-test-watchos-host
217217
check-incremental-compilation
218218

219+
libswift=bootstrapping-with-hostlibs
220+
219221
[preset: buildbot,tools=R,stdlib=RD,test=non_executable]
220222
mixin-preset=
221223
mixin_buildbot_tools_R_stdlib_RD
@@ -335,6 +337,8 @@ build-subdir=buildbot_incremental
335337
release
336338
assertions
337339

340+
enable-array-cow-checks
341+
338342
build-swift-stdlib-unittest-extra
339343

340344
libcxx

0 commit comments

Comments
 (0)