From d08acbfe274f84ad9aa6f5977c7e3dabf1a8ec6a Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Mon, 5 Feb 2024 16:00:24 -0500 Subject: [PATCH] Find plugins correctly on linux. We need to be searching relative to the location of libhmsbeagle.so When using libhmsbeagle.so in the build directory, we need to explicitly search the CPU, GPU, and JNI subdirs. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83dac35d..42731b71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,12 @@ if(APPLE) # Seems necessary from macOS 10.15 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +elseif(UNIX) + # This tells libhmsbeagle.so to search the same directory to find plugins. + SET(CMAKE_INSTALL_RPATH "\$ORIGIN") + # $ORIGIN/{CPU,GPU,JNI} is so that libhmsbeagle.so can find the plugins in their build location. + # $ORIGIN/../libhmsbeagle is so that examples/* can find libhmsbeagle.so + SET(CMAKE_BUILD_RPATH "\$ORIGIN:\$ORIGIN/CPU:\$ORIGIN/GPU:\$ORIGIN/JNI:\$ORIGIN/../libhmsbeagle") endif(APPLE) if (BEAGLE_OPTIMIZE_FOR_NATIVE_ARCH)