⚙️ Using prebuilt libraries on Android
When linking against FluidSynth on Android builds, you have to link not only fluidsynth.so but also all the other libraries that are included in the release, and some that are not included but are part of the Android NDK such as OpenMP. If you fail to do so your project may compile, but will fail at runtime because of missing dependencies.
CMake example
-
Add the fluidsynth library
-
Add the dependencies included in the release
Repeat the process with all the dependencies included (libFLAC, liboboe, libopus...).
-
Add the dependencies included in Android NDK (OpenMP)
-
Put the pieces together under a single library
add_library(fluidsynth INTERFACE) target_link_libraries(fluidsynth INTERFACE libFLAC libfluidsynth-assetloader libgio-2.0 libglib-2.0 libgmodule-2.0 libgobject-2.0 libgthread-2.0 libinstpatch-1.0 liboboe libogg libopus libpcre libpcreposix libsndfile libvorbis libvorbisenc libvorbisfile libfluidsynth OpenMP::OpenMP_CXX ) -
And finally link the library to your project!