From 6eeef12849da8ba4bda424ece33d92f894de8100 Mon Sep 17 00:00:00 2001 From: Kuba Mracek Date: Thu, 23 May 2024 17:35:27 -0700 Subject: [PATCH] [embedded] Add a embedded-libraries CMake target to simplify the test dependencies --- stdlib/public/CMakeLists.txt | 4 ++++ stdlib/public/Concurrency/CMakeLists.txt | 3 ++- stdlib/public/Platform/CMakeLists.txt | 3 ++- stdlib/public/Synchronization/CMakeLists.txt | 3 ++- stdlib/public/Volatile/CMakeLists.txt | 3 ++- stdlib/public/core/CMakeLists.txt | 3 ++- stdlib/public/stubs/Unicode/CMakeLists.txt | 3 ++- test/CMakeLists.txt | 18 ++---------------- 8 files changed, 18 insertions(+), 22 deletions(-) diff --git a/stdlib/public/CMakeLists.txt b/stdlib/public/CMakeLists.txt index 0a55de291df6b..50d77e1c00355 100644 --- a/stdlib/public/CMakeLists.txt +++ b/stdlib/public/CMakeLists.txt @@ -167,6 +167,10 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF") set(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB FALSE) endif() +if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) + add_custom_target(embedded-libraries ALL) +endif() + set(EMBEDDED_STDLIB_TARGET_TRIPLES) if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING) diff --git a/stdlib/public/Concurrency/CMakeLists.txt b/stdlib/public/Concurrency/CMakeLists.txt index 97829dec24a2e..8b0707b096703 100644 --- a/stdlib/public/Concurrency/CMakeLists.txt +++ b/stdlib/public/Concurrency/CMakeLists.txt @@ -186,7 +186,8 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF") set(SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENCY FALSE) endif() if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENCY) - add_custom_target(embedded-concurrency ALL) + add_custom_target(embedded-concurrency) + add_dependencies(embedded-libraries embedded-concurrency) set(SWIFT_ENABLE_REFLECTION OFF) set(SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT OFF) diff --git a/stdlib/public/Platform/CMakeLists.txt b/stdlib/public/Platform/CMakeLists.txt index 7e709923ffcd0..14754a5d67ae3 100644 --- a/stdlib/public/Platform/CMakeLists.txt +++ b/stdlib/public/Platform/CMakeLists.txt @@ -81,7 +81,8 @@ add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) set(SWIFT_ENABLE_REFLECTION OFF) - add_custom_target(embedded-darwin ALL) + add_custom_target(embedded-darwin) + add_dependencies(embedded-libraries embedded-darwin) foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES}) string(REGEX REPLACE "[ \t]+" ";" list "${entry}") list(GET list 0 arch) diff --git a/stdlib/public/Synchronization/CMakeLists.txt b/stdlib/public/Synchronization/CMakeLists.txt index 88cc673522ad1..f552056a34e41 100644 --- a/stdlib/public/Synchronization/CMakeLists.txt +++ b/stdlib/public/Synchronization/CMakeLists.txt @@ -134,7 +134,8 @@ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES # i.e. there is no .o or .a file produced (no binary code is actually produced) # and only users of a library are going to actually compile any needed code. if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) - add_custom_target(embedded-synchronization ALL) + add_custom_target(embedded-synchronization) + add_dependencies(embedded-libraries embedded-synchronization) foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES}) string(REGEX REPLACE "[ \t]+" ";" list "${entry}") diff --git a/stdlib/public/Volatile/CMakeLists.txt b/stdlib/public/Volatile/CMakeLists.txt index f728b215ee302..3f890e5768c4e 100644 --- a/stdlib/public/Volatile/CMakeLists.txt +++ b/stdlib/public/Volatile/CMakeLists.txt @@ -22,7 +22,8 @@ add_swift_target_library(swift_Volatile ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_S ) if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) - add_custom_target(embedded-volatile ALL) + add_custom_target(embedded-volatile) + add_dependencies(embedded-libraries embedded-volatile) foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES}) string(REGEX REPLACE "[ \t]+" ";" list "${entry}") list(GET list 0 arch) diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt index fe3ee513a19f0..7616a3636cac4 100644 --- a/stdlib/public/core/CMakeLists.txt +++ b/stdlib/public/core/CMakeLists.txt @@ -413,7 +413,8 @@ add_swift_target_library(swiftCore # i.e. there is no .o or .a file produced (no binary code is actually produced) # and only users of a library are going to actually compile any needed code. if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) - add_custom_target(embedded-stdlib ALL) + add_custom_target(embedded-stdlib) + add_dependencies(embedded-libraries embedded-stdlib) set(SWIFT_ENABLE_REFLECTION OFF) set(SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT OFF) diff --git a/stdlib/public/stubs/Unicode/CMakeLists.txt b/stdlib/public/stubs/Unicode/CMakeLists.txt index 815b213f1c15a..4c12899bc0bb5 100644 --- a/stdlib/public/stubs/Unicode/CMakeLists.txt +++ b/stdlib/public/stubs/Unicode/CMakeLists.txt @@ -1,7 +1,8 @@ # Embedded Swift Unicode library if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) - add_custom_target(embedded-unicode ALL) + add_custom_target(embedded-unicode) + add_dependencies(embedded-libraries embedded-unicode) foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES}) string(REGEX REPLACE "[ \t]+" ";" list "${entry}") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 94ab3d0980f21..5d4f186f08ed8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -320,22 +320,8 @@ foreach(SDK ${SWIFT_SDKS}) endif() endif() - if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) - if(TARGET "embedded-stdlib") - list(APPEND test_dependencies "embedded-stdlib") - endif() - if(TARGET "embedded-darwin") - list(APPEND test_dependencies "embedded-darwin") - endif() - if(TARGET "embedded-concurrency") - list(APPEND test_dependencies "embedded-concurrency") - endif() - if(TARGET "embedded-synchronization") - list(APPEND test_dependencies "embedded-synchronization") - endif() - if(TARGET "embedded-volatile") - list(APPEND test_dependencies "embedded-volatile") - endif() + if(TARGET "embedded-libraries") + list(APPEND test_dependencies "embedded-libraries") endif() if(NOT "${COVERAGE_DB}" STREQUAL "")