Closed ccochran closed 5 years ago
I'm making progress on this issue... it's a matter of setting the correct toolchain path.
Hi @ccochran
If it's any help we have VulkanSceneGraph working with the latest NDK on Android
https://github.com/vsg-dev/VulkanSceneGraphPrototype/blob/master/CMakeLists.txt
The CMakeLists.txt is a lot simpler than osg and is using C++17 so maybe the defaults for the newest NDK aren't playing nicely with some of the older features osg is needing.
If you have any more issues post them here and I can take a peek (sorry for the slow reply on this one)
Hi @tomhog,
Thanks, I've been peeking over there ;) -- NP I know you guys are hard at work on VSG.
From what I understand, CMake now natively supports Android but conflicts with the NDK version of CMake (each have their own toolchain). In addition, OSG has a ~6 year old toolchain that threw me off.
In any case, I successfully built OSG 3.6.4 and 3rd party decencies for Android 64bit platforms (I only need png, jpeg, freetype, and zlib) and my app is running solid on Android 64bit test devices. I used the CMake 3.14 native toolchain, however now I'm experimenting with using the NDK's toolchain because I feel like that would be more appropriate.
Once I get things sorted out I'll submit a PR with changes for review.
Are you using the NDK CMake (3.6 i think) and toolchain or CMake's native toolchain for Vulkan? Thanks
I successfully built OSG for Android using NDK r19c, CMake 3.14, and most importantly, the NDK toolchain. Although CMake now supports Android natively with its own toolchain and settings, its use will soon be deprecated due to conflicts with Google's toolchains https://gitlab.kitware.com/cmake/cmake/issues/18787.
Here is an excerpt from my script I wrote to build OSG for all Android ABIs.
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${ndkHome}/build/cmake/android.toolchain.cmake \
-DANDROID_STL=c++_static \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_PLATFORM=android-21 \
-DANDROID_ABI=${abi} \
-DCMAKE_INSTALL_PREFIX="../${installDir}/${abi}" \
-DOPENGL_PROFILE="GLES1" \
-DDYNAMIC_OPENTHREADS=OFF \
-DDYNAMIC_OPENSCENEGRAPH=OFF
This was the most useful post that helped me along the way: https://gitlab.kitware.com/cmake/cmake/issues/18739#note_510784
@tomhog you may want to consider using the NDK toolchain for VSG based on these findings.
The Android build works fine in all previous versions of the NDK (18 and below), however as of 19c (latest) CMake 3.14 errors out, running on macOS. I think @tomhog solved a very similar issue for iOS recently, maybe he could provide some insight. I've been trying to fix without success, however I did notice clang was upgraded to 8.0.2 from the 7 series in NDK 19c.
CMake (3.14) command:
Output: