Skip to content

Commit

Permalink
Explicitly weak-link the Contacts framework into its overlay.
Browse files Browse the repository at this point in the history
Fixes rdar://problem/21030937, which came about because CNErrorDomain
is missing availability information, so we generate a normal external
reference rather than a weak one.

Swift SVN r28824
  • Loading branch information
DougGregor committed May 20, 2015
1 parent d6ba866 commit 1ae67e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ endfunction()
# [DEPENDS dep1 ...]
# [LINK_LIBRARIES dep1 ...]
# [FRAMEWORK_DEPENDS dep1 ...]
# [FRAMEWORK_DEPENDS_WEAK dep1 ...]
# [COMPONENT_DEPENDS comp1 ...]
# [C_COMPILE_FLAGS flag1...]
# [SWIFT_COMPILE_FLAGS flag1...]
Expand Down Expand Up @@ -638,6 +639,9 @@ endfunction()
# FRAMEWORK_DEPENDS
# System frameworks this library depends on.
#
# FRAMEWORK_DEPENDS_WEAK
# System frameworks this library depends on that should be weakly-linked.
#
# COMPONENT_DEPENDS
# LLVM components this library depends on.
#
Expand Down Expand Up @@ -678,7 +682,7 @@ function(_add_swift_library_single target name)
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
parse_arguments(SWIFTLIB_SINGLE
"DEPENDS;LINK_LIBRARIES;FRAMEWORK_DEPENDS;COMPONENT_DEPENDS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;FILE_DEPENDS;SDK;ARCHITECTURE;INSTALL_IN_COMPONENT"
"DEPENDS;LINK_LIBRARIES;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;COMPONENT_DEPENDS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;FILE_DEPENDS;SDK;ARCHITECTURE;INSTALL_IN_COMPONENT"
"${SWIFTLIB_SINGLE_options}"
${ARGN})

Expand Down Expand Up @@ -944,6 +948,11 @@ function(_add_swift_library_single target name)
target_link_libraries("${t}" PUBLIC "-framework ${FRAMEWORK}")
endforeach()
endforeach()
foreach(FRAMEWORK ${SWIFTLIB_SINGLE_FRAMEWORK_DEPENDS_WEAK})
foreach(t "${target}" ${target_static})
target_link_libraries("${t}" PUBLIC "-weak_framework ${FRAMEWORK}")
endforeach()
endforeach()

swift_common_llvm_config("${target}" ${SWIFTLIB_SINGLE_COMPONENT_DEPENDS})

Expand Down Expand Up @@ -1055,6 +1064,7 @@ endfunction()
# [INTERFACE_LINK_LIBRARIES dep1 ...]
# [SWIFT_MODULE_DEPENDS dep1 ...]
# [FRAMEWORK_DEPENDS dep1 ...]
# [FRAMEWORK_DEPENDS_WEAK dep1 ...]
# [COMPONENT_DEPENDS comp1 ...]
# [FILE_DEPENDS target1 ...]
# [TARGET_SDKS sdk1...]
Expand Down Expand Up @@ -1097,6 +1107,9 @@ endfunction()
# FRAMEWORK_DEPENDS
# System frameworks this library depends on.
#
# FRAMEWORK_DEPENDS_WEAK
# System frameworks this library depends on that should be weak-linked
#
# COMPONENT_DEPENDS
# LLVM components this library depends on.
#
Expand Down Expand Up @@ -1146,7 +1159,7 @@ function(add_swift_library name)
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
parse_arguments(SWIFTLIB
"DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INSTALL_IN_COMPONENT"
"DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INSTALL_IN_COMPONENT"
"${SWIFTLIB_options}"
${ARGN})
set(SWIFTLIB_SOURCES ${SWIFTLIB_DEFAULT_ARGS})
Expand Down Expand Up @@ -1267,6 +1280,7 @@ function(add_swift_library name)
DEPENDS ${SWIFTLIB_DEPENDS}
LINK_LIBRARIES ${swiftlib_link_libraries}
FRAMEWORK_DEPENDS ${swiftlib_framework_depends_flattened}
FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
COMPONENT_DEPENDS ${SWIFTLIB_COMPONENT_DEPENDS}
FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
Expand Down Expand Up @@ -1412,6 +1426,7 @@ function(add_swift_library name)
DEPENDS ${SWIFTLIB_DEPENDS}
LINK_LIBRARIES ${SWIFTLIB_LINK_LIBRARIES}
FRAMEWORK_DEPENDS ${SWIFTLIB_FRAMEWORK_DEPENDS}
FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
COMPONENT_DEPENDS ${SWIFTLIB_COMPONENT_DEPENDS}
FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS}
C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
Expand Down
3 changes: 2 additions & 1 deletion stdlib/public/SDK/Contacts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_swift_library(swiftContacts IS_SDK_OVERLAY
Contacts.swift
TARGET_SDKS OSX IOS IOS_SIMULATOR
SWIFT_MODULE_DEPENDS Foundation)
SWIFT_MODULE_DEPENDS Foundation
FRAMEWORK_DEPENDS_WEAK Contacts)

0 comments on commit 1ae67e3

Please sign in to comment.