Skip to content

CMake: on Darwin be explicit about inclusion in the dyld shared cache #70856

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
Jan 29, 2024
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
13 changes: 13 additions & 0 deletions stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ if(SWIFT_STDLIB_SIL_DEBUGGING)
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "-Xfrontend" "-sil-based-debuginfo")
endif()

option(SWIFT_RUNTIME_DYLD_SHARED_CACHE_COMPATIBLE
"On Darwin platforms, link the standard library in a way that
allows inclusion in the dyld shared cache"
FALSE)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
LLVM_LINKER_IS_APPLE AND
NOT SWIFT_RUNTIME_DYLD_SHARED_CACHE_COMPATIBLE)
set(shared_cache_link_flags "LINKER:-not_for_dyld_shared_cache")
list(APPEND SWIFT_RUNTIME_LINK_FLAGS ${shared_cache_link_flags})
list(APPEND SWIFT_RUNTIME_SWIFT_LINK_FLAGS ${shared_cache_link_flags})
endif()

# Build the runtime with -Wall to catch, e.g., uninitialized variables
# warnings.
if(SWIFT_COMPILER_IS_MSVC_LIKE)
Expand Down
1 change: 1 addition & 0 deletions stdlib/public/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
-diagnostic-style swift
${SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS}
${swift_concurrency_options}
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
INSTALL_IN_COMPONENT stdlib
MACCATALYST_BUILD_FLAVOR zippered
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ add_swift_target_library(swiftObservation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS

C_COMPILE_FLAGS
${swift_runtime_library_compile_flags}
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"

SWIFT_MODULE_DEPENDS _Concurrency
INSTALL_IN_COMPONENT stdlib
Expand Down
5 changes: 4 additions & 1 deletion stdlib/public/Synchronization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
"-enable-experimental-feature" "RawLayout"
"-enable-experimental-feature" "StaticExclusiveOnly"

LINK_FLAGS
"${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"

INSTALL_IN_COMPONENT
stdlib

MACCATALYST_BUILD_FLAVOR
"zippered"
)
)