From 5482409fb7484b852121c6bb93c366688d7d8d1a Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 4 Jan 2019 15:44:10 -0800 Subject: [PATCH 1/2] build: clean up unused variable (NFC) Remove the unused parameter from the build (NFC). --- stdlib/public/core/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt index 7dfaece02a8a5..fb23d6054c150 100644 --- a/stdlib/public/core/CMakeLists.txt +++ b/stdlib/public/core/CMakeLists.txt @@ -276,7 +276,6 @@ if(SWIFT_CHECK_ESSENTIAL_STDLIB) 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() @@ -303,8 +302,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 From 6dac8dd0927a0ce4cff692283fa676e781ecfba6 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 4 Jan 2019 16:43:07 -0800 Subject: [PATCH 2/2] build: cleanup swiftCore link definition Colocate the target specific library specification. Inline the single site use of the place holder ICU_UC and ICU_I18N libraries rather than trying to create special library processing code for that. --- cmake/modules/AddSwift.cmake | 19 +------------------ stdlib/public/core/CMakeLists.txt | 31 +++++++++++++++++-------------- 2 files changed, 18 insertions(+), 32 deletions(-) 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 fb23d6054c150..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,15 +287,6 @@ if(SWIFT_CHECK_ESSENTIAL_STDLIB) target_link_libraries(swift_stdlib_essential ${RUNTIME_DEPENDENCY}) endif() - -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}