jatinchowdhury18 / RTNeural

Real-time neural network inferencing
BSD 3-Clause "New" or "Revised" License
571 stars 57 forks source link

Include RTNeural #33

Closed andrsymi closed 8 months ago

andrsymi commented 2 years ago

Hello, and thank you very much for sharing RTNeural!

I am a newbie in C++ world and i am trying to make a Hello World program. Just load a model an check the output. I have trouble including the library on my .cpp file I get "RTNeutral.h: No such file or directory" error.

Could you please provide some instructions on how to include this library?

Thank you!

jatinchowdhury18 commented 2 years ago

Hi!

RTNeural currently supports use with the CMake build system, and there are some instructions for using RTNeural with CMake in the README. There's also an example of using RTNeural as part of a minimal audio plugin here. I can work on making some more examples as well, but the overall approach should be pretty well described in those places.

Specifically, to include RTNeural with CMake, you'll want to include these lines in your CMakeLists.txt:

set(RTNEURAL_STL ON CACHE BOOL "Use RTNeural with this backend" FORCE) # choose a backend (optional)
add_subdirectory(path/to/RTNeural) # add the RTNeural library
include_directories(path/to/RTNeural) # add the RTNeural directory to your include paths (target_include_directories works too)

Since the last line there adds the RTNeural root directory to your include paths, then to include the header file in your project, you should be able to do:

#include <RTNeural/RTNeural.h>

Please let me know if anything in the documentation is not clear, and I can work to improve it. If there's more specific errors that you're running into with your program, definitely let me know and I can try to support with that as well!

andrsymi commented 2 years ago

Wow super fast! Thanks!

It seems that I managed to compile a dummy program... Since I am not keen with Cmake and not very experienced with C++, my question is: Is it possible (and how) to include RTNeuron without Cmake?

Thank you very very much again for your quick response and also for sharing this amazing work! I will get back if get stuck as I get to more complex stuff. I will also be happy to contribute some examples or more implementations as I proceed with my work :)

jatinchowdhury18 commented 2 years ago

Glad to hear it's compiling! It should be possible to use the library without CMake. For example, you could write a Makefile or create Visual Studio or Xcode project that links to the library. The trick will be to build the necessary files and include the necessary paths for RTNeural, as well as the dependencies (see the modules/ folder). I haven't tried it before, but I believe it should be possible.