Skip to content

Commit 1302449

Browse files
authored
Merge pull request #3411 from compnerd/target-sdk-aliases-and-exclusions
Target sdk aliases and exclusions
2 parents 9b9bcdd + 65fd24d commit 1302449

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,8 @@ function(add_swift_library name)
11111111
if("${SWIFTLIB_TARGET_SDKS}" STREQUAL "")
11121112
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS})
11131113
endif()
1114+
list_replace(SWIFTLIB_TARGET_SDKS ALL_POSIX_PLATFORMS "ALL_APPLE_PLATFORMS;ANDROID;CYGWIN;FREEBSD;LINUX")
1115+
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "IOS;IOS_SIMULATOR;TVOS;TVOS_SIMULATOR;WATCHOS;WATCHOS_SIMULATOR;OSX")
11141116

11151117
# All Swift code depends on the standard library, except for the standard
11161118
# library itself.

cmake/modules/SwiftList.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,15 @@ function(_list_escape_for_shell input_list result_var_name)
4848
set("${result_var_name}" "${result}" PARENT_SCOPE)
4949
endfunction()
5050

51+
function(list_replace input_list old new)
52+
set(replaced_list)
53+
foreach(item ${${input_list}})
54+
if(${item} STREQUAL ${old})
55+
list(APPEND replaced_list ${new})
56+
else()
57+
list(APPEND replaced_list ${item})
58+
endif()
59+
endforeach()
60+
set("${input_list}" "${replaced_list}" PARENT_SCOPE)
61+
endfunction()
62+

stdlib/private/StdlibCollectionUnittest/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
99
Foundation)
1010
endif()
1111

12+
# TODO: support this on non-POSIX platforms. It cannot be currently as it
13+
# depends on pthreads.
1214
add_swift_library(swiftStdlibCollectionUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
1315
# This file should be listed the first. Module name is inferred from the
1416
# filename.
@@ -28,6 +30,7 @@ add_swift_library(swiftStdlibCollectionUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYP
2830

2931
SWIFT_MODULE_DEPENDS StdlibUnittest
3032
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags}
33+
TARGET_SDKS ALL_POSIX_PLATFORMS
3134
FRAMEWORK_DEPENDS ${swift_stdlib_unittest_framework_depends}
3235
INSTALL_IN_COMPONENT stdlib-experimental)
3336

stdlib/private/StdlibUnittest/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
1414
list(APPEND swift_stdlib_unittest_framework_depends Foundation)
1515
endif()
1616

17+
# TODO: support this on non-POSIX platforms. It cannot be currently as it
18+
# depends on pthreads.
1719
add_swift_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
1820
# This file should be listed the first. Module name is inferred from the
1921
# filename.
@@ -40,6 +42,7 @@ add_swift_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STD
4042
SWIFT_MODULE_DEPENDS_LINUX Glibc
4143
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
4244
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags}
45+
TARGET_SDKS ALL_POSIX_PLATFORMS
4346
FRAMEWORK_DEPENDS ${swift_stdlib_unittest_framework_depends}
4447
INSTALL_IN_COMPONENT stdlib-experimental)
4548

stdlib/private/SwiftPrivatePthreadExtras/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ add_swift_library(swiftSwiftPrivatePthreadExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TY
1111
SWIFT_MODULE_DEPENDS_LINUX Glibc
1212
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
1313
SWIFT_COMPILE_FLAGS ${STDLIB_SIL_SERIALIZE_ALL}
14+
TARGET_SDKS ALL_POSIX_PLATFORMS
1415
INSTALL_IN_COMPONENT stdlib-experimental)
1516

0 commit comments

Comments
 (0)