Browse Source

Cleanup CMake build scripts and documentation update.
Close #743.

Yao Wei Tjong 姚伟忠 7 years ago
parent
commit
0fc21934f5

+ 3 - 60
CMake/Modules/UrhoCommon.cmake

@@ -88,7 +88,7 @@ elseif (TVOS)
         set (TVOS_SYSROOT ${TVOS_SYSROOT} CACHE INTERNAL "Path to tvOS system root")
         set (TVOS_SYSROOT ${TVOS_SYSROOT} CACHE INTERNAL "Path to tvOS system root")
     endif ()
     endif ()
     set (CMAKE_FIND_ROOT_PATH ${TVOS_SYSROOT})
     set (CMAKE_FIND_ROOT_PATH ${TVOS_SYSROOT})
-    set (APPLETVOS_DEPLOYMENT_TARGET "" CACHE STRING "Specify tvOS deployment target (tvOS platform only); default to latest installed tvOS SDK if not specified")
+    set (APPLETVOS_DEPLOYMENT_TARGET "" CACHE STRING "Specify AppleTV OS deployment target (tvOS platform only); default to latest installed tvOS SDK if not specified, the minimum supported target is 9.0")
     set (CMAKE_XCODE_ATTRIBUTE_APPLETVOS_DEPLOYMENT_TARGET ${APPLETVOS_DEPLOYMENT_TARGET})
     set (CMAKE_XCODE_ATTRIBUTE_APPLETVOS_DEPLOYMENT_TARGET ${APPLETVOS_DEPLOYMENT_TARGET})
     set (CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
     set (CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
     # Just in case it has similar bug for tvOS build
     # Just in case it has similar bug for tvOS build
@@ -205,7 +205,7 @@ if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     option (URHO3D_PLAYER "Build Urho3D script player" TRUE)
     option (URHO3D_PLAYER "Build Urho3D script player" TRUE)
     option (URHO3D_SAMPLES "Build sample applications" TRUE)
     option (URHO3D_SAMPLES "Build sample applications" TRUE)
     option (URHO3D_UPDATE_SOURCE_TREE "Enable commands to copy back some of the generated build artifacts from build tree to source tree to facilitate devs to push them as part of a commit (for library devs with push right only)")
     option (URHO3D_UPDATE_SOURCE_TREE "Enable commands to copy back some of the generated build artifacts from build tree to source tree to facilitate devs to push them as part of a commit (for library devs with push right only)")
-    option (URHO3D_BINDINGS "Enable API binding generation support for script subystems")
+    option (URHO3D_BINDINGS "Enable API binding generation support for script subsystems")
     cmake_dependent_option (URHO3D_CLANG_TOOLS "Build Clang tools (native on host system only)" FALSE "NOT CMAKE_CROSSCOMPILING" FALSE)
     cmake_dependent_option (URHO3D_CLANG_TOOLS "Build Clang tools (native on host system only)" FALSE "NOT CMAKE_CROSSCOMPILING" FALSE)
     mark_as_advanced (URHO3D_UPDATE_SOURCE_TREE URHO3D_BINDINGS URHO3D_CLANG_TOOLS)
     mark_as_advanced (URHO3D_UPDATE_SOURCE_TREE URHO3D_BINDINGS URHO3D_CLANG_TOOLS)
     cmake_dependent_option (URHO3D_TOOLS "Build tools (native, RPI, and ARM on Linux only)" TRUE "NOT IOS AND NOT TVOS AND NOT ANDROID AND NOT WEB" FALSE)
     cmake_dependent_option (URHO3D_TOOLS "Build tools (native, RPI, and ARM on Linux only)" TRUE "NOT IOS AND NOT TVOS AND NOT ANDROID AND NOT WEB" FALSE)
@@ -282,12 +282,6 @@ if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND NOT APPLE)
 else ()
 else ()
     unset (URHO3D_SCP_TO_TARGET CACHE)
     unset (URHO3D_SCP_TO_TARGET CACHE)
 endif ()
 endif ()
-if (ANDROID)
-    set (ANDROID TRUE CACHE INTERNAL "Setup build for Android platform")
-    cmake_dependent_option (ANDROID_NDK_GDB "Enable ndk-gdb for debugging (Android platform only)" FALSE "CMAKE_BUILD_TYPE STREQUAL Debug" FALSE)
-else ()
-    unset (ANDROID_NDK_GDB CACHE)
-endif ()
 if (MINGW AND CMAKE_CROSSCOMPILING)
 if (MINGW AND CMAKE_CROSSCOMPILING)
     set (MINGW_PREFIX "" CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)")
     set (MINGW_PREFIX "" CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)")
     set (MINGW_SYSROOT "" CACHE PATH "Path to MinGW system root (MinGW only); should only be used when the system root could not be auto-detected")
     set (MINGW_SYSROOT "" CACHE PATH "Path to MinGW system root (MinGW only); should only be used when the system root could not be auto-detected")
@@ -1619,36 +1613,6 @@ macro (setup_main_executable)
         if (DEST_LIBRARY_DIR)
         if (DEST_LIBRARY_DIR)
             install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
             install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
         endif ()
         endif ()
-#        # Copy other dependent shared libraries to Android library output path
-#        if (ANDROID_STL MATCHES shared)
-#            # Android toolchain may already copy a shared C++ STL runtime to library output path,
-#            # still we configure another post build command to copy the runtime and its clean up here for consistency sake
-#            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-#                COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${STL_LIBRARY_DIR}/lib${ANDROID_STL}.so ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib${ANDROID_STL}.so)
-#            add_make_clean_files (${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib${ANDROID_STL}.so)
-#        endif ()
-#        foreach (FILE ${ABSOLUTE_PATH_LIBS})
-#            get_filename_component (EXT ${FILE} EXT)
-#            if (EXT STREQUAL .so)
-#                get_filename_component (NAME ${FILE} NAME)
-#                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-#                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}
-#                    COMMENT "Copying ${NAME} to library output directory")
-#                add_make_clean_files (${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/${NAME})
-#            endif ()
-#        endforeach ()
-#        if (ANDROID_NDK_GDB)
-#            # Copy the library while it still has debug symbols for ndk-gdb
-#            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-#                COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
-#                COMMENT "Copying lib${TARGET_NAME}.so with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
-#            add_make_clean_files (${NDK_GDB_SOLIB_PATH}/$<TARGET_FILE_NAME:${TARGET_NAME}>)
-#        endif ()
-        # When performing packaging, include the final apk file
-        if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT APK_INCLUDED)
-            install (FILES ${LIBRARY_OUTPUT_PATH_ROOT}/bin/Urho3D-debug.apk DESTINATION ${DEST_RUNTIME_DIR} OPTIONAL)
-            set (APK_INCLUDED 1)
-        endif ()
     else ()
     else ()
         # Setup target as executable
         # Setup target as executable
         if (WIN32)
         if (WIN32)
@@ -1959,28 +1923,7 @@ if (NOT DEST_RUNTIME_DIR)
     set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
     set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
 endif ()
 endif ()
 
 
-if (ANDROID)
-    # TODO: Verify if this setup still works with Android NDK 13 and above
-    # Enable Android ndk-gdb, if the build option is enabled
-    if (ANDROID_NDK_GDB)
-        set (NDK_GDB_SOLIB_PATH ${CMAKE_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
-        file (MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
-        set (NDK_GDB_JNI ${CMAKE_BINARY_DIR}/jni)
-        set (NDK_GDB_MK "# This is a generated file. DO NOT EDIT!\n\nAPP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
-        foreach (MK Android.mk Application.mk)
-            if (NOT EXISTS ${NDK_GDB_JNI}/${MK})
-                file (WRITE ${NDK_GDB_JNI}/${MK} ${NDK_GDB_MK})
-            endif ()
-        endforeach ()
-        get_directory_property (INCLUDE_DIRECTORIES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
-        string (REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")   # Note: need to always "stringify" a variable in list context for replace to work correctly
-        set (NDK_GDB_SETUP "# This is a generated file. DO NOT EDIT!\n\nset solib-search-path ${NDK_GDB_SOLIB_PATH}\ndirectory ${INCLUDE_DIRECTORIES}\n")
-        file (WRITE ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/gdb.setup ${NDK_GDB_SETUP})
-        file (COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME})
-    else ()
-        file (REMOVE ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/gdbserver)
-    endif ()
-elseif (WEB)
+if (WEB)
     if (EMSCRIPTEN_SHARE_DATA AND NOT EXISTS ${CMAKE_BINARY_DIR}/Source/pak-loader.js)
     if (EMSCRIPTEN_SHARE_DATA AND NOT EXISTS ${CMAKE_BINARY_DIR}/Source/pak-loader.js)
         file (WRITE ${CMAKE_BINARY_DIR}/Source/pak-loader.js "var Module;if(typeof Module==='undefined')Module=eval('(function(){try{return Module||{}}catch(e){return{}}})()');var s=document.createElement('script');s.src='${CMAKE_PROJECT_NAME}.js';document.body.appendChild(s);Module['preRun'].push(function(){Module['addRunDependency']('${CMAKE_PROJECT_NAME}.js.loader')});s.onload=function(){Module['removeRunDependency']('${CMAKE_PROJECT_NAME}.js.loader')};")
         file (WRITE ${CMAKE_BINARY_DIR}/Source/pak-loader.js "var Module;if(typeof Module==='undefined')Module=eval('(function(){try{return Module||{}}catch(e){return{}}})()');var s=document.createElement('script');s.src='${CMAKE_PROJECT_NAME}.js';document.body.appendChild(s);Module['preRun'].push(function(){Module['addRunDependency']('${CMAKE_PROJECT_NAME}.js.loader')});s.onload=function(){Module['removeRunDependency']('${CMAKE_PROJECT_NAME}.js.loader')};")
     endif ()
     endif ()

+ 0 - 611
CMake/Toolchains/Android.cmake

@@ -1,611 +0,0 @@
-#
-# Copyright (c) 2016-2017 Yao Wei Tjong. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Modified by Yao Wei Tjong for Urho3D
-
-#
-# This CMake toolchain file is designed to work with both cmake-gui and cmake CLI.
-# It is inspired from https://github.com/taka-no-me/android-cmake/android.toolchain.cmake,
-# most of its options are kept for compatibility, however, the possible values for each option are not identical.
-#
-# Options:
-#   ANDROID_NDK - path to the NDK root.
-#     Can be set as environment variable.
-#     NOTE: This option cannot be changed after the initial configuration/generation.
-#
-#   ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang - the name of compiler toolchain to be used.
-#     The possible values are derived from the prebuilt compiler toolchains in the Android NDK.
-#     NOTE: This option cannot be changed after the initial configuration/generation.
-#
-#   ANDROID_ABI=armeabi-v7a - specifies the target Application Binary Interface (ABI).
-#     This option nearly matches to the APP_ABI variable used by ndk-build tool from Android NDK.
-#
-#     Possible targets are:
-#       1) For arm arch:
-#          armeabi-v7a - ARMv7 based devices with hardware FPU instructions but software floating-point calling convention (softfp).
-#          armeabi-v6 - ARMv6 based devices with hardware FPU instructions but software floating-point calling convention (softfp).
-#          armeabi - ARMv5TE based CPU with software floating point operations (soft).
-#
-#          These ABI options can be combined with one of the below modifiers to specify which hardware FPU to use:
-#          "with neon-vfpv4" - Use NEON SIMD and VFPv4.
-#          "with neon" - Use NEON SIMD and VFPv3.
-#          "with vfpv4" - Use VFPv4.
-#          "with vfpv3" - Use VFPv3 (32 registers).
-#          "with vfpv3-d16" - Use VFPv3 (16 registers). This is the default for ARMv7.
-#          "with vfp" - Use VFPv2. This is the default and the only possible combination for ARMv6.
-#
-#       2) For aarch64 arch:
-#          arm64-v8a - ARMv8 AArch64 instruction set.
-#
-#       3) For i686 arch:
-#          x86 - IA-32 instruction set.
-#
-#       4) For x86_64 arch:
-#          x86_64 - Intel64 instruction set.
-#
-#       5) For mipsel arch:
-#          mips - MIPS32 instruction set.
-#
-#       6) For mips64el arch:
-#          mips64 - MIPS64 instruction set.
-#
-#   ANDROID_NATIVE_API_LEVEL=android-9 - level of Android API compile for.
-#     The default level is android-21 when targeting any of the 64-bit ABIs.
-#     NOTE: The level must not be larger than android:minSdkVersion in AndroidManifest.xml.
-#
-#   ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions instead of Thumb.
-#     This option is only available for arm arch.
-#
-#   ANDROID_STACK_PROTECTION=OFF - set ON to force the addition of a stack canary that checks for stack smashing.
-#     When it is ON the generated binary may be larger in size and slower in performance.
-#     Unlike ndk-build, it is defaulted to OFF.
-#
-#   ANDROID_NO_UNDEFINED=ON - set ON to show all undefined symbols as linker errors even if they are not used.
-#
-#   ANDROID_NOEXECSTACK=ON - set ON to enforce the NX (no execute) security feature in the generated machine code.
-#
-#   ANDROID_RELRO=ON - set ON to mark certain regions of the resulting executable or shared library as being read-only.
-#
-#   ANDROID_FATAL_WARNINGS=ON - set ON to treat all linker warnings as errors.
-#
-#   ANDROID_FORMAT_SECURITY=ON - set ON to provide compiler protection against format string vulnerabilities.
-#
-#   ANDROID_FUNCTION_LEVEL_LINKING=ON - set ON to split data/function sections and garbage collect unused sections at link time.
-#     This option may be turned off to avoid potential debugging problems in Debug build configuration.
-#
-#   ANDROID_STL=system - specify the C++ STL runtime to use.
-#     When ANDROID_STL_FORCE_FEATURES is ON then it auto-configures the RTTI and exceptions settings to ON for any runtime chosen,
-#     except for default system runtime.
-#     NOTE: Use shared runtime when your project contains multiple shared libraries or executables.
-#           Otherwise, the build system does not define certain global uniquely, which can result in unpredictable runtime behavior.
-#           This behavior may include crashes and failure to properly catch exceptions.
-#
-#     Possible values are:
-#       system         -> Use the minimal system C++ runtime library. Implies -fno-rtti -fno-exceptions.
-#       gabi++_static  -> Use the GAbi++ runtime as a static library.
-#       gabi++_shared  -> Use the GAbi++ runtime as a shared library.
-#       stlport_static -> Use the STLport runtime as a static library. STLport is licensed under BSD-like license.
-#       stlport_shared -> Use the STLport runtime as a shared library.
-#       gnustl_static  -> Use the GNU libstdc++ as a static library. GNU libstdc++ is licensed under GPLv3 + linking exception.
-#       gnustl_shared  -> Use the GNU libstdc++ as a shared library.
-#       c++_static     -> Use the LLVM libc++ runtime as a static library. LLVM libc++ is licensed under BSD-Like and MIT license.
-#       c++_shared     -> Use the LLVM libc++ runtime as a shared library.
-#
-#   ANDROID_STL_FORCE_FEATURES=ON - automatically configure rtti and exceptions settings based on the chosen C++ STL runtime.
-#     If disabled, then the user is responsible for setting ANDROID_RTTI and ANDROID_EXCEPTIONS options manually.
-#
-#   ANDROID_RTTI=ON - set ON to enable RTTI.
-#     This option is only available when ANDROID_STL_FORCE_FEATURES is disabled.
-#
-#   ANDROID_EXCEPTIONS=ON - set ON to enable C++ exceptions.
-#     This option is only available when ANDROID_STL_FORCE_FEATURES is disabled.
-#
-
-cmake_minimum_required (VERSION 3.2.3)
-mark_as_advanced (CMAKE_TOOLCHAIN_FILE)
-set (CMAKE_SYSTEM_NAME Android)
-set (CMAKE_SYSTEM_VERSION 1)
-set (CMAKE_POSITION_INDEPENDENT_CODE 1)
-set (ANDROID 1)
-
-# Prevent critical variables from changing after the initial configuration
-if (CMAKE_CROSSCOMPILING)
-    set (SAVED_ANDROID_NDK ${ANDROID_NDK} CACHE INTERNAL "Initial value for ANDROID_NDK")
-    set (SAVED_ANDROID_TOOLCHAIN_NAME ${ANDROID_TOOLCHAIN_NAME} CACHE INTERNAL "Initial value for ANDROID_TOOLCHAIN_NAME")
-    # Urho3D - save the initial values of CC and CXX environment variables
-    set (SAVED_CC $ENV{CC} CACHE INTERNAL "Initial value for CC")
-    set (SAVED_CXX $ENV{CXX} CACHE INTERNAL "Initial value for CXX")
-    return ()
-elseif ((SAVED_ANDROID_NDK AND NOT SAVED_ANDROID_NDK STREQUAL ANDROID_NDK) OR (SAVED_ANDROID_TOOLCHAIN_NAME AND NOT SAVED_ANDROID_TOOLCHAIN_NAME STREQUAL ANDROID_TOOLCHAIN_NAME))
-    set (ANDROID_NDK ${SAVED_ANDROID_NDK} CACHE PATH "Path to Android NDK (Android platform only)" FORCE)
-    set (ANDROID_TOOLCHAIN_NAME ${SAVED_ANDROID_TOOLCHAIN_NAME} CACHE STRING "Specify the name of compiler toolchain (Android platform only), possible values depends on installed Android NDK, default to Clang compiler toolchain" FORCE)
-    message (FATAL_ERROR "ANDROID_NDK and ANDROID_TOOLCHAIN_NAME cannot be changed after the initial configuration/generation. "
-        "Auto reverting to its initial value. If you wish to change it then the build tree would have to be regenerated from scratch.")
-endif ()
-
-# Workaround try_compile() limitation where it cannot see cache variables and it is a waste of time to reinit everything all over
-get_property (IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
-if (NOT IN_TRY_COMPILE)
-    # Android NDK paths
-    if (NOT SAVED_ANDROID_NDK)
-        if (NOT ANDROID_NDK AND DEFINED ENV{ANDROID_NDK})
-            file (TO_CMAKE_PATH $ENV{ANDROID_NDK} ANDROID_NDK)
-        endif ()
-        set (ANDROID_NDK ${ANDROID_NDK} CACHE PATH "Path to Android NDK (Android platform only)")
-        if (NOT EXISTS ${ANDROID_NDK})
-            message (FATAL_ERROR "Could not find Android NDK. "
-                "Use ANDROID_NDK environment variable or build option to specify the location of Android NDK.")
-        endif ()
-    endif ()
-    if (NOT ANDROID_NDK_VERSION)
-        if (EXISTS ${ANDROID_NDK}/source.properties)
-            file (STRINGS ${ANDROID_NDK}/source.properties LINE LIMIT_COUNT 1 REGEX [0-9]+\\.[0-9]+\\.[0-9]+)
-        endif ()
-        if (LINE MATCHES "([0-9]+\\.[0-9]+\\.[0-9]+)")
-            set (ANDROID_NDK_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "Android NDK version")
-        endif ()
-        if (ANDROID_NDK_VERSION LESS 12)
-            unset (ANDROID_NDK_VERSION CACHE)
-            message (FATAL_ERROR "Unsupported Android NDK version. This toolchain file only supports Android NDK r12 onward.")
-        endif ()
-    endif ()
-    set (ANDROID_NDK_TOOLCHAINS_CONFIG_PATH ${ANDROID_NDK}/build/core/toolchains)
-    set (ANDROID_NDK_TOOLCHAINS_PATH ${ANDROID_NDK}/toolchains)
-    if (NOT ANDROID_NDK_HOST_SYSTEM_NAME)
-        file (GLOB ANDROID_NDK_HOST_SYSTEM_NAME RELATIVE ${ANDROID_NDK_TOOLCHAINS_PATH}/llvm/prebuilt ${ANDROID_NDK_TOOLCHAINS_PATH}/llvm/prebuilt/*)
-        set (ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME} CACHE INTERNAL "Android NDK host system name")
-    endif ()
-    set (ANDROID_NDK_TOOLCHAINS_SUBPATH /prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME})
-
-    # Android compiler toolchains
-    if (NOT SAVED_ANDROID_TOOLCHAIN_NAME)
-        set (ANDROID_DEFAULT_TOOLCHAIN_NAME arm-linux-androideabi-clang)
-        set (ANDROID_TOOLCHAIN_NAME ${ANDROID_DEFAULT_TOOLCHAIN_NAME} CACHE STRING "Specify the name of compiler toolchain (Android platform only), default to ${ANDROID_DEFAULT_TOOLCHAIN_NAME}")
-        file (GLOB ANDROID_SUPPORTED_TOOLCHAINS RELATIVE ${ANDROID_NDK_TOOLCHAINS_CONFIG_PATH} ${ANDROID_NDK_TOOLCHAINS_CONFIG_PATH}/*)
-        list (SORT ANDROID_SUPPORTED_TOOLCHAINS)
-        set_property (CACHE ANDROID_TOOLCHAIN_NAME PROPERTY STRINGS ${ANDROID_SUPPORTED_TOOLCHAINS})
-        list (FIND ANDROID_SUPPORTED_TOOLCHAINS "${ANDROID_TOOLCHAIN_NAME}" FOUND_INDEX)    # Stringify as the actual variable may be empty
-        if (FOUND_INDEX EQUAL -1)
-            string (REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_TOOLCHAINS "\"${ANDROID_SUPPORTED_TOOLCHAINS}\"")
-            message (FATAL_ERROR "Unrecognized '${ANDROID_TOOLCHAIN_NAME}' specified in the ANDROID_TOOLCHAIN_NAME option, "
-                "supported values are: ${PRINTABLE_ANDROID_SUPPORTED_TOOLCHAINS}.")
-        endif ()
-        set (ANDROID_TOOLCHAIN_ROOT ${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_TOOLCHAIN_NAME}${ANDROID_NDK_TOOLCHAINS_SUBPATH})
-        if (ANDROID_TOOLCHAIN_NAME MATCHES "-clang.*$")
-            set (ANDROID_CLANG_TOOLCHAIN_ROOT ${ANDROID_NDK_TOOLCHAINS_PATH}/llvm${ANDROID_NDK_TOOLCHAINS_SUBPATH} CACHE INTERNAL "Clang toolchain root if using Clang")
-            set (CLANG CLANG_ CACHE INTERNAL "Non empty if using Clang")
-            # Check if it still depends on GCC toolchain for assembler and linker support (assume 4.9 is the last deprecated GCC version supported by Android NDK)
-            file (STRINGS ${ANDROID_NDK_TOOLCHAINS_CONFIG_PATH}/${ANDROID_TOOLCHAIN_NAME}/setup.mk ANDROID_ROOT_${ANDROID_TOOLCHAIN_NAME} REGEX ^TOOLCHAIN_ROOT.*-4.9)
-            if (ANDROID_ROOT_${ANDROID_TOOLCHAIN_NAME})
-                string (REGEX REPLACE -clang.*$ -4.9 GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}")
-                set (ANDROID_TOOLCHAIN_ROOT ${ANDROID_NDK_TOOLCHAINS_PATH}/${GCC_TOOLCHAIN_NAME}${ANDROID_NDK_TOOLCHAINS_SUBPATH})
-            endif ()
-        endif ()
-        set (ANDROID_TOOLCHAIN_ROOT ${ANDROID_TOOLCHAIN_ROOT} CACHE INTERNAL "GCC toolchain root")
-    endif ()
-    string (REGEX REPLACE -[^-]+$ "" ANDROID_TOOLCHAIN_MACHINE_NAME "${ANDROID_TOOLCHAIN_NAME}")
-    string (REGEX REPLACE -.*$|el "" MACHINE_ARCH "${ANDROID_TOOLCHAIN_MACHINE_NAME}")
-    if (ANDROID_TOOLCHAIN_MACHINE_NAME MATCHES x86)
-        string (REGEX REPLACE ^x86- i686- ANDROID_TOOLCHAIN_MACHINE_NAME "${ANDROID_TOOLCHAIN_MACHINE_NAME}-linux-android")
-    endif ()
-
-    # Android ABIs
-    if (NOT ANDROID_ABI OR NOT ANDROID_ABI_SAVED STREQUAL ANDROID_ABI)
-        set (ANDROID_SUPPORTED_ABIS_arm armeabi-v7a armeabi-v6 armeabi)
-        set (ANDROID_SUPPORTED_ABIS_aarch64 arm64-v8a)
-        set (ANDROID_SUPPORTED_ABIS_x86 x86)
-        set (ANDROID_SUPPORTED_ABIS_x86_64 x86_64)
-        set (ANDROID_SUPPORTED_ABIS_mips mips)
-        set (ANDROID_SUPPORTED_ABIS_mips64 mips64)
-        set (ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${MACHINE_ARCH}})
-        list (GET ANDROID_SUPPORTED_ABIS 0 DEFAULT_ANDROID_ABI)
-        set (ANDROID_ABI ${DEFAULT_ANDROID_ABI} CACHE STRING "Specify target ABI (Android platform only), possible values depends on the target arch of the chosen Android compiler toolchain, default to first ABI of each target arch")
-        set_property (CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS})
-        if (ANDROID_ABI MATCHES with)
-            string (REGEX REPLACE ".+with (.+)" \\1 ANDROID_ABI_MODIFIER "${ANDROID_ABI}")
-            if (MACHINE_ARCH STREQUAL arm)
-                set (ANDROID_SUPPORTED_ARM_ABI_MODIFIERS neon-vfpv4 neon vfpv4 vfpv3 vfpv3-d16 vfp)
-                list (FIND ANDROID_SUPPORTED_ARM_ABI_MODIFIERS "${ANDROID_ABI_MODIFIER}" FOUND_INDEX)   # Stringify as the variable may be empty
-                if (FOUND_INDEX EQUAL -1)
-                    string (REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_ARM_ABI_MODIFIERS "\"${ANDROID_SUPPORTED_ARM_ABI_MODIFIERS}\"")
-                    message (FATAL_ERROR "Unrecognized '${ANDROID_ABI_MODIFIER}' specified in the ANDROID_ABI option, "
-                        "supported values are: ${PRINTABLE_ANDROID_SUPPORTED_ARM_ABI_MODIFIERS}.")
-                endif ()
-            else ()
-                message (FATAL_ERROR "Unrecognized '${ANDROID_ABI_MODIFIER}' specified in the ANDROID_ABI option, "
-                    "the chosen Android ABI does not support any modifiers.")
-            endif ()
-        endif ()
-        string (REGEX REPLACE with.+ "" ANDROID_ABI_BASE "${ANDROID_ABI}")
-        list (FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI_BASE}" FOUND_INDEX)     # Stringify as the variable may be empty
-        if (FOUND_INDEX EQUAL -1)
-            string (REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_ABIS "\"${ANDROID_SUPPORTED_ABIS}\"")
-            message (FATAL_ERROR "Unrecognized '${ANDROID_ABI}' specified in the ANDROID_ABI option, "
-                "supported values are: ${PRINTABLE_ANDROID_SUPPORTED_ABIS}.")
-        endif ()
-        set (ANDROID_ABI_SAVED ${ANDROID_ABI} CACHE INTERNAL "Last saved value for ANDROID_ABI")
-        # Invalidate internal caches that depend on ANDROID_ABI, if any
-        unset (ANDROID_STL_SAVED CACHE)     # This should cause ANDROID_STL option to be revalidated
-        if (CLANG)
-            set (INVALIDATE_CCT 1)
-        endif ()
-    endif ()
-    # First, derive variable values based on chosen compiler toolchain
-    set (ANDROID_NDK_ABI_NAME ${MACHINE_ARCH})
-    set (ANDROID_ARCH_NAME ${MACHINE_ARCH})
-    set (CMAKE_SYSTEM_PROCESSOR ${MACHINE_ARCH})
-    string (REGEX REPLACE "^([^-]+).*$" \\1-none-linux-android ANDROID_LLVM_TRIPLE "${ANDROID_TOOLCHAIN_MACHINE_NAME}")
-    # Then, handle exceptional cases based on chosen ABI
-    if (ANDROID_ABI MATCHES armeabi-v7a)
-        if (NOT ANDROID_ABI MATCHES with)
-            set (ANDROID_ABI "armeabi-v7a with vfpv3-d16")  # This is the default case for armeabi-v7a
-        endif ()
-        set (ANDROID_NDK_ABI_NAME armeabi-v7a)
-        set (CMAKE_SYSTEM_PROCESSOR armv7-a)
-        set (ANDROID_LLVM_TRIPLE armv7-none-linux-androideabi)
-    elseif (ANDROID_ABI MATCHES armeabi)
-        set (ANDROID_NDK_ABI_NAME armeabi)
-        if (ANDROID_ABI MATCHES -v6)
-            set (ANDROID_ABI "armeabi-v6 with vfp")     # This is the default case for armeabi-v6
-            set (CMAKE_SYSTEM_PROCESSOR armv6)
-        else ()
-            set (CMAKE_SYSTEM_PROCESSOR armv5te)
-        endif ()
-        set (ANDROID_LLVM_TRIPLE armv5te-none-linux-androideabi)
-    elseif (ANDROID_ABI STREQUAL arm64-v8a)
-        set (ANDROID_NDK_ABI_NAME arm64-v8a)
-        set (ANDROID_ARCH_NAME arm64)
-    elseif (ANDROID_ABI STREQUAL x86)
-        set (CMAKE_SYSTEM_PROCESSOR i686)
-    endif ()
-    include (CMakeDependentOption)
-    cmake_dependent_option (ANDROID_FORCE_ARM_BUILD "Use 32-bit ARM instructions instead of Thumb" FALSE "ANDROID_ARCH_NAME STREQUAL arm" FALSE)
-    # Urho3D - comment out as Urho manages the runtime and library output directories in its own module
-    #set (CMAKE_RUNTIME_OUTPUT_DIRECTORY {CMAKE_BINARY_DIR}/bin)
-    #set (CMAKE_LIBRARY_OUTPUT_DIRECTORY {CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME})
-
-    # Android API levels
-    if (NOT ANDROID_NATIVE_API_LEVEL OR NOT ANDROID_NATIVE_API_LEVEL_SAVED STREQUAL ANDROID_NATIVE_API_LEVEL)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_arm 9)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_x86 9)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_mips 9)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21)
-        set (ANDROID_DEFAULT_NDK_API_LEVEL ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}})
-        set (ANDROID_NATIVE_API_LEVEL android-${ANDROID_DEFAULT_NDK_API_LEVEL} CACHE STRING "Specify target API level (Android platform only), default to 'android-9' on 32-bit ABIs, default to 'android-21' on 64-bit ABIs")
-        if (NOT SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME})
-            if (NOT SUPPORTED_NATIVE_API_LEVELS)
-                file (GLOB SUPPORTED_NATIVE_API_LEVELS RELATIVE ${ANDROID_NDK}/platforms ${ANDROID_NDK}/platforms/android-*)
-                string (REPLACE android- "" SUPPORTED_NATIVE_API_LEVELS "${SUPPORTED_NATIVE_API_LEVELS}")
-                set (SUPPORTED_NATIVE_API_LEVELS ${SUPPORTED_NATIVE_API_LEVELS} CACHE INTERNAL "Supported Android native API levels")
-            endif ()
-            set (SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} ${SUPPORTED_NATIVE_API_LEVELS})
-            foreach (API_LEVEL ${SUPPORTED_NATIVE_API_LEVELS})
-                if (API_LEVEL LESS ANDROID_DEFAULT_NDK_API_LEVEL OR API_LEVEL LESS 10)
-                    list (REMOVE_ITEM SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} ${API_LEVEL})
-                endif ()
-                if (NOT API_LEVEL LESS ANDROID_DEFAULT_NDK_API_LEVEL AND API_LEVEL LESS 10)
-                    list (APPEND SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} 0${API_LEVEL})    # Add 0 padding for sorting
-                endif ()
-            endforeach ()
-            list (SORT SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME})
-            string (REGEX REPLACE ";0*" ";android-" SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} ";${SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME}}")
-            string (REGEX REPLACE "^;" "" SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} "${SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME}}")
-            set (SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} ${SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME}} CACHE INTERNAL "Supported Android native API levels for arch ${ANDROID_ARCH_NAME}")
-        endif ()
-        set_property (CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME}})
-        list (FIND SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME} "${ANDROID_NATIVE_API_LEVEL}" FOUND_INDEX)   # Stringify as the actual variable may be empty
-        if (FOUND_INDEX EQUAL -1)
-            string (REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_NATIVE_API_LEVELS "\"${SUPPORTED_NATIVE_API_LEVELS_${ANDROID_ARCH_NAME}}\"")
-            message (FATAL_ERROR "Unsupported '${ANDROID_NATIVE_API_LEVEL}' specified in the ANDROID_NATIVE_API_LEVEL option, "
-                "supported values are: ${PRINTABLE_ANDROID_SUPPORTED_NATIVE_API_LEVELS}.")
-        endif ()
-        set (ANDROID_NATIVE_API_LEVEL_SAVED ${ANDROID_NATIVE_API_LEVEL} CACHE INTERNAL "Last saved value for ANDROID_NATIVE_API_LEVEL")
-    endif ()
-    # Warn if the chosen level is larger than android:minSdkVersion, this check can only done in CMake rerun (after the build tree has been generated)
-    string (REPLACE android- "" APP_PLATFORM_LEVEL "${ANDROID_NATIVE_API_LEVEL}")
-    if (EXISTS ${CMAKE_BINARY_DIR}/AndroidManifest.xml)
-        file (STRINGS ${CMAKE_BINARY_DIR}/AndroidManifest.xml LINE LIMIT_COUNT 1 REGEX android:minSdkVersion=)
-        if (LINE MATCHES "android:minSdkVersion=\"([^\"]+)\"")
-            set (APP_MIN_PLATFORM_LEVEL ${CMAKE_MATCH_1})
-            if (APP_PLATFORM_LEVEL GREATER APP_MIN_PLATFORM_LEVEL)
-                message (WARNING "ANDROID_NATIVE_API_LEVEL (${ANDROID_NATIVE_API_LEVEL}) is larger than android:minSdkVersion (${APP_MIN_PLATFORM_LEVEL}) in AndroidManifest.xml.")
-            endif ()
-        endif ()
-    endif ()
-
-    # System root
-    set (CMAKE_SYSROOT ${ANDROID_NDK}/platforms/${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME})
-
-    # C++ STL runtimes
-    option (ANDROID_STL_FORCE_FEATURES "Automatically configure rtti and exceptions support based on the chosen C++ STL runtime" TRUE)
-    # Urho3D - always use RTTI due to dynamic cast usage in the codebase
-    #cmake_dependent_option (ANDROID_RTTI "Set ON to enable RTTI" TRUE "NOT ANDROID_STL_FORCE_FEATURES" TRUE)
-    set (ANDROID_RTTI 1)
-    cmake_dependent_option (ANDROID_EXCEPTIONS "Set ON to enable C++ exceptions" TRUE "NOT ANDROID_STL_FORCE_FEATURES" TRUE)
-    if (NOT FEATURE_SIGNATURE STREQUAL "${ANDROID_STL_FORCE_FEATURES}-${ANDROID_RTTI}-${ANDROID_EXCEPTIONS}")
-        set (INVALIDATE_CCT 1)
-        set (FEATURE_SIGNATURE "${ANDROID_STL_FORCE_FEATURES}-${ANDROID_RTTI}-${ANDROID_EXCEPTIONS}" CACHE INTERNAL "Signature when the C++ features are last cached")
-    endif ()
-    # Urho3D - warn if static runtime is chosen when using SHARED Urho3D library type
-    if (URHO3D_LIB_TYPE STREQUAL SHARED AND ANDROID_STL MATCHES static)
-        message (WARNING "Using static C++ STL runtime (${ANDROID_STL}) with SHARED Urho3D library type may result in unpredictable runtime behavior.")
-    endif ()
-    if (NOT ANDROID_STL OR NOT ANDROID_STL_SAVED STREQUAL ANDROID_STL)
-        # Urho3D - default to use LLVM libc++ runtime
-        #set (ANDROID_DEFAULT_STL system)
-        if (URHO3D_LIB_TYPE STREQUAL SHARED)
-            set (ANDROID_DEFAULT_STL c++_shared)
-        else ()
-            set (ANDROID_DEFAULT_STL c++_static)
-        endif ()
-        set (ANDROID_STL ${ANDROID_DEFAULT_STL} CACHE STRING "Specify the C++ STL runtime (Android platform only), default to ${ANDROID_DEFAULT_STL}; STLport may only be used when URHO3D_NETWORK is disabled")
-        # Urho3D - proper C++ STL runtime is required to build Urho3D, exclude those that do not cut it
-        #set (ANDROID_SUPPORTED_RUNTIMES system gabi++_static gabi++_shared stlport_static stlport_shared gnustl_static gnustl_shared c++_static c++_shared)
-        set (ANDROID_SUPPORTED_RUNTIMES stlport_static stlport_shared gnustl_static gnustl_shared c++_static c++_shared)
-        set_property (CACHE ANDROID_STL PROPERTY STRINGS ${ANDROID_SUPPORTED_RUNTIMES})
-        list (FIND ANDROID_SUPPORTED_RUNTIMES "${ANDROID_STL}" FOUND_INDEX)     # Stringify as the actual variable may be empty
-        if (FOUND_INDEX EQUAL -1)
-            string (REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_RUNTIMES "\"${ANDROID_SUPPORTED_RUNTIMES}\"")
-            message (FATAL_ERROR "Unrecognized '${ANDROID_STL}' specified in the ANDROID_STL option, "
-                "supported values are: ${PRINTABLE_ANDROID_SUPPORTED_RUNTIMES}.")
-        endif ()
-        if (ANDROID_STL STREQUAL system)
-            if (ANDROID_STL_FORCE_FEATURES)
-                set (ANDROID_RTTI 0)
-                set (ANDROID_EXCEPTIONS 0)
-            endif ()
-            set (STL_LIBS stdc++)
-            # If the 'system' runtime is used in combination with RTTI or C++ exceptions then automatically link against the GNU libsupc++ for now
-            if (ANDROID_RTTI OR ANDROID_EXCEPTIONS)
-                set (STL_LIBS ${STL_LIBS} supc++)
-            endif ()
-            set (STL_INCLUDE_DIRS ${ANDROID_NDK}/sources/cxx-stl/system/include)
-        elseif (ANDROID_STL MATCHES gabi\\+\\+)
-            set (STL_INCLUDE_DIRS ${ANDROID_NDK}/sources/cxx-stl/gabi++/include)
-        elseif (ANDROID_STL MATCHES stlport)
-            set (STL_LIBS ${ANDROID_STL})
-            set (STL_LIBRARY_DIR ${ANDROID_NDK}/sources/cxx-stl/stlport/libs/${ANDROID_NDK_ABI_NAME})
-            set (STL_INCLUDE_DIRS ${ANDROID_NDK}/sources/cxx-stl/stlport/stlport)   # This is not a typo!
-        elseif (ANDROID_STL MATCHES gnustl)
-            set (STL_LIBS ${ANDROID_STL} supc++)
-            set (STL_LIBRARY_DIR ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_NDK_ABI_NAME})
-            set (STL_INCLUDE_DIRS ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/include ${STL_LIBRARY_DIR}/include)
-        elseif (ANDROID_STL MATCHES c\\+\\+)
-            set (STL_LIBS c++)
-            # TODO: Remove this once libgcc.a is not being used
-            set (GCC_FIX "-Wl,-z,muldefs")
-            set (STL_LIBRARY_DIR ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_NDK_ABI_NAME})
-            if (EXISTS ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx)
-                set (LIBCXX libcxx/)
-                set (LIBCXXABI libcxxabi/)
-            endif ()
-            set (STL_INCLUDE_DIRS ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/${LIBCXX}include ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/${LIBCXXABI}include ${ANDROID_NDK}/sources/android/support/include)
-        endif ()
-        file (GLOB SHARED_LIBS ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib*_shared.so)
-        if (SHARED_LIBS)
-            execute_process (COMMAND ${CMAKE_COMMAND} -E remove ${SHARED_LIBS})
-        endif ()
-        if (ANDROID_STL MATCHES shared)
-            execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${STL_LIBRARY_DIR}/lib${ANDROID_STL}.so ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib${ANDROID_STL}.so)
-        endif ()
-        if (STL_LIBS)
-            string (REPLACE ";" " -l" STL_LINKER_FLAGS ";${STL_LIBS}")
-            if (ANDROID_STL MATCHES system|static)
-                set (STL_LINKER_FLAGS "-Wl,-Bstatic ${STL_LINKER_FLAGS} -Wl,-Bdynamic")
-            endif ()
-            set (STL_LINKER_FLAGS "-L${STL_LIBRARY_DIR} ${STL_LINKER_FLAGS} ${GCC_FIX}")
-        else ()
-            set (STL_LINKER_FLAGS)
-        endif ()
-        foreach (VAR ANDROID_RTTI ANDROID_EXCEPTIONS STL_INCLUDE_DIRS STL_LIBRARY_DIR STL_LINKER_FLAGS)
-            set (${VAR} ${${VAR}} CACHE INTERNAL "C++ STL runtimes")
-        endforeach ()
-        set (ANDROID_STL_SAVED ${ANDROID_STL} CACHE INTERNAL "Last saved value for ANDROID_STL")
-    endif ()
-
-    # Cross compiler tools
-    if (CMAKE_HOST_WIN32)
-        set (TOOL_EXT .exe)
-    endif ()
-    if (CLANG)
-        set (C_COMPILER clang)
-        set (CXX_COMPILER clang++)
-    else ()
-        set (COMPILER_PREFIX ${ANDROID_TOOLCHAIN_MACHINE_NAME}-)
-        set (C_COMPILER gcc)
-        set (CXX_COMPILER g++)
-    endif ()
-    if (NOT CMAKE_C_COMPILER)
-        set (COMPILER_PATH ${ANDROID_${CLANG}TOOLCHAIN_ROOT}/bin)   # CLANG is empty when the compiler is not Clang
-        if ("$ENV{USE_CCACHE}" AND NOT CMAKE_HOST_WIN32)
-            execute_process (COMMAND whereis -b ccache COMMAND grep -o \\S*lib\\S* OUTPUT_VARIABLE CCACHE_SYMLINK ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-            if (CCACHE_SYMLINK AND EXISTS ${CCACHE_SYMLINK}/${COMPILER_PREFIX}${C_COMPILER} AND EXISTS ${CCACHE_SYMLINK}/${COMPILER_PREFIX}${CXX_COMPILER})
-                set (COMPILER_PATH ${CCACHE_SYMLINK})
-            else ()
-                # Fallback to create the ccache symlink in the build tree itself
-                execute_process (COMMAND which ccache RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE CCACHE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-                if (EXIT_CODE EQUAL 0 AND CCACHE)
-                    foreach (TOOL ${C_COMPILER} ${CXX_COMPILER})
-                        execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${CCACHE} ${CMAKE_BINARY_DIR}/${COMPILER_PREFIX}${TOOL})
-                    endforeach ()
-                    set (COMPILER_PATH ${CMAKE_BINARY_DIR})
-                else ()
-                    message (WARNING "ccache may not have been installed on this host system. "
-                        "This is required to enable ccache support for Android NDK compiler toolchain. "
-                        "CMake has been configured to use the actual compiler toolchain instead of ccache. "
-                        "In order to rectify this, the build tree must be regenerated after installing ccache.")
-                endif ()
-            endif ()
-            if (NOT COMPILER_PATH STREQUAL ${ANDROID_${CLANG}TOOLCHAIN_ROOT}/bin AND NOT $ENV{PATH} MATCHES ${ANDROID_${CLANG}TOOLCHAIN_ROOT}/bin)
-                message (FATAL_ERROR "The bin directory containing the compiler toolchain (${ANDROID_${CLANG}TOOLCHAIN_ROOT}/bin) has not been added in the PATH environment variable. "
-                    "This is required to enable ccache support for Android NDK compiler toolchain.")
-            endif ()
-        endif ()
-        set (CMAKE_C_COMPILER ${COMPILER_PATH}/${COMPILER_PREFIX}${C_COMPILER}${TOOL_EXT} CACHE PATH "C compiler")
-        set (CMAKE_CXX_COMPILER ${COMPILER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER}${TOOL_EXT} CACHE PATH "C++ compiler")
-        set (CMAKE_ASM_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_EXT} CACHE PATH "assembler")
-        set (CMAKE_STRIP ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-strip${TOOL_EXT} CACHE PATH "strip")
-        set (CMAKE_AR ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc-ar${TOOL_EXT} CACHE PATH "archive")
-        set (CMAKE_LINKER ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ld${TOOL_EXT} CACHE PATH "linker")
-        set (CMAKE_NM ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-nm${TOOL_EXT} CACHE PATH "nm")
-        set (CMAKE_OBJCOPY ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objcopy${TOOL_EXT} CACHE PATH "objcopy")
-        set (CMAKE_OBJDUMP ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objdump${TOOL_EXT} CACHE PATH "objdump")
-        set (CMAKE_RANLIB ${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ranlib${TOOL_EXT} CACHE PATH "ranlib")
-    endif ()
-
-    # Compiler and linker flags
-    if (NOT CMAKE_C_FLAGS OR NOT FLAGS_SIGNATURE STREQUAL "${ANDROID_ABI}-${APP_PLATFORM_LEVEL}-${ANDROID_FORCE_ARM_BUILD}-${ANDROID_STACK_PROTECTION}-${ANDROID_NO_UNDEFINED}-${ANDROID_NOEXECSTACK}-${ANDROID_RELRO}-${ANDROID_FATAL_WARNINGS}-${ANDROID_FORMAT_SECURITY}-${ANDROID_FUNCTION_LEVEL_LINKING}-${ANDROID_STL}-${ANDROID_STL_FORCE_FEATURES}-${ANDROID_RTTI}-${ANDROID_EXCEPTIONS}")
-        set (CMAKE_C_FLAGS "-fsigned-char -funwind-tables -no-canonical-prefixes")
-        set (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
-        set (CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG")
-        set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id -Wl,--warn-shared-textrel")
-        if (CLANG)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} -target ${ANDROID_LLVM_TRIPLE} -Wno-invalid-command-line-argument -Wno-unused-command-line-argument")
-            set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-limit-debug-info")
-        endif ()
-        if (ANDROID_ABI MATCHES armeabi)
-            if (CLANG)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-integrated-as")
-            endif ()
-            if (ANDROID_ABI MATCHES -v7a)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a")
-                set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fix-cortex-a8")
-            elseif (ANDROID_ABI MATCHES -v6)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv6")
-            else ()
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv5te -mtune=xscale")
-            endif ()
-            if (ANDROID_ABI MATCHES -v7a|-v6)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
-            else ()
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msoft-float")
-            endif ()
-            foreach (FPU neon-vfpv4 neon vfpv4 vfpv3 vfpv3-d16 vfp)
-                if (ANDROID_ABI MATCHES " ${FPU}$")
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=${FPU}")
-                endif ()
-            endforeach ()
-            if (ANDROID_FORCE_ARM_BUILD)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
-            else ()
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb")
-            endif ()
-        elseif (ANDROID_ABI MATCHES mips)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finline-functions -fmessage-length=0")
-            if (NOT CLANG)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers")
-            endif ()
-            # Clang outputs mips32r2 by default, switch to mips32r1
-            # TODO: Remove this once mipsel-linux-android target is changed in clang
-            if (ANDROID_ABI STREQUAL mips)
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mips32")
-            endif ()
-        endif ()
-        # The ld.bfd needs help to find the location of the rooted shared libraries while ld.gold doesn't
-        # TODO: Remove this once gold linker is the default for all the archs or when it is not possible to switch to use ld.bfd
-        set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,\"${CMAKE_SYSROOT}/usr/lib\":\"${CMAKE_SYSROOT}/lib\":\"${STL_LIBRARY_DIR}\"")
-        option (ANDROID_STACK_PROTECTION "Force the addition of a stack canary that checks for stack smashing")
-        if (ANDROID_STACK_PROTECTION)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")
-        endif ()
-        option (ANDROID_NO_UNDEFINED "Ensure that a binary doesn't reference undefined symbols" TRUE)
-        if (ANDROID_NO_UNDEFINED)
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
-        endif ()
-        option (ANDROID_NOEXECSTACK "Enforce the NX (no execute) security feature in the generated machine code" TRUE)
-        if (ANDROID_NOEXECSTACK)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wa,--noexecstack")
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
-        endif ()
-        option (ANDROID_RELRO "Mark certain regions of the resulting executable or shared library as being read-only" TRUE)
-        if (ANDROID_RELRO)
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
-        endif ()
-        option (ANDROID_FATAL_WARNINGS "Treat all linker warnings as errors" TRUE)
-        if (ANDROID_FATAL_WARNINGS)
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings")
-        endif ()
-        option (ANDROID_FORMAT_SECURITY "Provide compiler protection against format string vulnerabilities" TRUE)
-        if (ANDROID_FORMAT_SECURITY)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Werror=format-security")
-        endif ()
-        option (ANDROID_FUNCTION_LEVEL_LINKING "Split data/function sections and garbage collect unused sections at link time" TRUE)
-        if (ANDROID_FUNCTION_LEVEL_LINKING)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -ffunction-sections")
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
-        endif ()
-        # RelWithDebInfo and MinSizeRel build configurations are just derivative of Release build configuration
-        string (REPLACE -O3 "-O2 -g" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE}")
-        string (REPLACE -O3 -Os CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE}")
-        foreach (VAR _FLAGS _FLAGS_RELEASE _FLAGS_DEBUG _FLAGS_RELWITHDEBINFO _FLAGS_MINSIZEREL)
-            set (CMAKE_C${VAR} ${CMAKE_C${VAR}} CACHE INTERNAL "C Compiler flags")
-            set (CMAKE_CXX${VAR} ${CMAKE_C${VAR}} CACHE INTERNAL "CXX Compiler flags")
-        endforeach ()
-        # Only CXX compiler can accept these flags
-        if (ANDROID_RTTI)
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti" CACHE INTERNAL "CXX Compiler flags")
-        else ()
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti" CACHE INTERNAL "CXX Compiler flags")
-        endif ()
-        if (ANDROID_EXCEPTIONS)
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" CACHE INTERNAL "CXX Compiler flags")
-        else ()
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions" CACHE INTERNAL "CXX Compiler flags")
-        endif ()
-        set (CMAKE_EXE_LINKER_FLAGS -Wl,-z,nocopyreloc)
-        if (NOT APP_PLATFORM_LEVEL LESS 16)
-            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-        endif ()
-        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}" CACHE INTERNAL "EXE linker flags")
-        set (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} CACHE INTERNAL "SHARED linker flags")
-        set (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} CACHE INTERNAL "MODULE linker flags")
-        set (FLAGS_SIGNATURE "${ANDROID_ABI}-${APP_PLATFORM_LEVEL}-${ANDROID_FORCE_ARM_BUILD}-${ANDROID_STACK_PROTECTION}-${ANDROID_NO_UNDEFINED}-${ANDROID_NOEXECSTACK}-${ANDROID_RELRO}-${ANDROID_FATAL_WARNINGS}-${ANDROID_FORMAT_SECURITY}-${ANDROID_FUNCTION_LEVEL_LINKING}-${ANDROID_STL}-${ANDROID_STL_FORCE_FEATURES}-${ANDROID_RTTI}-${ANDROID_EXCEPTIONS}" CACHE INTERNAL "Signature when the compiler/linker flags are last cached")
-    endif ()
-    # Workaround try_compile() limitation
-    set (ENV{CMAKE_SYSROOT} ${CMAKE_SYSROOT})
-    set (ENV{STL_INCLUDE_DIRS} "${STL_INCLUDE_DIRS}")   # Stringify to keep the list together
-    set (ENV{STL_LINKER_FLAGS} "${STL_LINKER_FLAGS}")
-else ()
-    set (CMAKE_SYSROOT $ENV{CMAKE_SYSROOT})
-    set (STL_INCLUDE_DIRS $ENV{STL_INCLUDE_DIRS})
-    set (STL_LINKER_FLAGS $ENV{STL_LINKER_FLAGS})
-endif ()
-include_directories (SYSTEM ${STL_INCLUDE_DIRS})
-# Cannot use link_directories() and link_libraries() commands here because CMake will emit the linker flags in an undesirable order
-# Workaround the problem by injecting the linker flags the last explicitly in the CMake build rules
-# This is a hack as it relies on internal implementation, i.e. the hard-coded rules must be kept in sync manually with CMake's Modules/CMakeCXXInformation.cmake file
-set (CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> ${STL_LINKER_FLAGS}")
-set (CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> ${STL_LINKER_FLAGS}")
-set (CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${STL_LINKER_FLAGS}")
-
-# Only search libraries and headers in sysroot
-set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-# Use response files on Windows host to avoid failure in the linking phase with too long command line
-if (CMAKE_HOST_WIN32)
-    set (CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
-    set (CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
-endif ()

+ 3 - 6
CMakeLists.txt

@@ -54,10 +54,7 @@ if (WIN32)
 else ()
 else ()
     set (SCRIPT_EXT .sh)
     set (SCRIPT_EXT .sh)
 endif ()
 endif ()
-if (ANDROID)
-    # For Android platform, install to a path based on the chosen Android ABI, e.g. libs/armeabi-v7a
-    set (LIB_SUFFIX s/${ANDROID_NDK_ABI_NAME})
-elseif (URHO3D_64BIT)
+if (URHO3D_64BIT)
     # Install to 'lib64' when one of these conditions is true
     # Install to 'lib64' when one of these conditions is true
     if ((MINGW AND CMAKE_CROSSCOMPILING) OR URHO3D_USE_LIB64_RPM OR (HAS_LIB64 AND NOT URHO3D_USE_LIB_DEB))
     if ((MINGW AND CMAKE_CROSSCOMPILING) OR URHO3D_USE_LIB64_RPM OR (HAS_LIB64 AND NOT URHO3D_USE_LIB_DEB))
         set (LIB_SUFFIX 64)
         set (LIB_SUFFIX 64)
@@ -151,8 +148,8 @@ if (WIN32 AND NOT URHO3D_OPENGL)
     else ()
     else ()
         set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-3D9)
         set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-3D9)
     endif ()
     endif ()
-elseif (ANDROID AND X86)    # Take advantage of Android toolchain setting X86 variable to true for both 'x86' and 'x86_64' ABIs
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-IA)     # Stands for Intel Architecture
+elseif (ANDROID)
+    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${ANDROID_ABI})
 elseif (RPI AND RPI_ABI MATCHES ^armeabi-v7a)
 elseif (RPI AND RPI_ABI MATCHES ^armeabi-v7a)
     set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-v7a)
     set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-v7a)
 elseif (ARM_ABI_FLAGS)
 elseif (ARM_ABI_FLAGS)

+ 47 - 28
Docs/GettingStarted.dox

@@ -42,7 +42,7 @@ Although all required third-party libraries are included as source code, there a
 
 
 - For macOS, iOS, and tvOS, the Xcode developer tools package should include everything necessary. Make sure that the Xcode command line tools are also installed.
 - For macOS, iOS, and tvOS, the Xcode developer tools package should include everything necessary. Make sure that the Xcode command line tools are also installed.
 
 
-- For Android, the Android SDK (version 12 or later) and Android NDK (r7 or later) need to be installed.
+- For Android, the Android Studio (version 3.1.3 or later) should include everything necessary. Make sure that Android SDK build tool (26.1.1 or later), SDK-bundled CMake (3.6.4111459 or later), and Android NDK (r17 or later) are also installed. The "ninja" build tool needs to be installed globally for host-tool building such as when building with Lua/LuaJIT subsystem enabled.
 
 
 - For Web, the Emscripten SDK need to be installed (on Windows also MinGW-W64 compiler toolchain is required).
 - For Web, the Emscripten SDK need to be installed (on Windows also MinGW-W64 compiler toolchain is required).
 
 
@@ -56,7 +56,7 @@ To run Urho3D, the minimum system requirements are:
 
 
 - Raspberry Pi: %Model B revision 2.0 with at least 128 MB of 512 MB SDRAM allocated for GPU.
 - Raspberry Pi: %Model B revision 2.0 with at least 128 MB of 512 MB SDRAM allocated for GPU.
 
 
-- Android: OS version 2.3 or newer, OpenGL ES 2.0 capable GPU.
+- Android: Jelly Bean 4.1 (API level 16) or newer, OpenGL ES 2.0 capable GPU.
 
 
 - iOS: armv7, iPhone 3GS or newer including iPad, OS version 3 or newer.
 - iOS: armv7, iPhone 3GS or newer including iPad, OS version 3 or newer.
 
 
@@ -72,7 +72,7 @@ CMake (https://www.cmake.org) is required to configure and generate the Urho3D p
 
 
 \section Build_Scripts Build scripts
 \section Build_Scripts Build scripts
 
 
-As this is a cross-platform project, we have provided a number of build scripts for the most common use cases. The shell scripts end with extension *.sh are meant for building Urho3D project in a Unix-like host system (Linux, Mac, and even Raspberry Pi), while the batch files end with *.bat are meant for Windows host system only. They only provide a convenient way to invoke CMake to process our CMakeLists.txt files. Their usage is not a must as you can also invoke CMake to do the same via cmake-gui or via your IDE when your IDE supports that.
+As this is a cross-platform project, we have provided a number of build scripts in the "script" directory for the most common use cases, with the exception for Android platform. The shell scripts end with extension *.sh are meant for building Urho3D project in a Unix-like host system (Linux, Mac, and even Raspberry Pi), while the batch files end with *.bat are meant for Windows host system only. They only provide a convenient way to invoke CMake to process our CMakeLists.txt files. Their usage is not a must as you can also invoke CMake to do the same via cmake-gui or via your IDE when your IDE supports that.
 
 
 The basic usage is as follows:
 The basic usage is as follows:
 
 
@@ -92,12 +92,14 @@ Naturally you have to specify a fully qualified path to the build script for thi
 
 
 Our CMakeLists.txt files are designed to work with most of the generators supported by CMake: Makefile, Xcode, VS, and even Ninja. Which build script to use is determined by which CMake generator (and toolchain) you intend to use in your build tree. For native build, you can just use cmake_generic.sh or cmake_generic.bat to let CMake to detect and decide which generator to use automatically. CMake should default to use "Unix Makefiles" generator on Linux and Mac host systems and it should default to use 32-bit "Visual Studio" generator on Windows host system when it is installed.
 Our CMakeLists.txt files are designed to work with most of the generators supported by CMake: Makefile, Xcode, VS, and even Ninja. Which build script to use is determined by which CMake generator (and toolchain) you intend to use in your build tree. For native build, you can just use cmake_generic.sh or cmake_generic.bat to let CMake to detect and decide which generator to use automatically. CMake should default to use "Unix Makefiles" generator on Linux and Mac host systems and it should default to use 32-bit "Visual Studio" generator on Windows host system when it is installed.
 
 
+Since Urho3D version 1.8 we have integrated with Gradle build system for Android platform. We have provided Gradle wrapper script and batch file at the project root directory to interface with Gradle build system. Currently it is the only platform that does not allow user to interface with CMake build system directly. See \ref Building_Android for more detail.
+
 \section Build_Options Build options
 \section Build_Options Build options
 
 
-A number of build options can be defined when invoking the build scripts or when configurating the project interactively using cmake-gui. To use one of these build options on the command line interface, pass it in this format "-DOPTION=VALUE" without the quotes. Most of the build options are boolean variables where setting their values to 0 means disabling a feature or setting an option to false, while 1 means enabling a feature or setting an option to true. The table below shows all the available build options and their default values. Non-boolean build options generally do not have any default values and are marked with '-' in the table. However, a few build options marked with '*' have their default values set differently based on the value of other variables or external factors.
+A number of build options can be defined when invoking the build scripts or when configuring the project interactively using cmake-gui. To use one of these build options on the command line interface, pass it in this format "-DOPTION=VALUE" without the quotes. Most of the build options are boolean variables where setting their values to 0 means disabling a feature or setting an option to false, while 1 means enabling a feature or setting an option to true. The table below shows all the available build options and their default values. Non-boolean build options generally do not have any default values and are marked with '-' in the table. However, a few build options marked with '*' have their default values set differently based on the value of other variables or external factors.
+
 |Build Option         |Value|Description          |
 |Build Option         |Value|Description          |
 |---------------------|-----|---------------------|
 |---------------------|-----|---------------------|
-|ANDROID              |0|Configure project using Android cross-compiler toolchain (cmake_generic.bat and cmake_generic.sh only), cmake-gui users need to specify Android toolchain file for cross-compiling explicitly|
 |RPI                  |0|Configure project using Raspberry Pi cross-compiler toolchain (cmake_generic.sh only), cmake-gui users need to specify RPI toolchain file for cross-compiling explicitly|
 |RPI                  |0|Configure project using Raspberry Pi cross-compiler toolchain (cmake_generic.sh only), cmake-gui users need to specify RPI toolchain file for cross-compiling explicitly|
 |WIN32                |0|Configure project using MinGW (32-bit or 64-bit) cross-compiler toolchain (cmake_generic.sh only), cmake-gui users need to specify MinGW toolchain file for cross-compiling explicitly|
 |WIN32                |0|Configure project using MinGW (32-bit or 64-bit) cross-compiler toolchain (cmake_generic.sh only), cmake-gui users need to specify MinGW toolchain file for cross-compiling explicitly|
 |WEB                  |0|Configure project using Emscripten cross-compiler toolchain (cmake_generic.bat and cmake_generic.sh only), cmake-gui users need to specify Emscripten toolchain file for cross-compiling explicitly|
 |WEB                  |0|Configure project using Emscripten cross-compiler toolchain (cmake_generic.bat and cmake_generic.sh only), cmake-gui users need to specify Emscripten toolchain file for cross-compiling explicitly|
@@ -130,7 +132,7 @@ A number of build options can be defined when invoking the build scripts or when
 |URHO3D_SSE           |*|Enable SIMD instruction set (32-bit Web and Intel platforms only, including Android on Intel Atom); default to true on Intel and false on Web platform; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options|
 |URHO3D_SSE           |*|Enable SIMD instruction set (32-bit Web and Intel platforms only, including Android on Intel Atom); default to true on Intel and false on Web platform; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options|
 |URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)|
 |URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)|
 |URHO3D_FILEWATCHER   |1|Enable filewatcher support|
 |URHO3D_FILEWATCHER   |1|Enable filewatcher support|
-|URHO3D_HASH_DEBUG    |0|Enable StringHash reversing and hash collision detection at the expense of memory and performance penalty|
+|URHO3D_HASH_DEBUG    |0|Enable %StringHash reversing and hash collision detection at the expense of memory and performance penalty|
 |URHO3D_PACKAGING     |0|Enable resources packaging support|
 |URHO3D_PACKAGING     |0|Enable resources packaging support|
 |URHO3D_PROFILING     |1|Enable profiling support|
 |URHO3D_PROFILING     |1|Enable profiling support|
 |URHO3D_LOGGING       |1|Enable logging support|
 |URHO3D_LOGGING       |1|Enable logging support|
@@ -153,12 +155,7 @@ A number of build options can be defined when invoking the build scripts or when
 |CMAKE_INSTALL_PREFIX |*|Install path prefix, prepended onto install directories; default to 'c:/Program Files/Urho3D' on Windows host and '/usr/local' on all other non-Windows hosts|
 |CMAKE_INSTALL_PREFIX |*|Install path prefix, prepended onto install directories; default to 'c:/Program Files/Urho3D' on Windows host and '/usr/local' on all other non-Windows hosts|
 |CMAKE_OSX_DEPLOYMENT_TARGET|-|Specify macOS deployment target (macOS platform only); default to current running macOS if not specified, the minimum supported target is 10.9|
 |CMAKE_OSX_DEPLOYMENT_TARGET|-|Specify macOS deployment target (macOS platform only); default to current running macOS if not specified, the minimum supported target is 10.9|
 |IPHONEOS_DEPLOYMENT_TARGET|-|Specify iOS deployment target (iOS platform only); default to latest installed iOS SDK if not specified, the minimum supported target is 3.0 due to constraint from SDL library|
 |IPHONEOS_DEPLOYMENT_TARGET|-|Specify iOS deployment target (iOS platform only); default to latest installed iOS SDK if not specified, the minimum supported target is 3.0 due to constraint from SDL library|
-|APPLETVOS_DEPLOYMENT_TARGET|-|Specify AppleTV OS deployment target (tvOS platform only); default to latest installed tvOS SDK if not specified, the minimum spported target is 9.0|
-|ANDROID_NDK          |-|Path to Android NDK (Android platform only)|
-|ANDROID_TOOLCHAIN_NAME|*|Specify the name of compiler toolchain (Android platform only), possible values depends on installed Android NDK, default to Clang compiler toolchain|
-|ANDROID_ABI          |*|Specify target ABI (Android platform only), possible values depends on the target arch of the chosen Android compiler toolchain, default to first ABI of each target arch|
-|ANDROID_NATIVE_API_LEVEL|*|Specify target API level (Android platform only), possible values depends on installed NDK version, default to 'android-9' on 32-bit ABIs, default to 'android-21' on 64-bit ABIs|
-|ANDROID_NDK_GDB      |0|Enable ndk-gdb support (Android Debug build only)|
+|APPLETVOS_DEPLOYMENT_TARGET|-|Specify AppleTV OS deployment target (tvOS platform only); default to latest installed tvOS SDK if not specified, the minimum supported target is 9.0|
 |MINGW_PREFIX         |-|Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)|
 |MINGW_PREFIX         |-|Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)|
 |MINGW_SYSROOT        |-|Path to MinGW system root (MinGW only); should only be used when the system root could not be auto-detected|
 |MINGW_SYSROOT        |-|Path to MinGW system root (MinGW only); should only be used when the system root could not be auto-detected|
 |RPI_PREFIX           |-|Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)|
 |RPI_PREFIX           |-|Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)|
@@ -218,29 +215,51 @@ To run from Xcode on Mac OS X, edit the Product Scheme to set "Run" setting to e
 
 
 \section Building_Android Android build process
 \section Building_Android Android build process
 
 
-First, if you are building under Windows host without MKLINK support then copy bin/Data and bin/CoreData directories to the Android/assets directory (you can use the provided batch file CopyData.bat). This step is not necessary for Windows host with MKLINK support and other non-Windows host systems.
+First, if you are building under Windows host then after checking out the project you need to prepare the "assets" directory of both the "urho3d-lib" and "launcher-app" modules. Due to a bug in Android plugin of the version we are currently using, where it does not honor custom source set with filter setting, we are forced to use asset symlink with the default source set. In Windows host system, the asset symlinks must be replaced with an equivalent directory link created by MKLINK command. If your account does not allow you to use MKLINK command then use copy command instead to copy the content of the linked directory directory directly to the "assets" directory. Ensure you have preserved the directory structure, i.e. "urho3d-lib" assets directory has one subdir called "CoreData", while "launcher-app" assets directory has two subdirs: "Data" and "Autoload".
 
 
-Set the ANDROID_NDK environment variable to point to your Android NDK. On Windows, ensure that make.exe from the Android NDK is included in the path and is executable from the command line.
+Set the ANDROID_CCACHE environment variable to where your "ccache" build tool has been installed. It is highly recommended when it is available for your host system. Set the ANDROID_NDK environment variable to point to your Android NDK, if it is not installed in the default Android SDK location. Ensure the "ninja" build tool is globally installed when you intend to build Urho3D with Lua/LuaJIT subsystem enabled as "ninja" is required for host tool building required by Lua/LuaJIT.
 
 
-On Windows host, execute cmake_android.bat. On Mac or Linux host, execute cmake_android.sh. Then go to the build tree and execute the below commands to start the build.
+For CLI user, build the Gradle modules with the following command:
 
 
 \verbatim
 \verbatim
-- make -j <num_jobs>
-- android update project -p . -t <target-id>
-- ant debug
+./gradlew build
 \endverbatim
 \endverbatim
 
 
-You only need to update the Android project once in each new build tree, use the -t <target-id> option when you want to modify the target SDK version. The <target-id> is one of the target id returned by "android list target" command (or "android list target |grep android-" when you are on *nix host system). The <num-jobs> is the number of concurrent compiler jobs to be spawned by make command.
-
-After the commands finish successfully, the APK should have been generated in the build tree's "bin" subdirectory, from where it can be installed on a device or an emulator. The command "ant installd" can be used for this. Optionally when you have Rake installed, after the debug APK has been installed then you can use "rake android" command to automate the test running of the APK on an attached Android (virtual) device.
-
-For a release build, use the "ant release" command instead of "ant debug" and follow the Android SDK instructions on how to sign your APK properly.
+or on Windows host:
 
 
-By default the Android package for Urho3D is com.googlecode.urho3d. For a real application you must replace this with your own package name. The Urho3D activity subclasses the SDLActivity from org.libsdl.app package, whose name (or the JNI code from SDL library) does not have to be changed.
-
-Note that the native code is built by default for armeabi-v7a ABI. To make your program compatible also with old Android devices, build also an armeabi version by reconfiguring the build tree again with the build option "-DANDROID_ABI=armeabi" added, then execute make again in the build directory. Similarly, the native code can be built using 64-bit ABI by changing the value of this build option. See \ref Build_Options for all the possible values. Note that CMake doesn't allow changing of its compiler settings in an existing build tree, so before reconfiguring to use an incompatible ANDROID_ABI most likely you need to clean the CMake cache first.
+\verbatim
+gradlew.bat build
+\endverbatim
 
 
-You can also build and deploy using Eclipse IDE with ADT plugin. To do that, execute cmake_eclipse.sh with "-DANDROID=1" build option set. Import "Existing Android Code into Workspace" from the CMake generated Eclipse project file in the build tree. Switch Eclipse IDE to use Java Perspective. Update project properties to choose the desired Android API target. Choose "Run" to let ADT automatically build and deploy the application to Android (virtual) device.
+After the command finishes successfully, the AAR (Android library) and the APK (Android application) should have been generated in the "build/output" directory of the respective Gradle modules.
+
+For Android Studio user, open the project using the IDE. It should prompt you to auto-import the Gradle project, accept the default. After the “gradle sync” completes without any error, press Ctrl+F9 to build the project or Shift+F10 to run the launcher app in the Android device or emulator.
+
+The Gradle build script has been setup to automatically pass the matching Gradle properties as CMake build options. The following is the list of supported Gradle properties.
+
+|Gradle Property|
+|---------------|
+|URHO3D_ANGELSCRIPT|
+|URHO3D_DATABASE_SQLITE|
+|URHO3D_FILEWATCHER|
+|URHO3D_IK|
+|URHO3D_LIB_TYPE|
+|URHO3D_LUA|
+|URHO3D_LUAJIT|
+|URHO3D_LUAJIT_AMALG|
+|URHO3D_LOGGING|
+|URHO3D_NAVIGATION|
+|URHO3D_NETWORK|
+|URHO3D_PCH|
+|URHO3D_PLAYER|
+|URHO3D_PHYSICS|
+|URHO3D_PROFILING|
+|URHO3D_SAMPLES|
+|URHO3D_THREADING|
+|URHO3D_URHO2D|
+|URHO3D_WEBP|
+
+Refer to \ref build_options for their meaning. The Gradle properties can be passed by using "-P" Gradle option, e.g.: "./gradlew -P URHO3D_LUA=0 build" to build without Lua subsystem.
 
 
 \section Building_iOS_tvOS iOS and tvOS build process (tvOS is still EXPERIMENTAL)
 \section Building_iOS_tvOS iOS and tvOS build process (tvOS is still EXPERIMENTAL)
 
 
@@ -688,7 +707,7 @@ As its name implies, this task just creates a basic project structure for your n
 
 
 On Windows host system, this task requires privilege to create symlinks by using mklink command. The task would fail when the Windows user account does not have that privilege. We strongly advise you not to use "Administrator" account just for this purpose. Instead, grant your "normal" user account to have the privilege correctly.
 On Windows host system, this task requires privilege to create symlinks by using mklink command. The task would fail when the Windows user account does not have that privilege. We strongly advise you not to use "Administrator" account just for this purpose. Instead, grant your "normal" user account to have the privilege correctly.
 
 
-WARNING: As of this writing, this rake scaffolding task does not yet create a complete new project suitable for Android platform. You need to supply the missing bits manually yourself for now.
+WARNING: As of this writing, this rake scaffolding task does not yet create a complete new project suitable for Android platform. In future a custom Gradle scaffolding task will be added to perform this job. You need to supply the missing bits manually yourself for now.
 
 
 The Ruby and Rake are not prerequisite software components for building Urho3D and your projects. However, if you are reading this section this far and that your host system actually already has them installed then you can take advantage of them by utilising the 'rake cmake' and 'rake make' tasks. The former configures and generates the build tree (by invoking one of our build scripts under the hood) and the latter builds the project in the generated build tree (by invoking 'cmake --build' command which in turns calls the respective build tools, such as 'make' or 'xcodebuild', or 'MSBuild.exe') at the convenient of your finger tips in a command line interface.
 The Ruby and Rake are not prerequisite software components for building Urho3D and your projects. However, if you are reading this section this far and that your host system actually already has them installed then you can take advantage of them by utilising the 'rake cmake' and 'rake make' tasks. The former configures and generates the build tree (by invoking one of our build scripts under the hood) and the latter builds the project in the generated build tree (by invoking 'cmake --build' command which in turns calls the respective build tools, such as 'make' or 'xcodebuild', or 'MSBuild.exe') at the convenient of your finger tips in a command line interface.
 
 

+ 1 - 1
Docs/Urho3D.dox

@@ -1375,7 +1375,7 @@ From 1.7 to master:
 - URHO3D_CXX11 define was removed. C++11 mode is unconditionally enabled.
 - URHO3D_CXX11 define was removed. C++11 mode is unconditionally enabled.
 - URHO3D_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE and URHO3D_MIXED_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE macros were removed. Use attribute metadata instead. Element names shall be stored in StringVector (without trailing zero) instead of const char*[].
 - URHO3D_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE and URHO3D_MIXED_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE macros were removed. Use attribute metadata instead. Element names shall be stored in StringVector (without trailing zero) instead of const char*[].
 - The Color::TRANSPARENT constant is renamed to Color::TRANSPARENT_BLACK to avoid name clash with Windows's TRANSPARENT macro defined in "windows.h".
 - The Color::TRANSPARENT constant is renamed to Color::TRANSPARENT_BLACK to avoid name clash with Windows's TRANSPARENT macro defined in "windows.h".
-- Build system - the Android Java classes started to use Java 7 and 8 language features, so they must be built with Java 8 support turned on.
+- Build system - integrate with Gradle build system and migration to use Kotlin.
 - Build system - introduce a new Emscripten-specific build option "EMSCRIPTEN_AUTO_SHELL" (default to TRUE), which cause the build system to automatically add an HTML shell-file if one is not explicitly given. Also set the default for "EMSCRIPTEN_WASM" build option to TRUE in order to align with the upstream EMCC compiler changes.
 - Build system - introduce a new Emscripten-specific build option "EMSCRIPTEN_AUTO_SHELL" (default to TRUE), which cause the build system to automatically add an HTML shell-file if one is not explicitly given. Also set the default for "EMSCRIPTEN_WASM" build option to TRUE in order to align with the upstream EMCC compiler changes.
 - Constants are replaced with enums and flag sets in multiple places. Use corresponding types and typed constants instead of integers and integer constants. For example, "unsigned vertexMask = MASK_POSITION" becomes "VertexMaskFlags vertexMask = MASK_POSITION" and "input->GetKeyDown('A')" becomes "input->GetKeyDown(KEY_A)".
 - Constants are replaced with enums and flag sets in multiple places. Use corresponding types and typed constants instead of integers and integer constants. For example, "unsigned vertexMask = MASK_POSITION" becomes "VertexMaskFlags vertexMask = MASK_POSITION" and "input->GetKeyDown('A')" becomes "input->GetKeyDown(KEY_A)".
 
 

+ 0 - 5
Rakefile

@@ -641,11 +641,6 @@ task :ci_package_upload do
     # TODO: There is a bug in CMake/CPack that causes the 'package' target failed to build for iOS and tvOS platforms, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
     # TODO: There is a bug in CMake/CPack that causes the 'package' target failed to build for iOS and tvOS platforms, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
     system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
     system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
   else
   else
-    if ENV['ANDROID']
-      if !ENV['NO_SDK_SYSIMG']
-        system 'cd ../Build && android update project -p . && ant debug' or abort 'Failed to make Urho3D Samples APK'
-      end
-    end
     if ENV['URHO3D_USE_LIB64_RPM']
     if ENV['URHO3D_USE_LIB64_RPM']
       system 'rake cmake' or abort 'Failed to reconfigure to generate 64-bit RPM package'
       system 'rake cmake' or abort 'Failed to reconfigure to generate 64-bit RPM package'
       system "rm #{ENV['build_tree']}/Urho3D-*" or abort 'Failed to remove previously generated artifacts'  # This task can be invoked more than one time
       system "rm #{ENV['build_tree']}/Urho3D-*" or abort 'Failed to remove previously generated artifacts'  # This task can be invoked more than one time

+ 2 - 2
Source/ThirdParty/SDL/CMakeLists.txt

@@ -112,7 +112,7 @@ if (WIN32)
 elseif (HAIKU OR ANDROID OR IOS OR TVOS)   # IOS/TVOS CMake variables are defined in Urho3D when targeting iOS/tvOS platforms, respectively
 elseif (HAIKU OR ANDROID OR IOS OR TVOS)   # IOS/TVOS CMake variables are defined in Urho3D when targeting iOS/tvOS platforms, respectively
   # Do nothing here but this should prevent these platforms from entering the more generic case below, i.e.
   # Do nothing here but this should prevent these platforms from entering the more generic case below, i.e.
   # - preventing LINUX variable being set for Android (when using older CMake)
   # - preventing LINUX variable being set for Android (when using older CMake)
-  # - preventing DARWIN/MACOSX variabe being set for iOS
+  # - preventing DARWIN/MACOSX variable being set for iOS
   # - preventing UNIX_SYS variable being set for Haiku
   # - preventing UNIX_SYS variable being set for Haiku
 elseif (APPLE)
 elseif (APPLE)
   if (CMAKE_SYSTEM_NAME MATCHES Darwin)
   if (CMAKE_SYSTEM_NAME MATCHES Darwin)
@@ -150,7 +150,7 @@ elseif (UNIX)
 endif()
 endif()
 
 
 # Default option knobs
 # Default option knobs
-# Urho3D - commented out OPT_DEF_SSEMATH default variable as the underyling SSEMATH build option is also being commented out by us
+# Urho3D - commented out OPT_DEF_SSEMATH default variable as the underlying SSEMATH build option is also being commented out by us
 if(UNIX OR MINGW OR MSYS)
 if(UNIX OR MINGW OR MSYS)
   set(OPT_DEF_LIBC ON)
   set(OPT_DEF_LIBC ON)
 endif()
 endif()

+ 7 - 4
Source/Urho3D/CMakeLists.txt

@@ -318,7 +318,9 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.
 endif ()
 endif ()
 
 
 # Setup library output path
 # Setup library output path
-if (NOT ANDROID)
+if (ANDROID)
+    # Let SDK's android.toolchain.cmake controls where are the output directories
+else ()
     set_output_directories (${CMAKE_BINARY_DIR}/lib ARCHIVE LIBRARY)
     set_output_directories (${CMAKE_BINARY_DIR}/lib ARCHIVE LIBRARY)
 endif ()
 endif ()
 
 
@@ -546,7 +548,8 @@ if (MSVC)
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DLIB_NAME=$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}> -P ${CMAKE_SOURCE_DIR}/CMake/Modules/AdjustPkgConfigForMSVC.cmake)
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DLIB_NAME=$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}> -P ${CMAKE_SOURCE_DIR}/CMake/Modules/AdjustPkgConfigForMSVC.cmake)
 endif ()
 endif ()
 if (ANDROID)
 if (ANDROID)
-    set (RENAME RENAME Urho3D-${ANDROID_NDK_ABI_NAME}.pc)
+    # After migration to Gradle build system we do not support Android cross-compiling build via pkgconfig anymore, however, this file is still being provided as reference only
+    set (RENAME RENAME Urho3D-${ANDROID_ABI}.pc)
 endif ()
 endif ()
 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc DESTINATION ${DEST_PKGCONFIG_DIR} ${RENAME})
 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc DESTINATION ${DEST_PKGCONFIG_DIR} ${RENAME})
 
 
@@ -568,8 +571,8 @@ if (ANDROID AND GRADLE_BUILD_DIR)
         COMMENT "Copying Urho3D library to URHO3D_HOME directory")
         COMMENT "Copying Urho3D library to URHO3D_HOME directory")
     add_make_clean_files (${ABI_LIB_DIR}/$<TARGET_FILE_NAME:${TARGET_NAME}>)
     add_make_clean_files (${ABI_LIB_DIR}/$<TARGET_FILE_NAME:${TARGET_NAME}>)
 endif ()
 endif ()
-if (URHO3D_LIB_TYPE STREQUAL SHARED AND (ANDROID OR ARM))
-    # Strip the output shared library for embedded devices
+if (URHO3D_LIB_TYPE STREQUAL SHARED AND ARM)
+    # Strip the output shared library for embedded ARM platforms (we don't do this for Android anymore, assuming Android plugin will take care of it)
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
         COMMENT "Stripping Urho3D shared library")
         COMMENT "Stripping Urho3D shared library")
 endif ()
 endif ()

+ 0 - 26
script/.bash_helpers.sh

@@ -39,32 +39,6 @@ post_cmake() {
                 -u "/projectDescription/buildSpec/buildCommand/arguments/dictionary/value[../key/text() = 'org.eclipse.cdt.core.errorOutputParser']" -x "concat('org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;', substring-after(., 'org.eclipse.cdt.core.MakeErrorParser'))" \
                 -u "/projectDescription/buildSpec/buildCommand/arguments/dictionary/value[../key/text() = 'org.eclipse.cdt.core.errorOutputParser']" -x "concat('org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;', substring-after(., 'org.eclipse.cdt.core.MakeErrorParser'))" \
                 "$BUILD"/.project
                 "$BUILD"/.project
 
 
-            # Build-specific fixes
-            if [[ $ANDROID ]]; then
-                # For Android build, add the Android and Java nature to the project setting as it would be done by Eclipse during project import
-                # This fix avoids the step to reimport the project everytime the Eclipse project setting is regenerated by cmake_generic.sh invocation
-                echo -- post_cmake: Add Android and Java nature to Eclipse project setting files in $BUILD
-
-                #
-                # Add natures (Android nature must be inserted as first nature)
-                #
-                xmlstarlet ed -P -L \
-                    -i "/projectDescription/natures/nature[1]" -t elem -n nature -v "com.android.ide.eclipse.adt.AndroidNature" \
-                    -s "/projectDescription/natures" -t elem -n nature -v "org.eclipse.jdt.core.javanature" \
-                    "$BUILD"/.project
-                #
-                # Add build commands
-                #
-                for c in com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder; do
-                    xmlstarlet ed -P -L \
-                        -s "/projectDescription/buildSpec" -t elem -n buildCommandNew -v "" \
-                        -s "/projectDescription/buildSpec/buildCommandNew" -t elem -n name -v $c \
-                        -s "/projectDescription/buildSpec/buildCommandNew" -t elem -n arguments -v "" \
-                        -r "/projectDescription/buildSpec/buildCommandNew" -v "buildCommand" \
-                        "$BUILD"/.project
-                done
-            fi
-
             if [[ $FIX_SCM ]]; then
             if [[ $FIX_SCM ]]; then
                 # Copy the Eclipse project setting files to Source tree in order to fix it so that Eclipse's SCM feature works again
                 # Copy the Eclipse project setting files to Source tree in order to fix it so that Eclipse's SCM feature works again
                 echo -- post_cmake: Move Eclipse project setting files to $SOURCE and fix them to reenable Eclipse SCM feature
                 echo -- post_cmake: Move Eclipse project setting files to $SOURCE and fix them to reenable Eclipse SCM feature

+ 0 - 23
script/cmake_android.bat

@@ -1,23 +0,0 @@
-::
-:: Copyright (c) 2008-2018 the Urho3D project.
-::
-:: Permission is hereby granted, free of charge, to any person obtaining a copy
-:: of this software and associated documentation files (the "Software"), to deal
-:: in the Software without restriction, including without limitation the rights
-:: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-:: copies of the Software, and to permit persons to whom the Software is
-:: furnished to do so, subject to the following conditions:
-::
-:: The above copyright notice and this permission notice shall be included in
-:: all copies or substantial portions of the Software.
-::
-:: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-:: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-:: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-:: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-:: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-:: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-:: THE SOFTWARE.
-::
-
-@"%~dp0cmake_generic.bat" %* -DANDROID=1

+ 0 - 26
script/cmake_android.sh

@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2008-2018 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-$(dirname $0)/cmake_generic.sh "$@" -DANDROID=1
-
-# vi: set ts=4 sw=4 expandtab:

+ 1 - 1
script/cmake_generic.bat

@@ -46,7 +46,7 @@ set "BUILD_OPTS="
 set "arch="
 set "arch="
 :loop
 :loop
 if not "%~1" == "" (
 if not "%~1" == "" (
-    if "%~1" == "-DANDROID" if "%~2" == "1" set "OPTS=-G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="%TOOLCHAINS%\Android.cmake""
+    if "%~1" == "-DANDROID" if "%~2" == "1" (echo For Android platform, use Gradle build system instead of invoking CMake build system directly! && exit /B 1)
     if "%~1" == "-DWEB" if "%~2" == "1" set "OPTS=-G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="%TOOLCHAINS%\Emscripten.cmake""
     if "%~1" == "-DWEB" if "%~2" == "1" set "OPTS=-G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="%TOOLCHAINS%\Emscripten.cmake""
     if "%~1" == "-DMINGW" if "%~2" == "1" set "OPTS=-G "MinGW Makefiles""
     if "%~1" == "-DMINGW" if "%~2" == "1" set "OPTS=-G "MinGW Makefiles""
     if "%~1" == "-DURHO3D_64BIT" if "%~2" == "1" set "arch= Win64"
     if "%~1" == "-DURHO3D_64BIT" if "%~2" == "1" set "arch= Win64"

+ 2 - 1
script/cmake_generic.sh

@@ -51,7 +51,8 @@ for a in $@; do
             TVOS=1
             TVOS=1
             ;;
             ;;
         -DANDROID=1)
         -DANDROID=1)
-            ANDROID=1 && OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/Android.cmake"
+            echo For Android platform, use Gradle build system instead of invoking CMake build system directly!
+            exit 1
             ;;
             ;;
         -DRPI=1)
         -DRPI=1)
             if [[ ! $(uname -m) =~ ^arm ]]; then OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/RaspberryPi.cmake"; fi
             if [[ ! $(uname -m) =~ ^arm ]]; then OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/RaspberryPi.cmake"; fi