Skip to content

Commit 7239481

Browse files
committed
CMake: add Observation dependency to libraries that import Foundation...
when building for Apple platforms. In this scenario we are not building our own Foundation, but we are importing the one from the underlying SDK -- this in turns requires Observation, which is something we typically build. Addresses rdar://162286123
1 parent 1ae8ef0 commit 7239481

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

stdlib/private/StdlibUnicodeUnittest/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
set(swift_stdlib_unittest_compile_flags)
22

3+
if(SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION)
4+
# This library imports Foundation from the SDK, which re-exports
5+
# Observation which is part of this build.
6+
list(APPEND swift_stdlib_unicode_unittest_darwin_dependencies Observation)
7+
endif()
8+
39
add_swift_target_library(swiftStdlibUnicodeUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
410
# This file should be listed the first. Module name is inferred from the
511
# filename.
@@ -10,6 +16,12 @@ add_swift_target_library(swiftStdlibUnicodeUnittest ${SWIFT_STDLIB_LIBRARY_BUILD
1016
WordBreaking.swift
1117

1218
SWIFT_MODULE_DEPENDS StdlibUnittest
19+
SWIFT_MODULE_DEPENDS_IOS ${swift_stdlib_unicode_unittest_darwin_dependencies}
20+
SWIFT_MODULE_DEPENDS_OSX ${swift_stdlib_unicode_unittest_darwin_dependencies}
21+
SWIFT_MODULE_DEPENDS_TVOS ${swift_stdlib_unicode_unittest_darwin_dependencies}
22+
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_stdlib_unicode_unittest_darwin_dependencies}
23+
SWIFT_MODULE_DEPENDS_XROS ${swift_stdlib_unicode_unittest_darwin_dependencies}
24+
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_stdlib_unicode_unittest_darwin_dependencies}
1325
SWIFT_MODULE_DEPENDS_ANDROID Android
1426
SWIFT_MODULE_DEPENDS_LINUX Glibc
1527
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl

stdlib/private/StdlibUnittest/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
99
list(APPEND swift_stdlib_unittest_darwin_dependencies _Builtin_float)
1010
endif()
1111

12+
if(SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION)
13+
# This library imports Foundation from the SDK, which re-exports
14+
# Observation which is part of this build.
15+
list(APPEND swift_stdlib_unittest_darwin_dependencies Observation)
16+
endif()
17+
1218
set(swift_stdlib_unittest_compile_flags
1319
"-Xfrontend" "-disable-objc-attr-requires-foundation-module")
1420

stdlib/private/StdlibUnittestFoundationExtras/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
if(SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION)
2+
# This library imports Foundation from the SDK, which re-exports
3+
# Observation which is part of this build.
4+
list(APPEND swift_stdlib_unittest_foundationextras_darwin_dependencies Observation)
5+
endif()
6+
17
add_swift_target_library(swiftStdlibUnittestFoundationExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
28
# This file should be listed the first. Module name is inferred from the
39
# filename.
410
StdlibUnittestFoundationExtras.swift
511
UnavailableFoundationMethodThunks.mm
612

13+
SWIFT_MODULE_DEPENDS_IOS ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
14+
SWIFT_MODULE_DEPENDS_OSX ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
15+
SWIFT_MODULE_DEPENDS_TVOS ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
16+
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
17+
SWIFT_MODULE_DEPENDS_XROS ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
18+
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_stdlib_unittest_foundationextras_darwin_dependencies}
719
SWIFT_MODULE_DEPENDS StdlibUnittest
820
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
921
INSTALL_IN_COMPONENT stdlib-experimental

0 commit comments

Comments
 (0)