From e0e418f5d36c48236a6b38c139b7ee4ccadac4a4 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Tue, 7 Jan 2025 14:18:27 -0800 Subject: [PATCH] Enable new stdlib build in macOS smoke tests Fixed an issue in the convenience wrapper that resulted in building all copies of the standard library for the default compiler architecture instead of the desired architecture. To fix this, we pull the desired target triple and deployment target from the existing variables and pass that into the CMake invocation. --- CMakeLists.txt | 14 +++++++++++++- utils/build-presets.ini | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ded05a6626eac..045c7e193b485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1577,6 +1577,7 @@ endif() # New standard library build option(SWIFT_ENABLE_NEW_RUNTIME_BUILD "Build Swift runtimes with new build system" OFF) if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) + message(STATUS "New runtime build enabled") add_custom_target(PopulateRuntimeSourceDir COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Resync.cmake" @@ -1593,6 +1594,12 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) if(${SWIFT_SDK_${sdk}_${arch}_CACHE}) set(stdlib_cache_file_flag -C ${SWIFT_SDK_${sdk}_${arch}_CACHE}) endif() + + set(stdlib_target_triple ${SWIFT_SDK_${sdk}_ARCH_${arch}_TRIPLE}) + if(SWIFT_SDK_${sdk}_DEPLOYMENT_VERSION) + string(APPEND stdlib_target_triple ${SWIFT_SDK_${sdk}_DEPLOYMENT_VERSION}) + endif() + ExternalProject_Add("${stdlib_target}-core" SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Core" # TODO: Add this once we're ready to start swapping out the libraries @@ -1611,8 +1618,13 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_Swift_COMPILER:FILEPATH=$,${CMAKE_Swift_COMPILER},$,swiftc>> -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_Swift_COMPILER_TARGET:STRING=${stdlib_target_triple} + -DCMAKE_C_COMPILER_TARGET:STRING=${stdlib_target_triple} + -DCMAKE_CXX_COMPILER_TARGET:STRING=${stdlib_target_triple} -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} - -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DSwiftCore_PLATFORM_SUBDIR=${SWIFT_SDK_${sdk}_LIB_SUBDIR} + -DSwiftCore_ARCH_SUBDIR=${arch}) if(NOT ${CMAKE_CROSSCOMPILING}) add_dependencies("${stdlib_target}" swift-frontend) endif() diff --git a/utils/build-presets.ini b/utils/build-presets.ini index 2dca31f424f2c..45ffcde0f07aa 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -669,6 +669,8 @@ skip-test-sourcekit-lsp skip-test-swiftpm skip-test-llbuild +swift-cmake-options=-DSWIFT_ENABLE_NEW_RUNTIME_BUILD=YES + [preset: buildbot_incremental,tools=RA,stdlib=RD,smoketest=macosx,flto] mixin-preset=buildbot_incremental,tools=RA,stdlib=RD,smoketest=macosx build-subdir=buildbot_incremental