File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ if(UNIX AND NOT APPLE)
4040 # before darktable has a chance to check the AI-enabled preference.
4141 # Also suppresses harmless "already registered" ONNX schema warnings
4242 # from system packages that link against libonnx.
43+ # Use just the filename (not the full build-tree path) so g_module_open
44+ # resolves it via LD_LIBRARY_PATH / system linker search. This is required
45+ # for AppImage where the build-tree path does not exist at runtime.
46+ get_filename_component (_ORT_LIB_NAME "${ONNXRuntime_LIBRARIES} " NAME )
4347 target_compile_definitions (darktable_ai PRIVATE
4448 ORT_LAZY_LOAD=1
45- ORT_LIBRARY_PATH= "${ONNXRuntime_LIBRARIES } " )
49+ ORT_LIBRARY_PATH= "${_ORT_LIB_NAME } " )
4650 target_include_directories (darktable_ai PRIVATE ${ONNXRuntime_INCLUDE_DIRS} )
4751else ()
4852 target_link_libraries (darktable_ai PUBLIC onnxruntime::onnxruntime )
Original file line number Diff line number Diff line change @@ -70,6 +70,14 @@ cp -a /usr/lib/$ARCH-linux-gnu/libgphoto2_port/* ../AppDir/usr/lib/libgphoto2_po
7070mkdir -p ../AppDir/usr/lib/gio
7171cp -a /usr/lib/$ARCH -linux-gnu/gio/* ../AppDir/usr/lib/gio
7272
73+ # Include ONNX Runtime library. ORT is loaded via dlopen (ORT_LAZY_LOAD) so
74+ # linuxdeploy can't detect it automatically. Copy from the build tree.
75+ ORT_LIB_DIR=$( cmake -LA -N ../build 2> /dev/null | grep ONNXRuntime_LIB_DIR:PATH | cut -d= -f2)
76+ if [ -d " $ORT_LIB_DIR " ]; then
77+ cp -a " $ORT_LIB_DIR " /libonnxruntime* .so* ../AppDir/usr/lib/
78+ echo " Bundled ONNX Runtime from $ORT_LIB_DIR "
79+ fi
80+
7381# Since linuxdeploy is itself an AppImage, we don't rely on it being installed
7482# on the build system, but download it every time we run this script. If that
7583# doesn't suit you (for example, you want to build an AppImage without an
You can’t perform that action at this time.
0 commit comments