Has anyone attempted to use the new Visual Studio NDK support with a NDK more recent than what comes with Visual Studio (which is ancient r16)? I’ve been trying to get this working for a while now and with the changes made on CMake master and NDK master recently, it should work. In my testing, I can get Ninja to work with a continuous build of NDK from today (see here) and CMake master, but using the Visual Studio generator, it fails at the compiler check stage. It seems like the LLVM compilers from Visual Studio are being used instead of the ones from the NDK, but I can’t be sure since there’s a few levels of compiler flags involved which may be forwarding things on. Here’s an example command line I’ve been using:
cmake -G "Visual Studio 16" -A ARM64 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=path/to/my/toolchain.cmake path/to/project/source/dir
-A ARM64 is a bit of an experiment. It fails with or without it. The contents of my toolchain file are pretty straightforward:
set(CMAKE_SYSTEM_NAME Android) set(CMAKE_ANDROID_NDK C:/Users/craig/AppData/Local/Android/Sdk/ndk/23.0.7045647) # My copy of the continuous build set(CMAKE_ANDROID_ARCH_ABI arm64-v8a) set(CMAKE_ANDROID_STL_TYPE c++_shared)
CMakeOutput.log from the above setup:
I will also point out that the output in
CMakeError.log shows that Visual Studio is ignoring
CMAKE_ANDROID_NDK and is setting the
NDK_ROOT environment variable to the value providing in the Visual Studio settings under the Tools > Options… > Cross Platform > C++ > Android settings. But even if I update those settings to match my desired NDK root, it still fails.
Just curious if I’m missing something or whether the Visual Studio support for NDK is not actually finished work.