Using external library with OpenFrameworks in Android


#1

I want to play some soundfont using fluidsynth and OpenFrameworks in Android. I’m new to openframeworks so I don’t know that much how it works under the hood.

What’s the best way to add some external C/C++ library? I used

to build library using ndk-build and as a result I end up with .so file. How should I link this library with OpenFramework? Or should I better just add all .c and header files to my project? Would be grateful for some tips.


#2

There is a “PLATFORM_SHARED_LIBRARIES =” line in the ofPath/libs/openFrameworksCompiled/project/android directory. I think you should add your extra library to here if you want to use it as an external library (thought i am not sure, because i didnt try this way)

Or you can use it with adding c and h files to your project and their paths to the android.mk. It is up to you. If there is not too much files, this one is a better way I think.

Or you can prepare an ofxAddon for it.


#3

you can add libraries using the config.make file in your project, adding them in PROJECT_LDFLAGS


#4

Thanks arturo for tip - this solved my problem! Working great.


#5

In of_v0.10.0_android_release, is config.make the file change to config.android.default.mk under android in openFrameworksProject? Can I add the third-party libs here?

I have a sample project using OpenGL and third-party libs, I want to integrate with openframework. The sample project has a CMakeLists.txt to add libraries and set the SDK file path. But I cannot see CMakeLists.txt in openframework android studio project both of v0.9.8 and v0.10.0.

For the general android ndk project, there is a CMakeLists.txt to import the libraries but I cannot find it in openframework android studio project. How could I do it?

It would be grateful if anyone has idea can offer guides.

Thanks