termux-packages/packages/swift/swift-cmake.patch.beforehos...

459 lines
22 KiB
Plaintext

diff --git a/swift/CMakeLists.txt b/swift/CMakeLists.txt
index 7490e1df821..9a5ec99cba0 100644
--- a/swift/CMakeLists.txt
+++ b/swift/CMakeLists.txt
@@ -944,7 +944,7 @@
message(STATUS "Doxygen: enabled")
endif()
-if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
+if((SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT) AND ${SWIFT_HOST_VARIANT_SDK} MATCHES "OSX|WINDOWS")
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER 3.8
diff --git a/swift/cmake/modules/AddSwift.cmake b/swift/cmake/modules/AddSwift.cmake
index b40bd4d881e..8c51c6b6857 100644
--- a/swift/cmake/modules/AddSwift.cmake
+++ b/swift/cmake/modules/AddSwift.cmake
@@ -123,6 +123,10 @@ function(_add_variant_c_compile_link_flags)
endif()
endif()
+ if("${CFLAGS_SDK}" STREQUAL "ANDROID")
+ set(DEPLOYMENT_VERSION "${SWIFT_SDK_${CFLAGS_SDK}_DEPLOYMENT_VERSION}")
+ endif()
+
# MSVC, clang-cl, gcc don't understand -target.
if(CMAKE_C_COMPILER_ID MATCHES "^Clang|AppleClang$" AND
NOT SWIFT_COMPILER_IS_MSVC_LIKE)
@@ -480,10 +480,10 @@ function(_add_variant_link_flags)
list(APPEND library_search_directories
${CMAKE_BINARY_DIR}/winsdk_lib_${LFLAGS_ARCH}_symlinks)
elseif("${LFLAGS_SDK}" STREQUAL "HAIKU")
- list(APPEND link_libraries "bsd" "atomic")
+ list(APPEND link_libraries "bsd")
list(APPEND result "-Wl,-Bsymbolic")
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
- list(APPEND link_libraries "dl" "log" "atomic")
+ list(APPEND link_libraries "dl" "log")
# We need to add the math library, which is linked implicitly by libc++
list(APPEND result "-lm")
@@ -491,11 +491,6 @@ function(_add_variant_link_flags)
swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries)
list(APPEND link_libraries ${cxx_link_libraries})
- # link against the ICU libraries
- list(APPEND link_libraries
- ${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
- ${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
-
swift_android_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
list(APPEND library_search_directories ${path})
@@ -1114,11 +1113,14 @@ function(_add_swift_library_single target name)
endif()
# Only set the install RPATH if cross-compiling the host tools, in which
# case both the NDK and Sysroot paths must be set.
- if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
- NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
+ if(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN")
+ else()
+ set_target_properties("${target}"
+ PROPERTIES
+ INSTALL_RPATH "@TERMUX_PREFIX@/lib:$ORIGIN")
endif()
endif()
@@ -1909,6 +1903,14 @@ function(add_swift_target_library name)
endif()
endif()
+ set(SWIFTLIB_${sdk}_SOURCES ${SWIFTLIB_SOURCES})
+ if(name STREQUAL swiftRuntime)
+ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
+ list(REMOVE_ITEM SWIFTLIB_${sdk}_SOURCES ImageInspectionELF.cpp)
+ swift_runtime_static_libraries(${sdk})
+ endif()
+ endif()
+
set(sdk_supported_archs
${SWIFT_SDK_${sdk}_ARCHITECTURES}
${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
@@ -1937,6 +1931,12 @@ function(add_swift_target_library name)
set(swiftlib_module_dependency_targets)
set(swiftlib_private_link_libraries_targets)
+ if(name STREQUAL swiftCore)
+ # This initializes swiftlib_private_link_libraries_targets for swiftCore,
+ # so don't move it away from the variable declaration just above.
+ swift_core_private_libraries(${sdk} ${arch} swiftlib_private_link_libraries_targets)
+ endif()
+
if(NOT BUILD_STANDALONE)
foreach(mod ${swiftlib_module_depends_flattened})
list(APPEND swiftlib_module_dependency_targets
@@ -1972,7 +1981,7 @@ function(add_swift_target_library name)
${SWIFTLIB_STATIC_keyword}
${SWIFTLIB_OBJECT_LIBRARY_keyword}
${SWIFTLIB_INSTALL_WITH_SHARED_keyword}
- ${SWIFTLIB_SOURCES}
+ ${SWIFTLIB_${sdk}_SOURCES}
TARGET_LIBRARY
MODULE_TARGET ${MODULE_VARIANT_NAME}
SDK ${sdk}
diff --git a/swift/cmake/modules/SwiftAndroidSupport.cmake b/swift/cmake/modules/SwiftAndroidSupport.cmake
index 9379031947d..91cecf46a37 100644
--- a/swift/cmake/modules/SwiftAndroidSupport.cmake
+++ b/swift/cmake/modules/SwiftAndroidSupport.cmake
@@ -1,8 +1,7 @@
function(swift_android_libcxx_include_paths var)
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
set(${var}
- "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/include"
- "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++abi/include"
+ "${SWIFT_ANDROID_NDK_PATH}/sysroot/usr/include/c++/v1"
PARENT_SCOPE)
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
set(${var}
@@ -89,7 +88,7 @@ function(swift_android_cxx_libraries_for_arch arch libraries_var_name)
message(SEND_ERROR "unknown architecture (${arch}) when cross-compiling for Android")
endif()
- set(android_libcxx_path "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/${cxx_arch}")
+ set(android_libcxx_path "${SWIFT_ANDROID_NDK_PATH}/sysroot/usr/lib/aarch64-linux-android")
list(APPEND link_libraries ${android_libcxx_path}/libc++abi.a
${android_libcxx_path}/libc++_shared.so)
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
diff --git a/swift/cmake/modules/SwiftConfigureSDK.cmake b/swift/cmake/modules/SwiftConfigureSDK.cmake
index 3a87bfcd80b..89e9827db6c 100644
--- a/swift/cmake/modules/SwiftConfigureSDK.cmake
+++ b/swift/cmake/modules/SwiftConfigureSDK.cmake
@@ -234,7 +234,7 @@ macro(configure_sdk_unix name architectures)
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "aarch64-linux-android")
set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "aarch64")
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
- set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH}/platforms/android-${SWIFT_ANDROID_API_LEVEL}/arch-arm64")
+ set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH}/sysroot")
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NATIVE_SYSROOT}")
else()
@@ -275,8 +275,9 @@ macro(configure_sdk_unix name architectures)
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86_64-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${_swift_android_prebuilt_build}")
else()
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH
- "${SWIFT_ANDROID_NDK_PATH}/toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${_swift_android_prebuilt_build}")
+ "${SWIFT_ANDROID_NDK_PATH}")
endif()
+ set(SWIFT_SDK_ANDROID_DEPLOYMENT_VERSION ${SWIFT_ANDROID_API_LEVEL})
else()
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/" CACHE STRING "CMAKE_SYSROOT for ${prefix} ${arch}")
diff --git a/swift/lib/Driver/CMakeLists.txt b/swift/lib/Driver/CMakeLists.txt
index 448f5044b70..e665dfcfefe 100644
--- a/swift/lib/Driver/CMakeLists.txt
+++ b/swift/lib/Driver/CMakeLists.txt
@@ -27,42 +27,3 @@ target_link_libraries(swiftDriver PRIVATE
swiftAST
swiftBasic
swiftOption)
-
-# Generate the static-stdlib-args.lnk file used by -static-stdlib option
-# for 'GenericUnix' (eg linux)
-if(SWIFT_BUILD_STATIC_STDLIB)
- set(static_stdlib_lnk_file_list)
- foreach(sdk ${SWIFT_CONFIGURED_SDKS})
- if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "ELF")
- string(TOLOWER "${sdk}" lowercase_sdk)
- if(SWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB)
- set(ICU_STATICLIB "TRUE")
- else()
- set(ICU_STATICLIB "FALSE")
- find_package(ICU REQUIRED COMPONENTS uc i18n)
- get_filename_component(ICU_UC_LIBDIR "${ICU_UC_LIBRARIES}" DIRECTORY)
- get_filename_component(ICU_I18N_LIBDIR "${ICU_I18N_LIBRARIES}" DIRECTORY)
- endif()
- set(linkfile "${lowercase_sdk}/static-stdlib-args.lnk")
- add_custom_command_target(swift_static_stdlib_${sdk}_args
- COMMAND
- "${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args"
- "${sdk}"
- "${SWIFTSTATICLIB_DIR}/${linkfile}"
- "${ICU_STATICLIB}"
- "${ICU_UC_LIBDIR}"
- "${ICU_I18N_LIBDIR}"
- OUTPUT
- "${SWIFTSTATICLIB_DIR}/${linkfile}"
- DEPENDS
- "${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args")
-
- list(APPEND static_stdlib_lnk_file_list ${swift_static_stdlib_${sdk}_args})
- swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR}/${linkfile}"
- DESTINATION "lib/swift_static/${lowercase_sdk}"
- COMPONENT stdlib)
- endif()
- endforeach()
- add_custom_target(swift_static_lnk_args ALL DEPENDS ${static_stdlib_lnk_file_list})
- add_dependencies(stdlib swift_static_lnk_args)
-endif()
diff --git a/swift/stdlib/CMakeLists.txt b/swift/stdlib/CMakeLists.txt
index 9f3cf240d3d..d2ce14d5f47 100644
--- a/swift/stdlib/CMakeLists.txt
+++ b/swift/stdlib/CMakeLists.txt
@@ -83,6 +83,43 @@ if(SWIFT_BUILD_STATIC_STDLIB)
else()
list(APPEND SWIFT_STDLIB_LIBRARY_BUILD_TYPES STATIC)
endif()
+
+ # Generate the static-stdlib-args.lnk file used by -static-stdlib option
+ # for 'GenericUnix' (eg linux)
+ set(static_stdlib_lnk_file_list)
+ foreach(sdk ${SWIFT_SDKS})
+ if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "ELF")
+ string(TOLOWER "${sdk}" lowercase_sdk)
+ if(SWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB)
+ set(ICU_STATICLIB "TRUE")
+ else()
+ set(ICU_STATICLIB "FALSE")
+ find_package(ICU REQUIRED COMPONENTS uc i18n)
+ get_filename_component(ICU_UC_LIBDIR "${ICU_UC_LIBRARIES}" DIRECTORY)
+ get_filename_component(ICU_I18N_LIBDIR "${ICU_I18N_LIBRARIES}" DIRECTORY)
+ endif()
+ set(linkfile "${lowercase_sdk}/static-stdlib-args.lnk")
+ add_custom_command_target(swift_static_stdlib_${sdk}_args
+ COMMAND
+ "${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args"
+ "${sdk}"
+ "${SWIFTSTATICLIB_DIR}/${linkfile}"
+ "${ICU_STATICLIB}"
+ "${ICU_UC_LIBDIR}"
+ "${ICU_I18N_LIBDIR}"
+ OUTPUT
+ "${SWIFTSTATICLIB_DIR}/${linkfile}"
+ DEPENDS
+ "${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args")
+
+ list(APPEND static_stdlib_lnk_file_list ${swift_static_stdlib_${sdk}_args})
+ swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR}/${linkfile}"
+ DESTINATION "lib/swift_static/${lowercase_sdk}"
+ COMPONENT stdlib)
+ endif()
+ endforeach()
+ add_custom_target(swift_static_lnk_args ALL DEPENDS ${static_stdlib_lnk_file_list})
+ add_dependencies(stdlib swift_static_lnk_args)
endif()
function(swift_create_stdlib_targets name variant define_all_alias)
diff --git a/swift/stdlib/public/Platform/CMakeLists.txt b/swift/stdlib/public/Platform/CMakeLists.txt
index 90fba95ec1b..48c39a7b9a1 100644
--- a/swift/stdlib/public/Platform/CMakeLists.txt
+++ b/swift/stdlib/public/Platform/CMakeLists.txt
@@ -86,25 +86,29 @@ foreach(sdk ${SWIFT_SDKS})
OUTPUT "${glibc_modulemap_out}"
FLAGS
"-DCMAKE_SDK=${sdk}"
+ "-DTERMUX_INCLUDE_PATH=@TERMUX_PREFIX@/include"
"-DGLIBC_INCLUDE_PATH=${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}"
"-DGLIBC_ARCH_INCLUDE_PATH=${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY}")
list(APPEND glibc_modulemap_target_list ${glibc_modulemap_target})
- # If this SDK is a target for a non-native host, create a native modulemap
- # without a sysroot prefix. This is the one we'll install instead.
- if(NOT "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${arch}_PATH}" STREQUAL "/")
+ # If this SDK is a target for a non-native host, except if it's for Android
+ # with its own native sysroot, create a native modulemap without a sysroot
+ # prefix. This is the one we'll install instead.
+ if(NOT "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${arch}_PATH}" STREQUAL "/" AND
+ NOT (${sdk} STREQUAL ANDROID AND NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL ""))
set(glibc_sysroot_relative_modulemap_out "${module_dir}/sysroot-relative-modulemaps/glibc.modulemap")
- string(REPLACE "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${arch}_PATH}"
- "" absolute_libc_include_path "${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}")
- string(REPLACE "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${arch}_PATH}"
- "" absolute_libc_arch_include_path ${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY})
+ string(REPLACE "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr"
+ "@TERMUX_PREFIX@" absolute_libc_include_path "${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}")
+ string(REPLACE "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr"
+ "@TERMUX_PREFIX@" absolute_libc_arch_include_path ${SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY})
handle_gyb_source_single(glibc_modulemap_native_target
SOURCE "${glibc_modulemap_source}"
OUTPUT "${glibc_sysroot_relative_modulemap_out}"
FLAGS "-DCMAKE_SDK=${sdk}"
+ "-DTERMUX_INCLUDE_PATH=@TERMUX_PREFIX@/include"
"-DGLIBC_INCLUDE_PATH=${absolute_libc_include_path}"
"-DGLIBC_ARCH_INCLUDE_PATH=${absolute_libc_arch_include_path}")
diff --git a/swift/stdlib/public/core/CMakeLists.txt b/swift/stdlib/public/core/CMakeLists.txt
index 7ab092655c7..494d4d62aa3 100644
--- a/swift/stdlib/public/core/CMakeLists.txt
+++ b/swift/stdlib/public/core/CMakeLists.txt
@@ -226,11 +226,9 @@ set(SWIFTLIB_GYB_SOURCES
set(GROUP_INFO_JSON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/GroupInfo.json)
set(swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
set(swift_core_framework_depends)
-set(swift_core_private_link_libraries)
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
list(APPEND swift_core_link_flags "-all_load")
- list(APPEND swift_core_private_link_libraries icucore)
else()
# With the GNU linker the equivalent of -all_load is to tell the linker
# --whole-archive before the archive and --no-whole-archive after (without
@@ -243,35 +241,42 @@ else()
# effort has been completed.
#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
- ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_UC}
- ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_I18N})
+endif()
+
+function(swift_core_private_libraries sdk arch libraries_var_name)
+ set(private_link_libraries)
+ if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
+ list(APPEND private_link_libraries icucore)
else()
- list(APPEND swift_core_private_link_libraries -licui18nswift -licuucswift -licudataswift)
+
+
+ if(${sdk} STREQUAL ${SWIFT_HOST_VARIANT_SDK} AND NOT "${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
+ list(APPEND private_link_libraries -licui18nswift -licuucswift -licudataswift)
+ else()
+ list(APPEND private_link_libraries ${SWIFT_${sdk}_${arch}_ICU_UC}
+ ${SWIFT_${sdk}_${arch}_ICU_I18N})
+ endif()
endif()
-endif()
-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")
-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)
+ if(${sdk} STREQUAL CYGWIN)
+ if(${sdk} STREQUAL ${SWIFT_HOST_VARIANT_SDK})
+ # TODO(compnerd) cache this variable to permit re-configuration
+ execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}" OUTPUT_VARIABLE ENV_SYSTEMROOT)
+ list(APPEND private_link_libraries "${ENV_SYSTEMROOT}/system32/psapi.dll")
+ else()
+ message(FATAL_ERROR "CYGWIN cross-compilation doesn't know where to find psapi.dll.")
+ endif()
+ elseif(${sdk} STREQUAL FREEBSD)
+ find_library(EXECINFO_LIBRARY execinfo)
+ list(APPEND private_link_libraries ${EXECINFO_LIBRARY})
+ elseif(${sdk} STREQUAL LINUX AND SWIFT_BUILD_STATIC_STDLIB)
+ list(APPEND private_link_libraries swiftImageInspectionShared)
+ elseif(${sdk} STREQUAL WINDOWS)
+ list(APPEND private_link_libraries shell32;DbgHelp)
endif()
-elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL WINDOWS)
- list(APPEND swift_core_private_link_libraries shell32;DbgHelp)
-endif()
+
+ set(${libraries_var_name} ${private_link_libraries} PARENT_SCOPE)
+endfunction()
option(SWIFT_CHECK_ESSENTIAL_STDLIB
"Check core standard library layering by linking its essential subset"
@@ -312,8 +317,6 @@ add_swift_target_library(swiftCore
${swift_stdlib_compile_flags} -Xcc -DswiftCore_EXPORTS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
LINK_FLAGS
${swift_core_link_flags}
- PRIVATE_LINK_LIBRARIES
- ${swift_core_private_link_libraries}
INCORPORATE_OBJECT_LIBRARIES
swiftRuntime swiftStdlibStubs
FRAMEWORK_DEPENDS
diff --git a/swift/stdlib/public/runtime/CMakeLists.txt b/swift/stdlib/public/runtime/CMakeLists.txt
index 001d97d5174..0b51e56f631 100644
--- a/swift/stdlib/public/runtime/CMakeLists.txt
+++ b/swift/stdlib/public/runtime/CMakeLists.txt
@@ -88,9 +88,7 @@ set(swift_runtime_library_compile_flags ${swift_runtime_compile_flags})
list(APPEND swift_runtime_library_compile_flags -DswiftCore_EXPORTS)
list(APPEND swift_runtime_library_compile_flags -I${SWIFT_SOURCE_DIR}/include)
-set(sdk "${SWIFT_HOST_VARIANT_SDK}")
-if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
- list(REMOVE_ITEM swift_runtime_sources ImageInspectionELF.cpp)
+function(swift_runtime_static_libraries sdk)
set(static_binary_lnk_file_list)
string(TOLOWER "${sdk}" lowercase_sdk)
@@ -99,6 +97,7 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
ImageInspectionELF.cpp
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
LINK_FLAGS ${swift_runtime_linker_flags}
+ TARGET_SDKS ${sdk}
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT stdlib)
@@ -149,7 +148,7 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
DESTINATION "lib/swift_static/${lowercase_sdk}"
COMPONENT stdlib)
add_custom_target(static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list})
- foreach(arch IN LISTS SWIFT_SDK_LINUX_ARCHITECTURES)
+ foreach(arch IN LISTS SWIFT_SDK_${sdk}_ARCHITECTURES)
add_dependencies(static_binary_magic ${swift_image_inspection_${arch}_static})
endforeach()
add_dependencies(static_binary_magic ${swift_image_inspection_static_primary_arch})
@@ -159,9 +158,10 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
ImageInspectionELF.cpp
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
LINK_FLAGS ${swift_runtime_linker_flags}
+ TARGET_SDKS ${sdk}
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT never_install)
-endif()
+endfunction()
add_swift_target_library(swiftRuntime OBJECT_LIBRARY
${swift_runtime_sources}
@@ -174,7 +174,7 @@ add_swift_target_library(swiftRuntime OBJECT_LIBRARY
set(ELFISH_SDKS)
set(COFF_SDKS)
-foreach(sdk ${SWIFT_CONFIGURED_SDKS})
+foreach(sdk ${SWIFT_SDKS})
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "ELF")
list(APPEND ELFISH_SDKS ${sdk})
elseif("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "COFF")
@@ -201,7 +201,7 @@ add_swift_target_library(swiftImageRegistrationObjectCOFF
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT none)
-foreach(sdk ${SWIFT_CONFIGURED_SDKS})
+foreach(sdk ${SWIFT_SDKS})
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
set(arch_subdir "${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}")
set(arch_suffix "${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
diff --git a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
index 8efd5971030..ab306f47fd8 100644
--- a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
+++ b/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
@@ -164,7 +164,7 @@ macro(add_sourcekit_library name)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
if(SOURCEKITLIB_SHARED)
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
- set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/swift/linux:/usr/lib/swift/linux")
+ set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/swift/android")
endif()
endif()