From bfae5696b12c9580481185f81bb3fb4e1d5c795a Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Fri, 16 Aug 2024 13:02:27 -0700 Subject: [PATCH 1/2] [Macros] Set correct RPATH to libTestingMacros.so It's not guaranteed that the host compiler has all the dependency loaded. --- Sources/TestingMacros/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/TestingMacros/CMakeLists.txt b/Sources/TestingMacros/CMakeLists.txt index 616a5c3f3..d77227bf4 100644 --- a/Sources/TestingMacros/CMakeLists.txt +++ b/Sources/TestingMacros/CMakeLists.txt @@ -60,15 +60,16 @@ else() add_library(TestingMacros SHARED) target_link_options(TestingMacros PRIVATE "-no-toolchain-stdlib-rpath") - # Not setting RPATH means it requires all the dependencies are already loaded - # in the process, because 'plugin' directory wouldn't contain any dependencies. - set_property(TARGET TestingMacros PROPERTY INSTALL_RPATH) set_property(TARGET TestingMacros PROPERTY BUILD_WITH_INSTALL_RPATH YES) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(plugin_destination_dir "lib/swift/host/plugins/testing") + set_property(TARGET TestingMacros PROPERTY INSTALL_RPATH) else() set(plugin_destination_dir "lib/swift/host/plugins") + # RPATH 'lib/swift/{system}' and 'lib/swift/host' + set_property(TARGET TestingMacros PROPERTY + INSTALL_RPATH "$ORIGIN/../../;$ORIGIN/..") endif() install(TARGETS TestingMacros From 21c7d76b71e857188c7a9128b73aedbb7e52bd4b Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Fri, 16 Aug 2024 13:03:52 -0700 Subject: [PATCH 2/2] [Macros] Don't import string-processing and backtracing Other macro libraries e.g. ObservationMacros don't import them. --- Sources/TestingMacros/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/TestingMacros/CMakeLists.txt b/Sources/TestingMacros/CMakeLists.txt index d77227bf4..dda13612b 100644 --- a/Sources/TestingMacros/CMakeLists.txt +++ b/Sources/TestingMacros/CMakeLists.txt @@ -104,6 +104,10 @@ target_sources(TestingMacros PRIVATE TestDeclarationMacro.swift TestingMacrosMain.swift) +target_compile_options(TestingMacros PRIVATE + "SHELL:-Xfrontend -disable-implicit-string-processing-module-import" + "SHELL:-Xfrontend -disable-implicit-backtracing-module-import") + target_link_libraries(TestingMacros PRIVATE SwiftSyntax::SwiftSyntax SwiftSyntax::SwiftSyntaxMacroExpansion