Skip to content

[Build System: CMake] Install the apinotes in the 'compiler' install component (5.1 branch). #24472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ option(SWIFT_INCLUDE_DOCS
"Create targets for building docs."
TRUE)

set(_swift_include_apinotes_default FALSE)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(_swift_include_apinotes_default TRUE)
endif()

option(SWIFT_INCLUDE_APINOTES
"Create targets for installing the remaining apinotes in the built toolchain."
${_swift_include_apinotes_default})

#
# Miscellaneous User-configurable options.
#
Expand Down Expand Up @@ -1052,12 +1061,8 @@ endif()
# https://bugs.swift.org/browse/SR-5975
add_subdirectory(stdlib)

if(SWIFT_BUILD_SDK_OVERLAY)
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}"
building_darwin_sdks)
if(building_darwin_sdks)
add_subdirectory(apinotes)
endif()
if(SWIFT_INCLUDE_APINOTES)
add_subdirectory(apinotes)
endif()

add_subdirectory(include)
Expand Down
5 changes: 2 additions & 3 deletions apinotes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ add_custom_target("copy_apinotes"
# This is treated as an OPTIONAL target because if we don't build the SDK
# overlay, the files will be missing anyway. It also allows us to build
# single overlays without installing the API notes.
swift_install_in_component(sdk-overlay
swift_install_in_component(compiler
DIRECTORY "${output_dir}"
DESTINATION "lib/swift/"
OPTIONAL)
DESTINATION "lib/swift/")
11 changes: 8 additions & 3 deletions stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ set(swift_platform_sources
TiocConstants.swift
tgmath.swift.gyb)

set(darwin_depends)
if(NOT BUILD_STANDALONE)
# This is overly conservative, but we have so few API notes files that
# haven't migrated to the Swift repo that it's probably fine in practice.
list(APPEND darwin_depends copy_apinotes)
endif()

add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
Darwin.swift.gyb
${swift_platform_sources}
Expand All @@ -13,9 +20,7 @@ add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
TARGET_SDKS ALL_APPLE_PLATFORMS

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

add_swift_target_library(swiftGlibc ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
Glibc.swift.gyb
Expand Down