Skip to content

Commit

Permalink
Merge pull request #1 from dsp-testing/swift-5.7
Browse files Browse the repository at this point in the history
Swift 5.7
  • Loading branch information
AlexDenisov authored Sep 21, 2022
2 parents 4bd0eca + 818419c commit b19a7cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
2 changes: 2 additions & 0 deletions swift-build-presets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
release
build-subdir=codeql

bootstrapping=off
llvm-targets-to-build=X86;ARM;AArch64
llvm-cmake-options=-DLLVM_ENABLE_TERMINFO=OFF

Expand Down Expand Up @@ -33,6 +34,7 @@ debug
assertions
build-subdir=codeql-debug

bootstrapping=off
llvm-targets-to-build=X86;ARM;AArch64
llvm-cmake-options=-DLLVM_ENABLE_TERMINFO=OFF

Expand Down
36 changes: 5 additions & 31 deletions swift-build-system.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 8046ea79966..4c2c040a573 100644
index 8046ea79966..cd4fa6e673b 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -17,3 +17,55 @@ configure_file(
@@ -17,3 +17,54 @@ configure_file(
SwiftConfig.cmake.in
${swift_cmake_builddir}/SwiftConfig.cmake
@ONLY)
+
+
+# Generate install-tree CMake files
+set(SWIFT_CONFIG_CODE "
+# Compute the installation prefix from this LLVMConfig.cmake file location.
+# Compute the installation prefix from this SwiftConfig.cmake file location.
+get_filename_component(SWIFT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+# Construct the proper number of get_filename_component(... PATH)
+# calls to compute the installation prefix.
Expand Down Expand Up @@ -59,10 +58,10 @@ index 8046ea79966..4c2c040a573 100644
+install(DIRECTORY ${CMAKE_SOURCE_DIR}/stdlib/public/SwiftShims DESTINATION stdlib/public)
+
diff --git a/cmake/modules/SwiftComponents.cmake b/cmake/modules/SwiftComponents.cmake
index d7a03ae74ed..5506512d77f 100644
index 4d77e374deb..88b6645a811 100644
--- a/cmake/modules/SwiftComponents.cmake
+++ b/cmake/modules/SwiftComponents.cmake
@@ -74,7 +74,7 @@ set(_SWIFT_DEFINED_COMPONENTS
@@ -76,7 +76,7 @@ set(_SWIFT_DEFINED_COMPONENTS
# for the following exceptions.
set(_SWIFT_DEFAULT_COMPONENTS "${_SWIFT_DEFINED_COMPONENTS}")
# 'dev' takes up a lot of disk space and isn't part of a normal toolchain.
Expand All @@ -71,28 +70,3 @@ index d7a03ae74ed..5506512d77f 100644
# These clang header options conflict with 'clang-builtin-headers'.
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-resource-dir-symlink")
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-builtin-headers-in-clang-resource-dir")
diff --git a/cmake/modules/SwiftSharedCMakeConfig.cmake b/cmake/modules/SwiftSharedCMakeConfig.cmake
index 26ada5dc9ac..f5e98328616 100644
--- a/cmake/modules/SwiftSharedCMakeConfig.cmake
+++ b/cmake/modules/SwiftSharedCMakeConfig.cmake
@@ -14,6 +14,20 @@ macro(swift_common_standalone_build_config_llvm product)
# Then we import LLVMConfig. This is going to override whatever cached value
# we have for LLVM_ENABLE_ASSERTIONS.
find_package(LLVM CONFIG REQUIRED NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if (APPLE)
+ if (LLVM_VERSION_MAJOR GREATER_EQUAL 12)
+ # Precompiled LLVM 12+ on macOS contains a hardcoded dependency on a very
+ # specific version of libcurses:
+ #
+ # set_target_properties(LLVMSupport PROPERTIES
+ # INTERFACE_LINK_LIBRARIES "m;ZLIB::ZLIB;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib/libcurses.tbd;LLVMDemangle"
+ # )
+ #
+ # So we are monkey-patching it here
+ set_target_properties(LLVMSupport PROPERTIES
+ INTERFACE_LINK_LIBRARIES "z;curses;m;LLVMDemangle")
+ endif()
+ endif()
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")

set(LLVM_MAIN_SRC_DIR "${LLVM_BUILD_MAIN_SRC_DIR}"

0 comments on commit b19a7cc

Please sign in to comment.