Skip to content

Commit fb0a1b9

Browse files
authored
Merge pull request #73870 from kubamracek/embedded-libraries-cmake
[embedded] Add a embedded-libraries CMake target to simplify the test dependencies
2 parents 179a125 + 6eeef12 commit fb0a1b9

File tree

8 files changed

+18
-22
lines changed

8 files changed

+18
-22
lines changed

stdlib/public/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
167167
set(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB FALSE)
168168
endif()
169169

170+
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
171+
add_custom_target(embedded-libraries ALL)
172+
endif()
173+
170174
set(EMBEDDED_STDLIB_TARGET_TRIPLES)
171175

172176
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING)

stdlib/public/Concurrency/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
186186
set(SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENCY FALSE)
187187
endif()
188188
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENCY)
189-
add_custom_target(embedded-concurrency ALL)
189+
add_custom_target(embedded-concurrency)
190+
add_dependencies(embedded-libraries embedded-concurrency)
190191

191192
set(SWIFT_ENABLE_REFLECTION OFF)
192193
set(SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT OFF)

stdlib/public/Platform/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
8181
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
8282
set(SWIFT_ENABLE_REFLECTION OFF)
8383

84-
add_custom_target(embedded-darwin ALL)
84+
add_custom_target(embedded-darwin)
85+
add_dependencies(embedded-libraries embedded-darwin)
8586
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
8687
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")
8788
list(GET list 0 arch)

stdlib/public/Synchronization/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
134134
# i.e. there is no .o or .a file produced (no binary code is actually produced)
135135
# and only users of a library are going to actually compile any needed code.
136136
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
137-
add_custom_target(embedded-synchronization ALL)
137+
add_custom_target(embedded-synchronization)
138+
add_dependencies(embedded-libraries embedded-synchronization)
138139

139140
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
140141
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")

stdlib/public/Volatile/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ add_swift_target_library(swift_Volatile ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_S
2222
)
2323

2424
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
25-
add_custom_target(embedded-volatile ALL)
25+
add_custom_target(embedded-volatile)
26+
add_dependencies(embedded-libraries embedded-volatile)
2627
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
2728
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")
2829
list(GET list 0 arch)

stdlib/public/core/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ add_swift_target_library(swiftCore
413413
# i.e. there is no .o or .a file produced (no binary code is actually produced)
414414
# and only users of a library are going to actually compile any needed code.
415415
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
416-
add_custom_target(embedded-stdlib ALL)
416+
add_custom_target(embedded-stdlib)
417+
add_dependencies(embedded-libraries embedded-stdlib)
417418

418419
set(SWIFT_ENABLE_REFLECTION OFF)
419420
set(SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT OFF)

stdlib/public/stubs/Unicode/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
# Embedded Swift Unicode library
33
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
4-
add_custom_target(embedded-unicode ALL)
4+
add_custom_target(embedded-unicode)
5+
add_dependencies(embedded-libraries embedded-unicode)
56

67
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
78
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")

test/CMakeLists.txt

+2-16
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,8 @@ foreach(SDK ${SWIFT_SDKS})
320320
endif()
321321
endif()
322322

323-
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
324-
if(TARGET "embedded-stdlib")
325-
list(APPEND test_dependencies "embedded-stdlib")
326-
endif()
327-
if(TARGET "embedded-darwin")
328-
list(APPEND test_dependencies "embedded-darwin")
329-
endif()
330-
if(TARGET "embedded-concurrency")
331-
list(APPEND test_dependencies "embedded-concurrency")
332-
endif()
333-
if(TARGET "embedded-synchronization")
334-
list(APPEND test_dependencies "embedded-synchronization")
335-
endif()
336-
if(TARGET "embedded-volatile")
337-
list(APPEND test_dependencies "embedded-volatile")
338-
endif()
323+
if(TARGET "embedded-libraries")
324+
list(APPEND test_dependencies "embedded-libraries")
339325
endif()
340326

341327
if(NOT "${COVERAGE_DB}" STREQUAL "")

0 commit comments

Comments
 (0)