From 6f0ca5e21cffe7de1dfa53682892010bd53e92e0 Mon Sep 17 00:00:00 2001 From: "Mark A. Tsuchida" Date: Tue, 5 Sep 2023 17:06:09 -0500 Subject: [PATCH] Zaber: Copy ZML libs during Linux install For now this is the simplest way to make Zaber work when built under Linux. The copy only happens if Zaber is being built. Also restore the setting of rpath to $ORIGIN in the Zaber device adapter. --- DeviceAdapters/Zaber/Makefile.am | 2 ++ DeviceAdapters/configure.ac | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/DeviceAdapters/Zaber/Makefile.am b/DeviceAdapters/Zaber/Makefile.am index 707d59fee..4941c2be6 100644 --- a/DeviceAdapters/Zaber/Makefile.am +++ b/DeviceAdapters/Zaber/Makefile.am @@ -21,4 +21,6 @@ libmmgr_dal_Zaber_la_SOURCES = \ libmmgr_dal_Zaber_la_LIBADD = $(MMDEVAPI_LIBADD) $(ZML_LIBS) libmmgr_dal_Zaber_la_LDFLAGS = $(MMDEVAPI_LDFLAGS) $(ZML_LDFLAGS) +dist_deviceadapter_DATA = $(ZML_LIBS_TO_COPY) + EXTRA_DIST = Zaber.vcxproj Zaber.vcxproj.filters license.txt diff --git a/DeviceAdapters/configure.ac b/DeviceAdapters/configure.ac index 78420b28a..e70481f1d 100644 --- a/DeviceAdapters/configure.ac +++ b/DeviceAdapters/configure.ac @@ -404,9 +404,17 @@ if test -f "$zml_header_to_check"; then ZML_LIBS="-lzml" case $host in *linux*) - ZML_LDFLAGS="-L${thirdpartypublic}/Zaber/zaber-motion/linux-amd64/lib" ;; + # Linux builds by users should install ZML libs + zml_linux_libdir="${thirdpartypublic}/Zaber/zaber-motion/linux-amd64/lib" + ZML_LDFLAGS="-L${zml_linux_libdir} -Wl,-rpath,"'\$$ORIGIN' + ZML_LIBS_TO_COPY="${zml_linux_libdir}/libzml.so.3.4 ${zml_linux_libdir}/libzaber-motion-lib-linux-amd64.so.3.4.3" + ;; + *apple-darwin*) - ZML_LDFLAGS="-L${thirdpartypublic}/Zaber/zaber-motion/darwin/lib" ;; + # macOS build for packaging does not ship ZML + ZML_LDFLAGS="-L${thirdpartypublic}/Zaber/zaber-motion/darwin/lib" + ZML_LIBS_TO_COPY="" + ;; esac else AC_MSG_RESULT([not found]) @@ -414,6 +422,7 @@ fi AC_SUBST(ZML_CPPFLAGS) AC_SUBST(ZML_LIBS) AC_SUBST(ZML_LDFLAGS) +AC_SUBST(ZML_LIBS_TO_COPY) # Only build ... when the code is there