Skip to content

[Build System: CMake] Install the apinotes in the 'compiler' install component. #24419

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 1 commit into from
May 3, 2019
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 @@ -1042,12 +1051,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
6 changes: 1 addition & 5 deletions apinotes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ add_custom_target("copy_apinotes"
COMMENT "Copying API notes to ${output_dir}"
SOURCES "${sources}")

# 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(DIRECTORY "${output_dir}"
DESTINATION "lib/swift/"
COMPONENT sdk-overlay
OPTIONAL)
COMPONENT compiler)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as they don't get installed on Linux…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only make this target if building for an Apple platform.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's tricky because of cross-compilers, but that might be a case we can afford to ignore for now.

11 changes: 8 additions & 3 deletions stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ set(swift_platform_sources
set(swift_platform_gyb_sources
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
${swift_platform_sources}
POSIXError.swift
Expand All @@ -19,9 +26,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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still relevant; this is about the build you're in the process of doing rather than the install.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this to keep the dependency when building the standard library with the compiler, but also allow building standalone without the dependency.

DEPENDS ${darwin_depends})

add_swift_target_library(swiftGlibc ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
${swift_platform_sources}
Expand Down