fmtlog
fmtlog copied to clipboard
Fix android ndk build
So I believe this PR fixes the issues related to building with Android NDK.
NDK Version: 23.1.7779620
CMake version: 3.22.1
Build command:
BUILD_DIR=${BUILD_DIR:-.build}
ANDROID_NDK_CMAKE="-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_API=24 -DANDROID_PLATFORM=24 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_ANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_CXX_STANDARD=20 -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -DFMTLOG_IGNORE_SHARED=TRUE -DFMTLOG_SKIP_BENCHMARKS=TRUE -DFMTLOG_SKIP_TEST_BUILD=TRUE"
mkdir -p "$BUILD_DIR" \
&& cd "$BUILD_DIR" \
&& cmake $ANDROID_NDK_CMAKE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..\
&& cmake --build . -j
For whatever reason, the tests and benchmarks do not compile on NDK and they seem to be a bigger problem to solve than skip. For the purposes of this PR, I'll just be skipping them as I don't believe they are critical.
However, I do imagine that building the shared library is important. I'm not sure why CMake cannot properly link functions to fmt
while building shared. I do know that it works if you build without NDK though.
I'm willing to provide logs if required. Cheers