Skip to content

Commit 53a5f32

Browse files
authored
Merge pull request #11324 from etcwilde/ewilde/swift-repl-freebsd
FreeBSD: SwiftREPL: Find swiftCore.so
2 parents ce86708 + cde5107 commit 53a5f32

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lldb/tools/repl/swift/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ target_link_libraries(repl_swift PRIVATE ${CMAKE_DL_LIBS})
2020
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
2121
set_target_properties(repl_swift PROPERTIES
2222
WIN32_EXECUTABLE TRUE)
23-
elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
23+
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD")
24+
string(TOLOWER "${CMAKE_SYSTEM_NAME}" platform)
2425
if(CMAKE_SYSTEM_PROCESSOR MATCHES ppc64le)
2526
set_target_properties(repl_swift PROPERTIES
26-
BUILD_RPATH ${SWIFT_LIBRARY_DIR}/swift/linux/powerpc64le)
27+
BUILD_RPATH "${SWIFT_LIBRARY_DIR}/swift/${platform}/powerpc64le")
2728
else()
2829
set_target_properties(repl_swift PROPERTIES
29-
BUILD_RPATH ${SWIFT_LIBRARY_DIR}/swift/linux)
30+
BUILD_RPATH "${SWIFT_LIBRARY_DIR}/swift/${platform}")
3031
endif()
3132
set_target_properties(repl_swift PROPERTIES
3233
BUILD_WITH_INSTALL_RPATH NO
33-
INSTALL_RPATH "$ORIGIN/../lib/swift/linux")
34+
INSTALL_RPATH "$ORIGIN/../lib/swift/${platform}")
3435
endif()
3536

3637
# The dummy repl executable is a C program, but we always look for a mangled

lldb/tools/repl/swift/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <dlfcn.h>
1616
#endif
1717

18-
#if defined(__linux__)
18+
#if defined(__linux__) || defined(__FreeBSD__)
1919
#include <dlfcn.h>
2020
#endif
2121

@@ -60,7 +60,7 @@ int main() {
6060
// We load the system's libswiftCore, but this is overriden on tests to
6161
// use the just built one by setting DYLD_LIBRARY_PATH.
6262
dlopen("/usr/lib/swift/libswiftCore.dylib", RTLD_LAZY);
63-
#elif defined(__linux__)
63+
#elif defined(__linux__) || defined(__FreeBSD__)
6464
dlopen("libswiftCore.so", RTLD_LAZY);
6565
#elif defined(_WIN32)
6666
HMODULE hModule = LoadLibraryW(L"swiftCore.dll");

0 commit comments

Comments
 (0)