diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index 18f844d5ee943..d666331eaefaf 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -1861,24 +1861,7 @@ function(add_swift_target_library name) endif() foreach(lib ${SWIFTLIB_PRIVATE_LINK_LIBRARIES}) - if("${lib}" STREQUAL "ICU_UC") - list(APPEND swiftlib_private_link_libraries_targets - "${SWIFT_${sdk}_${arch}_ICU_UC}") - # temporary fix for atomic needing to be - # after object files for libswiftCore.so - if("${sdk}" STREQUAL "ANDROID") - list(APPEND swiftlib_private_link_libraries_targets - "-latomic") - # the same issue on FreeBSD, missing symbols: - # __atomic_store, __atomic_compare_exchange, __atomic_load - elseif("${sdk}" STREQUAL "FREEBSD") - list(APPEND swiftlib_private_link_libraries_targets - "${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${arch}.a") - endif() - elseif("${lib}" STREQUAL "ICU_I18N") - list(APPEND swiftlib_private_link_libraries_targets - "${SWIFT_${sdk}_${arch}_ICU_I18N}") - elseif(TARGET "${lib}${VARIANT_SUFFIX}") + if(TARGET "${lib}${VARIANT_SUFFIX}") list(APPEND swiftlib_private_link_libraries_targets "${lib}${VARIANT_SUFFIX}") else() diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt index 7dfaece02a8a5..4cd01da4eb759 100644 --- a/stdlib/public/core/CMakeLists.txt +++ b/stdlib/public/core/CMakeLists.txt @@ -238,21 +238,33 @@ else() #set(LINK_FLAGS # -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive) if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "") - list(APPEND swift_core_private_link_libraries ICU_UC ICU_I18N) + list(APPEND swift_core_private_link_libraries + ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_UC} + ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_I18N}) else() list(APPEND swift_core_private_link_libraries -licui18nswift -licuucswift -licudataswift) endif() endif() -if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") +if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL ANDROID) + # workaround for libatomic needing to be after object files for swiftCore.so + list(APPEND swift_core_private_link_libraries atomic) +elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL CYGWIN) # TODO(compnerd) cache this variable to permit re-configuration execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}" OUTPUT_VARIABLE ENV_SYSTEMROOT) list(APPEND swift_core_private_link_libraries "${ENV_SYSTEMROOT}/system32/psapi.dll") -endif() - -if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL FREEBSD) +elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL FREEBSD) find_library(EXECINFO_LIBRARY execinfo) list(APPEND swift_core_private_link_libraries ${EXECINFO_LIBRARY}) + # workaround for libatomic needing to be after object files for swiftCore.so + list(APPEND swift_core_private_link_libraries + ${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${SWIFT_PRIMARY_VARIANT_ARCH}.a) +elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL LINUX) + if(SWIFT_BUILD_STATIC_STDLIB) + list(APPEND swift_core_private_link_libraries swiftImageInspectionShared) + endif() +elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL WINDOWS) + list(APPEND swift_core_private_link_libraries shell32) endif() option(SWIFT_CHECK_ESSENTIAL_STDLIB @@ -275,16 +287,6 @@ if(SWIFT_CHECK_ESSENTIAL_STDLIB) target_link_libraries(swift_stdlib_essential ${RUNTIME_DEPENDENCY}) endif() - -set(shared_only_libs) -if(SWIFT_BUILD_STATIC_STDLIB AND "${SWIFT_PRIMARY_VARIANT_SDK}" STREQUAL "LINUX") - list(APPEND swift_core_private_link_libraries swiftImageInspectionShared) -endif() - -if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL WINDOWS) - list(APPEND swift_core_private_link_libraries shell32) -endif() - add_swift_target_library(swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE ${SWIFTLIB_SOURCES} @@ -303,8 +305,6 @@ add_swift_target_library(swiftCore ${swift_core_private_link_libraries} INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs - INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY - ${shared_only_libs} FRAMEWORK_DEPENDS ${swift_core_framework_depends} INSTALL_IN_COMPONENT