Skip to content

Commit 4383610

Browse files
committed
cmake: some fixes for the libswift bootstrapping build
* fix a typo which prevented linking the right bootstrapping libs * build swiftDarwin for bootstrapping * disable COW checks if built with bootstrapping-with-hostlibs
1 parent 6f34844 commit 4383610

File tree

3 files changed

+53
-19
lines changed

3 files changed

+53
-19
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,13 @@ elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING" OR LIBSWIFT_BUILD_MODE STREQ
605605
set(SWIFT_EXEC_FOR_LIBSWIFT "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
606606
endif()
607607

608+
if(LIBSWIFT_BUILD_MODE STREQUAL "HOSTTOOLS" OR LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
609+
if(SWIFT_ENABLE_ARRAY_COW_CHECKS)
610+
message(STATUS "array COW checks disabled when building libswift with host libraries")
611+
set(SWIFT_ENABLE_ARRAY_COW_CHECKS FALSE)
612+
endif()
613+
endif()
614+
608615
# This setting causes all CMakeLists.txt to automatically have
609616
# ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CURRENT_SOURCE_DIR} as an
610617
# include_directories path. This is done for developer

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ function(add_swift_host_tool executable)
910910
911911
# At build time link against the built swift libraries from the
912912
# previous bootstrapping stage.
913-
get_bootstrapping_swift_lib_dir(bs_lib_dir "${bootstrapping}")
913+
get_bootstrapping_swift_lib_dir(bs_lib_dir "${ASHT_BOOTSTRAPPING}")
914914
target_link_directories(${executable} PRIVATE ${bs_lib_dir})
915915
916916
# At runtime link against the built swift libraries from the current
@@ -979,7 +979,7 @@ function(add_swift_host_tool executable)
979979
elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING")
980980
# At build time link against the built swift libraries from the
981981
# previous bootstrapping stage.
982-
get_bootstrapping_swift_lib_dir(bs_lib_dir "${bootstrapping}")
982+
get_bootstrapping_swift_lib_dir(bs_lib_dir "${ASHT_BOOTSTRAPPING}")
983983
target_link_directories(${executable} PRIVATE ${bs_lib_dir})
984984
985985
# At runtime link against the built swift libraries from the current

stdlib/public/Platform/CMakeLists.txt

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,54 @@ set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS)
2020
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "apple")
2121
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS FREESTANDING)
2222
endif()
23-
add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
24-
${swift_platform_sources}
25-
POSIXError.swift
26-
MachError.swift
2723

28-
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
24+
set(swiftDarwin_common_options
25+
IS_SDK_OVERLAY
26+
${swift_platform_sources}
27+
POSIXError.swift
28+
MachError.swift
2929

30-
GYB_SOURCES
31-
${swift_platform_gyb_sources}
32-
Darwin.swift.gyb
30+
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
3331

34-
SWIFT_COMPILE_FLAGS
35-
${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}
36-
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
37-
-Xfrontend -disable-objc-attr-requires-foundation-module
38-
${swift_platform_compile_flags}
39-
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
40-
TARGET_SDKS "${swiftDarwin_target_sdks}"
41-
INSTALL_IN_COMPONENT sdk-overlay
32+
GYB_SOURCES
33+
${swift_platform_gyb_sources}
34+
Darwin.swift.gyb
4235

43-
DEPENDS ${darwin_depends})
36+
SWIFT_COMPILE_FLAGS
37+
${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}
38+
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
39+
-Xfrontend -disable-objc-attr-requires-foundation-module
40+
${swift_platform_compile_flags}
41+
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
42+
DEPENDS ${darwin_depends})
43+
44+
45+
if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING")
46+
47+
set(swiftDarwin_common_bootstrapping_options
48+
${swiftDarwin_common_options}
49+
SHARED
50+
IS_STDLIB
51+
SDK ${SWIFT_HOST_VARIANT_SDK}
52+
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
53+
INSTALL_IN_COMPONENT "never_install")
54+
55+
add_swift_target_library_single(swiftDarwin-bootstrapping0 swiftDarwin
56+
${swiftDarwin_common_bootstrapping_options}
57+
BOOTSTRAPPING 0)
58+
59+
add_swift_target_library_single(swiftDarwin-bootstrapping1 swiftDarwin
60+
${swiftDarwin_common_bootstrapping_options}
61+
BOOTSTRAPPING 1)
62+
63+
add_dependencies(bootstrapping1-all swiftDarwin-bootstrapping1)
64+
add_dependencies(bootstrapping0-all swiftDarwin-bootstrapping0)
65+
endif()
66+
67+
add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
68+
${swiftDarwin_common_options}
69+
TARGET_SDKS "${swiftDarwin_target_sdks}"
70+
INSTALL_IN_COMPONENT sdk-overlay)
4471

4572
set(swiftGlibc_target_sdks ANDROID CYGWIN FREEBSD OPENBSD LINUX HAIKU)
4673
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "linux")

0 commit comments

Comments
 (0)