The new toolchain file requires Android NDK r12b and above. Default to use 'arm-linux-androideabi-clang' toolchain and LLVM libc++ STL runtime.
Align all the compiler and linker flags according to new ndk-build configuration in Android NDK r12b, i.e. no more '-f[no-]strict-aliasing' and '-f[no-]omit-frame-pointer', but more stringent warnings check.
Improve over the old toolchain file where most of the options are now changeable after the initial configuration. The exceptions are ANDROID_NDK and ANDROID_TOOLCHAIN_NAME due to limitation of CMake.
Close#1441.
Other changes in this commit includes:
- Fix Android sample launcher app to support shared C++ STL runtime library.
- Remove temporary fix in FindUrho3D module as it is not required anymore with our new toolchain file.
- Fix Log::WriteRaw() method to pass the parameters correctly to __android_log_print() function.
- Fix enable_pch() macro to emit -fPIC compiler flags correctly based on target's POSITION_INDEPENDENT_CODE property.
- Fix linker flags for ld.bfd where it needs help to find the location of the rooted shared libraries. The flags are not required for ld.gold but they do no harm for gold linker.
- Enhance the CheckCompilerToolchain module to auto-detect if the NEON SIMD is enabled or not for Android build (based on the chosen ANDROID_ABI).
Due to the CMake try_compile() limitation, initial build option values (i.e. not env-vars) were not visible to all the CMake checks during inital configuration, preventing the build option from functioning as expected.
Some cross-compiling build tree configuration needs native compiler toolchain for host tool building via ExternalProject_Add(). This additional check ensures the native compiler toolchain is available up front before the build tree is even generated. Close#1300.
A new issue or PR will be submitted to Emscripten upstream to have this bug fixed properly. Until such time we can do a emcc version check to skip this workaround when it is not required anymore.
Also add new compiler flag for Clang to suppress the unused '-mno-sse' warnings.
For CI - switch all the Android CI jobs to use Clang compiler toolchian instead of GCC compiler toolchain. The old GCC 4.9 is not able to handle C++11 standard for AS wrapper. Besides, the latest change log in Android NDK has marked GCC as deprecated and recommended developers to migrate to Clang.
Add a new build option "ARM_ABI_FLAGS" for supplying additional ABI compiler flags when targeting generic arm.
Fix Linux build from using OpenGLES instead of GLEW, fix RPI build from using wrong OpenGLES library, fix iOS build from using arm-specific compiler flags directly which would cause problem in universal binary build containing iphonesimulator archs as well.
And other minor refactoring.
- Fix the regex to get the shared library soname correctly.
- Use the GCC_ATOMIC and CLOCK_GETTIME whenever they are available.
- Reorganize the if-else block in the SDL CMakeLists.txt to prevent Unix-like platforms (e.g. Android) from entering the block meant for genuine Unix/Linux.
- and more.