Skip to content

Commit 59bd80b

Browse files
committed
[Build System: CMake] Install the apinotes in the 'compiler' install component when compiling for Darwin platforms.
Setting the CMake cache variable SWIFT_INCLUDE_APINOTES to true will override the default behavior and unconditionally create the install targets. (cherry picked from commit c10b815)
1 parent ecbf11d commit 59bd80b

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ option(SWIFT_INCLUDE_DOCS
9393
"Create targets for building docs."
9494
TRUE)
9595

96+
set(_swift_include_apinotes_default FALSE)
97+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
98+
set(_swift_include_apinotes_default TRUE)
99+
endif()
100+
101+
option(SWIFT_INCLUDE_APINOTES
102+
"Create targets for installing the remaining apinotes in the built toolchain."
103+
${_swift_include_apinotes_default})
104+
96105
#
97106
# Miscellaneous User-configurable options.
98107
#
@@ -1052,12 +1061,8 @@ endif()
10521061
# https://bugs.swift.org/browse/SR-5975
10531062
add_subdirectory(stdlib)
10541063

1055-
if(SWIFT_BUILD_SDK_OVERLAY)
1056-
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}"
1057-
building_darwin_sdks)
1058-
if(building_darwin_sdks)
1059-
add_subdirectory(apinotes)
1060-
endif()
1064+
if(SWIFT_INCLUDE_APINOTES)
1065+
add_subdirectory(apinotes)
10611066
endif()
10621067

10631068
add_subdirectory(include)

apinotes/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ add_custom_target("copy_apinotes"
3131
# This is treated as an OPTIONAL target because if we don't build the SDK
3232
# overlay, the files will be missing anyway. It also allows us to build
3333
# single overlays without installing the API notes.
34-
swift_install_in_component(sdk-overlay
34+
swift_install_in_component(compiler
3535
DIRECTORY "${output_dir}"
36-
DESTINATION "lib/swift/"
37-
OPTIONAL)
36+
DESTINATION "lib/swift/")

stdlib/public/Platform/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ set(swift_platform_sources
33
TiocConstants.swift
44
tgmath.swift.gyb)
55

6+
set(darwin_depends)
7+
if(NOT BUILD_STANDALONE)
8+
# This is overly conservative, but we have so few API notes files that
9+
# haven't migrated to the Swift repo that it's probably fine in practice.
10+
list(APPEND darwin_depends copy_apinotes)
11+
endif()
12+
613
add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
714
Darwin.swift.gyb
815
${swift_platform_sources}
@@ -13,9 +20,7 @@ add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_
1320
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
1421
TARGET_SDKS ALL_APPLE_PLATFORMS
1522

16-
# This is overly conservative, but we have so few API notes files that
17-
# haven't migrated to the Swift repo that it's probably fine in practice.
18-
DEPENDS copy_apinotes)
23+
DEPENDS ${darwin_depends})
1924

2025
add_swift_target_library(swiftGlibc ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
2126
Glibc.swift.gyb

0 commit comments

Comments
 (0)