anira-project / anira

an architecture for neural network inference in real-time audio applications
https://doi.org/10.1109/IS262782.2024.10704099
Apache License 2.0
131 stars 5 forks source link

.dll from inference libs not transferred into plugin builds when including anira as subdirectory #3

Closed mchagneux closed 2 months ago

mchagneux commented 2 months ago

Hi,

When cloning anira as a subfolder and adding it with add_directory for a specific target, the .dll files associated with torch, onnx, and tensorflow are not transferred into the build artifacts. If think this has to do with PARENT_SCOPE not being set somewhere for these libs but I'm not sure. I'm using Ninja with MSVC provided from VS2022.

Thanks in advance.

mchagneux commented 2 months ago

I managed to make it work by copying the lines:

file(GLOB_RECURSE INFERENCE_ENGINE_DLLS_ONNX "${ANIRA_ONNXRUNTIME_SHARED_LIB_PATH}/*.dll")
list(APPEND NECESSARY_DLLS ${INFERENCE_ENGINE_DLLS_ONNX})

file(GLOB_RECURSE INFERENCE_ENGINE_DLLS_TFLITE "${ANIRA_TENSORFLOWLITE_SHARED_LIB_PATH}/*.dll")
list(APPEND NECESSARY_DLLS ${INFERENCE_ENGINE_DLLS_TFLITE})

file(GLOB_RECURSE INFERENCE_ENGINE_DLLS_LIBTORCH "${ANIRA_LIBTORCH_SHARED_LIB_PATH}*.dll")
list(APPEND NECESSARY_DLLS ${INFERENCE_ENGINE_DLLS_LIBTORCH})

in the parent CMakeLists.txt file of my plugin. The variable NECESSARY_DLLS only contains the anira dll when passed to a parent folder.

vackva commented 2 months ago

Hi @mchagneux, that sounds like a reasonable change! I'll look into it more closely. Thanks for reporting!

vackva commented 2 months ago

We have updated the handling of shared libraries. It is now possible to access the required shared libraries through the ANIRA_SHARED_LIBS_WIN variable, which replaces the previously used NECESSARY_DLLS.

A demonstration how to access them from a external project (anira as a submodule) can be found in the nn-inference-template plugin.