Skip to content

Commit 7bd77a4

Browse files
kateinoigakukunrintaro
authored andcommitted
build: fallback BOOTSTRAPPING_MODE before the first use
`BOOTSTRAPPING_MODE` was used for configuring `SWIFT_ENABLE_ARRAY_COW_CHECKS` before it's fully fixed. (cherry picked from commit 06bffb9)
1 parent 25c259b commit 7bd77a4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

CMakeLists.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,24 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS" OR SWIFT_SWIFT_PARSER)
844844
set(SWIFT_EXEC_FOR_SWIFT_MODULES "${CMAKE_Swift_COMPILER}")
845845
endif()
846846

847+
# When we have the early SwiftSyntax build, we can include its parser.
848+
if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
849+
set(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS
850+
${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
851+
if(NOT EXISTS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}")
852+
message(STATUS "Skipping Swift Swift parser integration due to missing early SwiftSyntax")
853+
else()
854+
set(SWIFT_SWIFT_PARSER TRUE)
855+
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})
856+
857+
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
858+
# Only "HOSTTOOLS" is supported in Linux when Swift parser integration is enabled.
859+
message(WARNING "Force setting BOOTSTRAPPING=HOSTTOOLS because Swift parser integration is enabled")
860+
set(BOOTSTRAPPING_MODE "HOSTTOOLS")
861+
endif()
862+
endif()
863+
endif()
864+
847865
if(BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|.*-WITH-HOSTLIBS")
848866
if(SWIFT_ENABLE_ARRAY_COW_CHECKS)
849867
message(STATUS "array COW checks disabled when building the swift modules with host libraries")
@@ -950,24 +968,6 @@ if(XCODE)
950968
set(SWIFT_SDKS "OSX")
951969
endif()
952970

953-
# When we have the early SwiftSyntax build, we can include its parser.
954-
if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
955-
set(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS
956-
${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
957-
if(NOT EXISTS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}")
958-
message(STATUS "Skipping Swift Swift parser integration due to missing early SwiftSyntax")
959-
else()
960-
set(SWIFT_SWIFT_PARSER TRUE)
961-
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})
962-
963-
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
964-
# Only "HOSTTOOLS" is supported in Linux when Swift parser integration is enabled.
965-
message(WARNING "Force setting BOOTSTRAPPING=HOSTTOOLS because Swift parser integration is enabled")
966-
set(BOOTSTRAPPING_MODE "HOSTTOOLS")
967-
endif()
968-
endif()
969-
endif()
970-
971971

972972
# FIXME: the parameters we specify in SWIFT_SDKS are lacking architecture specifics,
973973
# so we need to hard-code it. For example, the SDK for Android is just 'ANDROID',

0 commit comments

Comments
 (0)