Hello folks, I'm new to the Android NDK, MediaNDK and so on.
At the moment, I am trying to set up a simple, hello-world-like project to learn and understand what the canonical way of integrating the NDK looks like.
I am struggling with quite a few things, so let me show some code first.
CMakeLists.txt
src/main.cpp
Which yields the following message when building.

This does not surprise me too much, because I have added no include directories whatsoever. So how do I do that correctly? I've found it's possible to use one of the provided toolchain files, which I hoped would take care of that for me but somehow didn't work.
Also I just noticed, that NdkMediaCodec.h is located in a bit of an unexpected location at:
/opt/homebrew/Caskroom/android-ndk/24/AndroidNDK8215888.app/Contents/NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/media/NdkMediaCodec.h
I have also found guides that recommended calling find_library(mediandk-lib mediandk), but one comment from, iirc, Dan in some of the GitHub issues says that was never really necessary.
I've been mostly following these guides:
Also, to be clear: This is not supposed to live inside of an Android Studio project; The way our C++ library is set up at the moment is a C++ repository in itself. We build and then publish to a Maven repository from which our Android app consumes the library. We have been using polly and Hunter package manager so far. The latter has been replaced by Conan, but polly sticks around and I would like to get rid of that bloat.
So to sum up, these are questions that still puzzle me:
- Is my general approach correct? Which parts are wrong?
- Do I need to explicitly set a toolchain file as in a certain android.toolchain.cmake, or is a folder enough or should it also work without providing a CMAKE_ANDROID_STANDALONE_TOOLCHAIN or CMAKE_TOOLCHAIN_FILE?
- Would using the CMake Standalone Toolchain [1] file way be more convenient and preferable over the 'regular' Cross-Compiling for Android with the NDK [2]?
- How should setting the include directories be handled?
- Should I use a find_library() call?
Any advice is appreciated, maybe he have a fundamentally wrong concept of how this is supposed to be done. Thank you!