Skip to content

Commit d0ff134

Browse files
authored
Merge pull request #61294 from ahoppen/ahoppen/sourcekit-lld-link-issue
[Build] Ensure that we link in SwiftSyntax and Swift for SourceKit
2 parents a65c3d1 + 53901f5 commit d0ff134

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
154154
endif()
155155
endif()
156156
set(RPATH_LIST ${RPATH_LIST} PARENT_SCOPE)
157+
158+
if(SWIFT_SWIFT_PARSER)
159+
# Make sure we can find the early SwiftSyntax libraries.
160+
target_link_directories(${target} PRIVATE "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/lib")
161+
162+
# For the "end step" of bootstrapping configurations on Darwin, need to be
163+
# able to fall back to the SDK directory for libswiftCore et al.
164+
if (BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
165+
if (NOT "${bootstrapping}" STREQUAL "1")
166+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
167+
target_link_directories(${target} PRIVATE "${sdk_dir}")
168+
169+
# Include the abi stable system stdlib in our rpath.
170+
set(swift_runtime_rpath "/usr/lib/swift")
171+
endif()
172+
endif()
173+
endif()
174+
endif()
157175
endfunction()
158176

159177
# Add a new SourceKit library.

0 commit comments

Comments
 (0)