diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index 501049a771536..74418213f4fd4 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -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...] @@ -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. # @@ -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}) @@ -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}) @@ -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...] @@ -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. # @@ -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}) @@ -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} @@ -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} diff --git a/stdlib/public/SDK/Contacts/CMakeLists.txt b/stdlib/public/SDK/Contacts/CMakeLists.txt index ffacb80b878ec..918b0fc467b01 100644 --- a/stdlib/public/SDK/Contacts/CMakeLists.txt +++ b/stdlib/public/SDK/Contacts/CMakeLists.txt @@ -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)