Skip to content

Commit 83daa49

Browse files
committed
[CMake] Only build StdlibUnittest when SDK overlay is built
On Linux it used to be possible to build only the stdlib, without the SDK overlays, like so: ``` utils/build-script -- --build-swift-stdlib --build-swift-sdk-overlay=0 ``` However this invocation now results in the following error: ``` + /usr/bin/cmake --build /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64 -- -j8 all swift-stdlib-linux-x86_64 ninja: error: '/home/modocache/GitHub/apple/swift/stdlib/private/SwiftPrivatePthreadExtras/swiftGlibc-linux-x86_64', needed by 'stdlib/private/SwiftPrivatePthreadExtras/linux/x86_64/SwiftPrivatePthreadExtras.o', missing and no known rule to make it utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting ``` The problem is that SwiftPrivatePthreadExtras is always built, regardless of whether the SDK overlay is built. I believe there's an explicit check against this for Darwin platforms to prevent the same error. The solution, implemented here, is to add the same check for Linux.
1 parent f0c3ac1 commit 83daa49

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

stdlib/private/CMakeLists.txt

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,16 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
22
add_subdirectory(SwiftPrivate)
33
endif()
44

5-
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6-
if(SWIFT_BUILD_SDK_OVERLAY)
7-
# FIXME: there is nothing Darwin-specific in StdlibUnittest, but to use
8-
# POSIX APIs it imports the Darwin module on Apple platforms, so it can't
9-
# be built separately from the SDK overlay.
10-
add_subdirectory(StdlibUnittest)
11-
add_subdirectory(StdlibCollectionUnittest)
12-
add_subdirectory(StdlibUnittestFoundationExtras)
13-
add_subdirectory(SwiftPrivateLibcExtras)
14-
add_subdirectory(SwiftPrivatePthreadExtras)
15-
add_subdirectory(SwiftReflectionTest)
16-
endif()
17-
endif()
18-
19-
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
5+
if(SWIFT_BUILD_SDK_OVERLAY)
6+
# SwiftPrivatePthreadExtras makes use of Darwin/Glibc, which is part of the
7+
# SDK overlay. It can't be built separately from the SDK overlay.
208
add_subdirectory(StdlibUnittest)
219
add_subdirectory(StdlibCollectionUnittest)
2210
add_subdirectory(SwiftPrivateLibcExtras)
2311
add_subdirectory(SwiftPrivatePthreadExtras)
12+
13+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
14+
add_subdirectory(StdlibUnittestFoundationExtras)
15+
add_subdirectory(SwiftReflectionTest)
16+
endif()
2417
endif()

0 commit comments

Comments
 (0)