Azzera filtri
Azzera filtri

What's the best way to create a toolbox that relies on a C library?

3 visualizzazioni (ultimi 30 giorni)
I want to create a toolbox that is essentially a wrapper for the API of a C shared/dynamic library. Obviously, the library needs to be built for the respective target system (Linux/Windows/Mac). I guess I could simply include binaries for the most common configurations in the toolbox archive, but that seems ham-fisted and is certainly not going to cover all user environments.
I know that in Python you can build the dependencies of a package during the installation process. Is there any equivalent process in MATLAB? Or is there any other best practice regarding this problem?

Risposta accettata

Simon Stone
Simon Stone il 10 Giu 2021
Modificato: Simon Stone il 10 Giu 2021
I ended up writing some code to build the library using system() calls. The toolbox is essentially a single class and when it gets instantiated, the ctor checks whether the binary library file exists and otherwise calls the function to build it from source.
Don't know if that's the best way, but it seems to be working. Thanks to CMake, it's also fairly easy to do platform-independently. But it does require the user to install some software beyond Matlab, namely CMake and some compiler.

Più risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by