Skip to content

Commit c10b815

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.
1 parent 26dc092 commit c10b815

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

Diff for: CMakeLists.txt

+11-6
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
#
@@ -1042,12 +1051,8 @@ endif()
10421051
# https://bugs.swift.org/browse/SR-5975
10431052
add_subdirectory(stdlib)
10441053

1045-
if(SWIFT_BUILD_SDK_OVERLAY)
1046-
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}"
1047-
building_darwin_sdks)
1048-
if(building_darwin_sdks)
1049-
add_subdirectory(apinotes)
1050-
endif()
1054+
if(SWIFT_INCLUDE_APINOTES)
1055+
add_subdirectory(apinotes)
10511056
endif()
10521057

10531058
add_subdirectory(include)

Diff for: apinotes/CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ add_custom_target("copy_apinotes"
2828
COMMENT "Copying API notes to ${output_dir}"
2929
SOURCES "${sources}")
3030

31-
# This is treated as an OPTIONAL target because if we don't build the SDK
32-
# overlay, the files will be missing anyway. It also allows us to build
33-
# single overlays without installing the API notes.
3431
swift_install_in_component(DIRECTORY "${output_dir}"
3532
DESTINATION "lib/swift/"
36-
COMPONENT sdk-overlay
37-
OPTIONAL)
33+
COMPONENT compiler)

Diff for: stdlib/public/Platform/CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ set(swift_platform_sources
44
set(swift_platform_gyb_sources
55
tgmath.swift.gyb)
66

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

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

2631
add_swift_target_library(swiftGlibc ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
2732
${swift_platform_sources}

0 commit comments

Comments
 (0)