Skip to content

Commit ecf8345

Browse files
compnerdrintaro
authored andcommitted
build: adjust the build to wire up the library search path
This is needed to support Swift macros on Windows. (cherry picked from commit 90601d8)
1 parent 74f27a4 commit ecf8345

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,22 @@ function(add_properties_for_swift_modules target reldir)
217217
# Workaround for a linker crash related to autolinking: rdar://77839981
218218
set_property(TARGET ${target} APPEND_STRING PROPERTY
219219
LINK_FLAGS " -lobjc ")
220+
221+
set_property(TARGET ${target} APPEND PROPERTY BUILD_RPATH "${SWIFT_BUILD_RPATH}")
222+
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}")
220223
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD")
221224
string(REGEX MATCH "^[^-]*" arch ${LLVM_TARGET_TRIPLE})
222225
target_link_libraries(${target} PRIVATE swiftCore-linux-${arch})
223226
string(TOLOWER ${CMAKE_SYSTEM_NAME} platform)
224227
set(SWIFT_BUILD_RPATH "${LLDB_SWIFT_LIBS}/${platform}")
225228
set(SWIFT_INSTALL_RPATH "$ORIGIN/${reldir}lib/swift/${platform}")
229+
set_property(TARGET ${target} APPEND PROPERTY BUILD_RPATH "${SWIFT_BUILD_RPATH}")
230+
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}")
231+
elseif(CMAKE_SYSTEM_NAME MATCHES Windows)
232+
target_link_directories(${target} PRIVATE
233+
${SWIFT_PATH_TO_SWIFT_SDK}/usr/lib/swift/Windows/x86_64)
226234
endif()
227235

228-
set_property(TARGET ${target} APPEND PROPERTY BUILD_RPATH "${SWIFT_BUILD_RPATH}")
229-
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}")
230-
231236
if (SWIFT_SWIFT_PARSER)
232237
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
233238
set_property(TARGET ${target}

0 commit comments

Comments
 (0)