termux-packages/disabled-packages/swift/swift-tools-SourceKit-cmake-modules-AddSwiftSourceKit.cmake.patch
Leonid Pliushch eab39222c5 move 'swift' to disabled packages
Currently it supports only on-device builds.
https://github.com/termux/termux-packages/pull/4895

How to build:

 cp -a ./disabled-packages/swift ./packages/
 pkg install clang binutils-gold file patch python cmake ninja python2 perl rsync libandroid-spawn libcurl libicu libsqlite libuuid libxml2 llbuild pkg-config
 TERMUX_MAKE_PROCESSES=7 ./build-package.sh swift
2020-02-17 13:47:32 +02:00

36 lines
1.7 KiB
Diff

commit 799eb632c86f0171300f9b30f0f8d6586bdc3310
Author: Alex Langford <apl@fb.com>
Date: Tue Apr 2 12:04:19 2019 -0700
[CMake] Make SourceKit respect link_libraries and library_search_directories
add_sourcekit_default_compiler_flags was invoking
_add_variant_link_flags and getting link flags but not actually using
the link_libraries or library_search_directories. In android builds,
this means that the correct libc++ is not being linked against.
diff --git a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
index c1535aa2d3..1f7eebe40f 100644
--- a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
+++ b/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
@@ -66,7 +66,9 @@ function(add_sourcekit_default_compiler_flags target)
ENABLE_LTO "${SWIFT_TOOLS_ENABLE_LTO}"
LTO_OBJECT_NAME "${target}-${sdk}-${arch}"
ANALYZE_CODE_COVERAGE "${analyze_code_coverage}"
- RESULT_VAR_NAME link_flags)
+ RESULT_VAR_NAME link_flags
+ LINK_LIBRARIES_VAR_NAME link_libraries
+ LIBRARY_SEARCH_DIRECTORIES_VAR_NAME library_search_directories)
# Convert variables to space-separated strings.
_list_escape_for_shell("${c_compile_flags}" c_compile_flags)
@@ -77,6 +79,8 @@ function(add_sourcekit_default_compiler_flags target)
COMPILE_FLAGS " ${c_compile_flags} -fblocks")
set_property(TARGET "${target}" APPEND_STRING PROPERTY
LINK_FLAGS " ${link_flags}")
+ set_property(TARGET "${target}" APPEND PROPERTY LINK_LIBRARIES ${link_libraries})
+ swift_target_link_search_directories("${target}" "${library_search_directories}")
endfunction()
# Add a new SourceKit library.