From Rafa Gaitan, "I'm attaching also a new version of the toolchain with support for the r10c ndk. This fixes some CMake Warnings and allows to use the toolchain in macosx."

git-svn-id: aa838dfc23441284dd616281de4245daec5d2135@14558 16af8721-9629-0410-8352-f15c8da7e697

--- PlatformSpecifics/Android/android.toolchain.cmake
+++ PlatformSpecifics/Android/android.toolchain.cmake
@@ -1,5 +1,5 @@
 # Copyright (c) 2010-2011, Ethan Rublee
-# Copyright (c) 2011-2013, Andrey Kamaev
+# Copyright (c) 2011-2014, Andrey Kamaev
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -12,9 +12,9 @@
 #     this list of conditions and the following disclaimer in the documentation
 #     and/or other materials provided with the distribution.
 #
-# 3.  The name of the copyright holders may be used to endorse or promote
-#     products derived from this software without specific prior written
-#     permission.
+# 3.  Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from this
+#     software without specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -29,12 +29,9 @@
 # POSSIBILITY OF SUCH DAMAGE.

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r9
+#  Android CMake toolchain file, for use with the Android NDK r5-r10c
 #  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
 #  See home page: https://github.com/taka-no-me/android-cmake
-#
-#  The file is mantained by the OpenCV project. The latest version can be get at
-#  http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
 #
 #  Usage Linux:
 #   $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
@@ -50,7 +47,7 @@
 #
 #  Usage Windows:
 #     You need native port of make to build your project.
-#     Android NDK r7 (or newer) already has make.exe on board.
+#     Android NDK r7 (and newer) already has make.exe on board.
 #     For older NDK you have to install it separately.
 #     For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
 #
@@ -76,36 +73,54 @@
 #      used by ndk-build tool from Android NDK.
 #
 #      Possible targets are:
-#        "armeabi" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "armeabi-v7a" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "armeabi" - ARMv5TE based CPU with software floating point operations
+#        "armeabi-v7a" - ARMv7 based devices with hardware FPU instructions
+#            this ABI target is used by default
 #        "armeabi-v7a with NEON" - same as armeabi-v7a, but
 #            sets NEON as floating-point unit
 #        "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
-#            sets VFPV3 as floating-point unit (has 32 registers instead of 16).
-#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
-#        "x86" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "mips" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#            sets VFPV3 as floating-point unit (has 32 registers instead of 16)
+#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP
+#        "x86" - IA-32 instruction set
+#        "mips" - MIPS32 instruction set
+#
+#      64-bit ABIs for NDK r10 and newer:
+#        "arm64-v8a" - ARMv8 AArch64 instruction set
+#        "x86_64" - Intel64 instruction set (r1)
+#        "mips64" - MIPS64 instruction set (r6)
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
 #      Option is read-only when standalone toolchain is used.
-#
-#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 - the name of compiler
+#      Note: building for "android-L" requires explicit configuration.
+#
+#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 - the name of compiler
 #      toolchain to be used. The list of possible values depends on the NDK
-#      version. For NDK r8c the possible values are:
-#
-#        * arm-linux-androideabi-4.4.3
+#      version. For NDK r10c the possible values are:
+#
+#        * aarch64-linux-android-4.9
+#        * aarch64-linux-android-clang3.4
+#        * aarch64-linux-android-clang3.5
 #        * arm-linux-androideabi-4.6
-#        * arm-linux-androideabi-clang3.1
-#        * mipsel-linux-android-4.4.3
+#        * arm-linux-androideabi-4.8
+#        * arm-linux-androideabi-4.9 (default)
+#        * arm-linux-androideabi-clang3.4
+#        * arm-linux-androideabi-clang3.5
+#        * mips64el-linux-android-4.9
+#        * mips64el-linux-android-clang3.4
+#        * mips64el-linux-android-clang3.5
 #        * mipsel-linux-android-4.6
-#        * mipsel-linux-android-clang3.1
-#        * x86-4.4.3
+#        * mipsel-linux-android-4.8
+#        * mipsel-linux-android-4.9
+#        * mipsel-linux-android-clang3.4
+#        * mipsel-linux-android-clang3.5
 #        * x86-4.6
-#        * x86-clang3.1
+#        * x86-4.8
+#        * x86-4.9
+#        * x86-clang3.4
+#        * x86-clang3.5
+#        * x86_64-4.9
+#        * x86_64-clang3.4
+#        * x86_64-clang3.5
 #
 #    ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
 #      instead of Thumb. Is not available for "x86" (inapplicable) and
@@ -181,8 +196,9 @@
 #    ANDROID and BUILD_ANDROID will be set to true, you may test any of these
 #    variables to make necessary Android-specific configuration changes.
 #
-#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually
-#    exclusive. NEON option will be set true if VFP is set to NEON.
+#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS or ARM64_V8A or X86_64 or MIPS64
+#    will be set true, mutually exclusive. NEON option will be set true
+#    if VFP is set to NEON.
 #
 #    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
 #    libraries will be installed.
@@ -190,114 +206,17 @@
 #    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
 #    (depending on the target ABI). This is convenient for Android packaging.
 #
-#  Change Log:
-#   - initial version December 2010
-#   - April 2011
-#     [+] added possibility to build with NDK (without standalone toolchain)
-#     [+] support cross-compilation on Windows (native, no cygwin support)
-#     [+] added compiler option to force "char" type to be signed
-#     [+] added toolchain option to compile to 32-bit ARM instructions
-#     [+] added toolchain option to disable SWIG search
-#     [+] added platform "armeabi-v7a with VFPV3"
-#     [~] ARM_TARGETS renamed to ARM_TARGET
-#     [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
-#     [~] Fixed bug with ANDROID_API_LEVEL variable
-#     [~] turn off SWIG search if it is not found first time
-#   - May 2011
-#     [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
-#     [+] ANDROID_API_LEVEL is detected by toolchain if not specified
-#     [~] added guard to prevent changing of output directories on the first
-#         cmake pass
-#     [~] toolchain exits with error if ARM_TARGET is not recognized
-#   - June 2011
-#     [~] default NDK path is updated for version r5c
-#     [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
-#     [~] toolchain install directory is added to linker paths
-#     [-] removed SWIG-related stuff from toolchain
-#     [+] added macro find_host_package, find_host_program to search
-#         packages/programs on the host system
-#     [~] fixed path to STL library
-#   - July 2011
-#     [~] fixed options caching
-#     [~] search for all supported NDK versions
-#     [~] allowed spaces in NDK path
-#   - September 2011
-#     [~] updated for NDK r6b
-#   - November 2011
-#     [*] rewritten for NDK r7
-#     [+] x86 toolchain support (experimental)
-#     [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
-#     [~] improved compiler and linker flags management
-#     [+] support different build flags for Release and Debug configurations
-#     [~] by default compiler flags the same as used by ndk-build (but only
-#         where reasonable)
-#     [~] ANDROID_NDK_TOOLCHAIN_ROOT is splitted to ANDROID_STANDALONE_TOOLCHAIN
-#         and ANDROID_TOOLCHAIN_ROOT
-#     [~] ARM_TARGET is renamed to ANDROID_ABI
-#     [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
-#     [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
-#   - January 2012
-#     [+] added stlport_static support (experimental)
-#     [+] added special check for cygwin
-#     [+] filtered out hidden files (starting with .) while globbing inside NDK
-#     [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
-#     [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
-#   - February 2012
-#     [+] updated for NDK r7b
-#     [~] fixed cmake try_compile() command
-#     [~] Fix for missing install_name_tool on OS X
-#   - March 2012
-#     [~] fixed incorrect C compiler flags
-#     [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
-#     [+] improved toolchain loading speed
-#     [+] added assembler language support (.S)
-#     [+] allowed preset search paths and extra search suffixes
-#   - April 2012
-#     [+] updated for NDK r7c
-#     [~] fixed most of problems with compiler/linker flags and caching
-#     [+] added option ANDROID_FUNCTION_LEVEL_LINKING
-#   - May 2012
-#     [+] updated for NDK r8
-#     [+] added mips architecture support
-#   - August 2012
-#     [+] updated for NDK r8b
-#     [~] all intermediate files generated by toolchain are moved to CMakeFiles
-#     [~] libstdc++ and libsupc are removed from explicit link libraries
-#     [+] added CCache support (via NDK_CCACHE environment or cmake variable)
-#     [+] added gold linker support for NDK r8b
-#     [~] fixed mips linker flags for NDK r8b
-#   - September 2012
-#     [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
-#     [+] added support for all C++ runtimes from NDK
-#         (system, gabi++, stlport, gnustl)
-#     [+] improved warnings on known issues of NDKs
-#     [~] use gold linker as default if available (NDK r8b)
-#     [~] globally turned off rpath
-#     [~] compiler options are aligned with NDK r8b
-#   - October 2012
-#     [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
-#   - November 2012
-#     [+] updated for NDK r8c
-#     [+] added support for clang compiler
-#   - December 2012
-#     [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
-#     [+] adjust API level to closest compatible as NDK does
-#     [~] fixed ccache full path search
-#     [+] updated for NDK r8d
-#     [~] compiler options are aligned with NDK r8d
-#   - March 2013
-#     [+] updated for NDK r8e (x86 version)
-#     [+] support x86_64 version of NDK
-#   - April 2013
-#     [+] support non-release NDK layouts (from Linaro git and Android git)
-#     [~] automatically detect if explicit link to crtbegin_*.o is needed
-#   - June 2013
-#     [~] fixed stl include path for standalone toolchain made by NDK >= r8c
-#   - July 2013
-#     [+] updated for NDK r9
 # ------------------------------------------------------------------------------

+# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
+
 cmake_minimum_required( VERSION 2.6.3 )
+
+# Urho3D: on Windows Cygwin-based NDK tools may fail in the linking phase with too long command line. Turn on response files to avoid this
+if( CMAKE_HOST_WIN32 )
+ set( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
+ set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
+endif()

 if( DEFINED CMAKE_CROSSCOMPILING )
  # subsequent toolchain loading is not really needed
@@ -305,23 +224,31 @@
 endif()

 if( CMAKE_TOOLCHAIN_FILE )
- # touch toolchain variable only to suppress "unused variable" warning
-endif()
-
+ # touch toolchain variable to suppress "unused variable" warning
+endif()
+
+# inherit settings in recursive loads
 get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
 if( _CMAKE_IN_TRY_COMPILE )
  include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
 endif()

 # this one is important
-set( CMAKE_SYSTEM_NAME Linux )
+if( CMAKE_VERSION VERSION_GREATER "3.0.99" )
+ set( CMAKE_SYSTEM_NAME Android )
+else()
+ set( CMAKE_SYSTEM_NAME Linux )
+endif()
+
 # this one not so much
 set( CMAKE_SYSTEM_VERSION 1 )

 # rpath makes low sence for Android
+set( CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "" )
 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )

-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+# NDK search paths
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
 if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -335,13 +262,22 @@
  set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
 endif()

+# known ABIs
 set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
+set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
 set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
-set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
-
-set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
+set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
+set( ANDROID_SUPPORTED_ABIS_mips "mips" )
+set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
+
+# API level defaults
+# Urho3D: default to API 12
+set( ANDROID_DEFAULT_NDK_API_LEVEL 12 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 12)
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 12 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )

 macro( __LIST_FILTER listvar regex )
@@ -417,7 +353,7 @@
 endmacro()

 macro( __DETECT_NATIVE_API_LEVEL _var _path )
- SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
+ SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*.*$" )
  FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
  if( NOT __apiFileContent )
   message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
@@ -467,7 +403,7 @@

 # detect current host platform
-if( NOT DEFINED ANDROID_NDK_HOST_X64 AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64" OR CMAKE_HOST_APPLE) )
  set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
  mark_as_advanced( ANDROID_NDK_HOST_X64 )
 endif()
@@ -529,12 +465,15 @@
  set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
  set( BUILD_WITH_ANDROID_NDK True )
  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
-  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
-  string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
+  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX "r[0-9]+[a-z]?" )
+  string( REGEX MATCH "r([0-9]+)([a-z]?)" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
  else()
   set( ANDROID_NDK_RELEASE "r1x" )
   set( ANDROID_NDK_RELEASE_FULL "unreleased" )
  endif()
+ string( REGEX REPLACE "r([0-9]+)([a-z]?)" "\\1*1000" ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE}" )
+ string( FIND " abcdefghijklmnopqastuvwxyz" "${CMAKE_MATCH_2}" __ndkReleaseLetterNum )
+ math( EXPR ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE_NUM}+${__ndkReleaseLetterNum}" )
 elseif( ANDROID_STANDALONE_TOOLCHAIN )
  get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
  # try to detect change
@@ -615,12 +554,18 @@
  if( NOT __availableToolchainMachines )
   message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
  endif()
- if( __availableToolchainMachines MATCHES i686 )
+ if( __availableToolchainMachines MATCHES x86_64 )
+  set( __availableToolchainArchs "x86_64" )
+ elseif( __availableToolchainMachines MATCHES i686 )
   set( __availableToolchainArchs "x86" )
+ elseif( __availableToolchainMachines MATCHES aarch64 )
+  set( __availableToolchainArchs "arm64" )
  elseif( __availableToolchainMachines MATCHES arm )
   set( __availableToolchainArchs "arm" )
+ elseif( __availableToolchainMachines MATCHES mips64el )
+  set( __availableToolchainArchs "mips64" )
  elseif( __availableToolchainMachines MATCHES mipsel )
-  set( __availableToolchainArchs "mipsel" )
+  set( __availableToolchainArchs "mips" )
  endif()
  execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
                   OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
@@ -636,24 +581,44 @@
 macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
  foreach( __toolchain ${${__availableToolchainsLst}} )
   if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
-   string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   SET( __toolchainVersionRegex "^TOOLCHAIN_VERSION[\t ]+:=[\t ]+(.*)$" )
+   FILE( STRINGS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}/setup.mk" __toolchainVersionStr REGEX "${__toolchainVersionRegex}" )
+   if( __toolchainVersionStr )
+    string( REGEX REPLACE "${__toolchainVersionRegex}" "\\1" __toolchainVersionStr "${__toolchainVersionStr}" )
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-${__toolchainVersionStr}" __gcc_toolchain "${__toolchain}" )
+   else()
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   endif()
+   unset( __toolchainVersionStr )
+   unset( __toolchainVersionRegex )
   else()
    set( __gcc_toolchain "${__toolchain}" )
   endif()
   __DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
   if( __machine )
    string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
-   if( __machine MATCHES i686 )
+   if( __machine MATCHES x86_64 )
+    set( __arch "x86_64" )
+   elseif( __machine MATCHES i686 )
     set( __arch "x86" )
+   elseif( __machine MATCHES aarch64 )
+    set( __arch "arm64" )
    elseif( __machine MATCHES arm )
     set( __arch "arm" )
+   elseif( __machine MATCHES mips64el )
+    set( __arch "mips64" )
    elseif( __machine MATCHES mipsel )
-    set( __arch "mipsel" )
+    set( __arch "mips" )
+   else()
+    set( __arch "" )
    endif()
-   list( APPEND __availableToolchainMachines "${__machine}" )
-   list( APPEND __availableToolchainArchs "${__arch}" )
-   list( APPEND __availableToolchainCompilerVersions "${__version}" )
-   list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   #message("machine: !${__machine}!\narch: !${__arch}!\nversion: !${__version}!\ntoolchain: !${__toolchain}!\n")
+   if (__arch)
+    list( APPEND __availableToolchainMachines "${__machine}" )
+    list( APPEND __availableToolchainArchs "${__arch}" )
+    list( APPEND __availableToolchainCompilerVersions "${__version}" )
+    list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   endif()
   endif()
   unset( __gcc_toolchain )
  endforeach()
@@ -685,6 +650,7 @@
   endif()
   __LIST_FILTER( __availableToolchainsLst "^[.]" )
   __LIST_FILTER( __availableToolchainsLst "llvm" )
+  __LIST_FILTER( __availableToolchainsLst "renderscript" )
   __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
   if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
    __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
@@ -728,28 +694,45 @@
  set( X86 true )
  set( ANDROID_NDK_ABI_NAME "x86" )
  set( ANDROID_ARCH_NAME "x86" )
- set( ANDROID_ARCH_FULLNAME "x86" )
  set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
+elseif( ANDROID_ABI STREQUAL "x86_64" )
+ set( X86 true )
+ set( X86_64 true )
+ set( ANDROID_NDK_ABI_NAME "x86_64" )
+ set( ANDROID_ARCH_NAME "x86_64" )
+ set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
+ set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
+elseif( ANDROID_ABI STREQUAL "mips64" )
+ set( MIPS64 true )
+ set( ANDROID_NDK_ABI_NAME "mips64" )
+ set( ANDROID_ARCH_NAME "mips64" )
+ set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "mips64" )
 elseif( ANDROID_ABI STREQUAL "mips" )
  set( MIPS true )
  set( ANDROID_NDK_ABI_NAME "mips" )
  set( ANDROID_ARCH_NAME "mips" )
- set( ANDROID_ARCH_FULLNAME "mipsel" )
  set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "mips" )
+elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
+ set( ARM64_V8A true )
+ set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
+ set( ANDROID_ARCH_NAME "arm64" )
+ set( ANDROID_LLVM_TRIPLE "aarch64-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
+ set( VFPV3 true )
+ set( NEON true )
 elseif( ANDROID_ABI STREQUAL "armeabi" )
  set( ARMEABI true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
  set( ARMEABI_V6 true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv6" )
  # need always fallback to older platform
@@ -758,14 +741,12 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -773,7 +754,6 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -807,7 +787,7 @@
 To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
  endif()
  list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
- if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+ if( NOT __toolchainArch STREQUAL ANDROID_ARCH_NAME )
   message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
  endif()
 else()
@@ -818,7 +798,7 @@
  math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
  foreach( __idx RANGE ${__availableToolchainsCount} )
   list( GET __availableToolchainArchs ${__idx} __toolchainArch )
-  if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+  if( __toolchainArch STREQUAL ANDROID_ARCH_NAME )
    list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
    string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
    if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
@@ -847,15 +827,16 @@

 # choose native API level
 __INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
-string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( REPLACE "android-" "" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( STRIP "${ANDROID_NATIVE_API_LEVEL}" ANDROID_NATIVE_API_LEVEL )
 # adjust API level
 set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
 foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
+ if( (__level LESS ANDROID_NATIVE_API_LEVEL OR __level STREQUAL ANDROID_NATIVE_API_LEVEL) AND NOT __level LESS __real_api_level )
   set( __real_api_level ${__level} )
  endif()
 endforeach()
-if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
+if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL STREQUAL __real_api_level )
  message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
  set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
 endif()
@@ -867,7 +848,7 @@
 else()
  if( BUILD_WITH_ANDROID_NDK )
   __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
-  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
+  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
    message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
   endif()
   unset( __realApiLevel )
@@ -884,8 +865,8 @@
 # remember target ABI
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
 if( CMAKE_VERSION VERSION_GREATER "2.8" )
- list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
- set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
+ list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME} )
+ set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME}} )
 endif()

@@ -1027,7 +1008,7 @@
  string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
 elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
  string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
- string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
+ string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-${ANDROID_COMPILER_VERSION}" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
  if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
   message( FATAL_ERROR "Could not find the Clang compiler driver" )
  endif()
@@ -1060,7 +1041,7 @@
   set( ANDROID_EXCEPTIONS       ON )
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
  elseif( ANDROID_STL MATCHES "gabi" )
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
   endif()
   set( ANDROID_RTTI             ON )
@@ -1068,12 +1049,12 @@
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
   set( __libstl                 "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
  elseif( ANDROID_STL MATCHES "stlport" )
-  if( NOT ANDROID_NDK_RELEASE STRLESS "r8d" )
+  if( NOT ANDROID_NDK_RELEASE_NUM LESS 8004 ) # before r8d
    set( ANDROID_EXCEPTIONS       ON )
   else()
    set( ANDROID_EXCEPTIONS       OFF )
   endif()
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    set( ANDROID_RTTI            OFF )
   else()
    set( ANDROID_RTTI            ON )
@@ -1132,15 +1113,7 @@
 # case of shared STL linkage
 if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
  string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
- if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
-  get_filename_component( __libstlname "${__libstl}" NAME )
-  execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
-  if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
-   message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
-  endif()
-  unset( __fileCopyProcess )
-  unset( __libstlname )
- endif()
+ # TODO: check if .so file exists before the renaming
 endif()

@@ -1207,7 +1180,11 @@
  set( CMAKE_C_COMPILER_ID Clang)
 endif()
 set( CMAKE_C_PLATFORM_ID Linux )
-set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+if( X86_64 OR MIPS64 OR ARM64_V8A )
+ set( CMAKE_C_SIZEOF_DATA_PTR 8 )
+else()
+ set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+endif()
 set( CMAKE_C_HAS_ISYSROOT 1 )
 set( CMAKE_C_COMPILER_ABI ELF )
 CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@@ -1215,7 +1192,7 @@
  set( CMAKE_CXX_COMPILER_ID Clang)
 endif()
 set( CMAKE_CXX_PLATFORM_ID Linux )
-set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
+set( CMAKE_CXX_SIZEOF_DATA_PTR ${CMAKE_C_SIZEOF_DATA_PTR} )
 set( CMAKE_CXX_HAS_ISYSROOT 1 )
 set( CMAKE_CXX_COMPILER_ABI ELF )
 set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@@ -1256,7 +1233,14 @@
 endif()

 # NDK flags
-if( ARMEABI OR ARMEABI_V7A )
+if (ARM64_V8A )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -ffunction-sections -funwind-tables" )
+ set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
+ set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
+ if( NOT ANDROID_COMPILER_IS_CLANG )
+  set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
+ endif()
+elseif( ARMEABI OR ARMEABI_V7A)
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
  if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
   set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
@@ -1272,7 +1256,7 @@
    set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
   endif()
  endif()
-elseif( X86 )
+elseif( X86 OR X86_64 )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
@@ -1281,7 +1265,7 @@
  endif()
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
-elseif( MIPS )
+elseif( MIPS OR MIPS64 )
  set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
@@ -1360,7 +1344,7 @@
 endif()

 # variables controlling optional build flags
-if (ANDROID_NDK_RELEASE STRLESS "r7")
+if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
  # libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
  # So this flag option is required for all projects using OpenGL from native.
  __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES ON )
@@ -1376,7 +1360,7 @@
 set( ANDROID_NO_UNDEFINED           ${ANDROID_NO_UNDEFINED}           CACHE BOOL "Show all undefined symbols as linker errors" )
 set( ANDROID_SO_UNDEFINED           ${ANDROID_SO_UNDEFINED}           CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
 set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker (only avaialble for NDK r8b for ARM and x86 architectures on linux-86 and darwin-x86 hosts)" )
+set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker" )
 set( ANDROID_NOEXECSTACK            ${ANDROID_NOEXECSTACK}            CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
 set( ANDROID_RELRO                  ${ANDROID_RELRO}                  CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
 mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
@@ -1411,9 +1395,9 @@
 endif()

 if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
- if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE STRGREATER "r8b") AND (ARMEABI OR ARMEABI_V7A OR X86) )
+ if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE_NUM GREATER 8002) AND (ARMEABI OR ARMEABI_V7A OR X86) )
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
- elseif( ANDROID_NDK_RELEASE STRGREATER "r8b")
+ elseif( ANDROID_NDK_RELEASE_NUM GREATER 8002 ) # after r8b
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
  elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
   message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
@@ -1437,13 +1421,7 @@
 endif()

 if( ANDROID_COMPILER_IS_CLANG )
- set( ANDROID_CXX_FLAGS "-Qunused-arguments ${ANDROID_CXX_FLAGS}" )
- if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD )
-  set( ANDROID_CXX_FLAGS_RELEASE "-target thumbv7-none-linux-androideabi ${ANDROID_CXX_FLAGS_RELEASE}" )
-  set( ANDROID_CXX_FLAGS_DEBUG   "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS_DEBUG}" )
- else()
-  set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
- endif()
+ set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
  if( BUILD_WITH_ANDROID_NDK )
   set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
  endif()
@@ -1452,8 +1430,9 @@
 # cache flags
 set( CMAKE_CXX_FLAGS           ""                        CACHE STRING "c++ flags" )
 set( CMAKE_C_FLAGS             ""                        CACHE STRING "c flags" )
-set( CMAKE_CXX_FLAGS_RELEASE   "-O3 -DNDEBUG"            CACHE STRING "c++ Release flags" )
-set( CMAKE_C_FLAGS_RELEASE     "-O3 -DNDEBUG"            CACHE STRING "c Release flags" )
+# Urho3D: optimise for size
+set( CMAKE_CXX_FLAGS_RELEASE   "-Os -DNDEBUG"            CACHE STRING "c++ Release flags" )
+set( CMAKE_C_FLAGS_RELEASE     "-Os -DNDEBUG"            CACHE STRING "c Release flags" )
 set( CMAKE_CXX_FLAGS_DEBUG     "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c++ Debug flags" )
 set( CMAKE_C_FLAGS_DEBUG       "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c Debug flags" )
 set( CMAKE_SHARED_LINKER_FLAGS ""                        CACHE STRING "shared linker flags" )
@@ -1505,7 +1484,8 @@

 # global includes and link directories
 include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
-link_directories( "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
+get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
+link_directories( "${__android_install_path}" )

 # detect if need link crtbegin_so.o explicitly
 if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
@@ -1554,8 +1534,21 @@
  else()
   set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
  endif()
- set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
-endif()
+ # Urho3D: All libraries are first generated in CMake default binary directory and only the main target library is later copied to below output path by Urho3D own build script
+ set( ANDROID_LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" FORCE )
+endif()
+
+# copy shaed stl library to build directory
+if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
+ get_filename_component( __libstlname "${__libstl}" NAME )
+ execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
+ if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
+  message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
+ endif()
+ unset( __fileCopyProcess )
+ unset( __libstlname )
+endif()
+

 # set these global flags for cmake client scripts to change behavior
 set( ANDROID True )
@@ -1689,8 +1682,8 @@

 # Variables controlling behavior or set by cmake toolchain:
-#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
-#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
+#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips", "arm64-v8a", "x86_64", "mips64"
+#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14,15,16,17,18,19,21 (depends on NDK version)
 #   ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
 #   ANDROID_FORBID_SYGWIN : ON/OFF
 #   ANDROID_NO_UNDEFINED : ON/OFF
@@ -1723,17 +1716,21 @@
 #   ARMEABI : TRUE for arm v6 and older devices
 #   ARMEABI_V6 : TRUE for arm v6
 #   ARMEABI_V7A : TRUE for arm v7a
+#   ARM64_V8A : TRUE for arm64-v8a
 #   NEON : TRUE if NEON unit is enabled
 #   VFPV3 : TRUE if VFP version 3 is enabled
 #   X86 : TRUE if configured for x86
+#   X86_64 : TRUE if configured for x86_64
 #   MIPS : TRUE if configured for mips
+#   MIPS64 : TRUE if configured for mips64
 #   BUILD_ANDROID : always TRUE
 #   BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
 #   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
 #   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
-#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9; set only for NDK
-#   ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
+#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
+#   ANDROID_NDK_RELEASE : from r5 to r10c; set only for NDK
+#   ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
+#   ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
 #   ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
@@ -1741,7 +1738,8 @@
 #   ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
 #
 # Secondary (less stable) read-only variables:
-#   ANDROID_COMPILER_VERSION : GCC version used
+#   ANDROID_COMPILER_VERSION : GCC version used (not Clang version)
+#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
 #   ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
 #   ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
 #   ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
@@ -1752,7 +1750,6 @@
 #   ANDROID_RTTI : if rtti is enabled by the runtime
 #   ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
 #   ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
-#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
 #   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
 #
 # Defaults:
@@ -1762,4 +1759,3 @@
 #   ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
 #   ANDROID_SUPPORTED_ABIS_${ARCH}
 #   ANDROID_SUPPORTED_NDK_VERSIONS
-


fix check if compiler supports "-Wall"

fix check if compiler supports "-Wall"

--- lib/orogen/templates/config/Base.cmake
+++ lib/orogen/templates/config/Base.cmake
@@ -9,9 +9,9 @@

 # Enable -Wall for compilers that know it
 include(CheckCXXCompilerFlag)
-CHECK_CXX_COMPILER_FLAG("-Wall", CXX_SUPPORTS_WALL)
+CHECK_CXX_COMPILER_FLAG("-Wall" CXX_SUPPORTS_WALL)
 if (CXX_SUPPORTS_WALL)
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+    add_definitions (" -Wall")
 endif (CXX_SUPPORTS_WALL)

 # Define the necessary RPath information for all binaries. That can be stripped


Use DSN_PEDANTIC to control whether treat warnings as errors.

--- cmake/dsn.cmake
+++ cmake/dsn.cmake
@@ -143,13 +143,17 @@

 	if(UNIX)
 		add_compile_options(-std=c++11)
-		add_compile_options(-Werror)
+		if(DEFINED DSN_PEDANTIC)
+			add_compile_options(-Werror)
+		endif()
 	elseif(MSVC)
 		add_definitions(-D_CONSOLE)
 		add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 		add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
 		add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS=1)
-		add_compile_options(-WX)
+		if(DEFINED DSN_PEDANTIC)
+			add_compile_options(-WX)
+		endif()
 	endif()
 endfunction(dsn_setup_compiler_flags)


added mex compiler options for visual studio

--- cmake/mex.cmake
+++ cmake/mex.cmake
@@ -70,6 +70,17 @@
   if ( WIN32 )
     get_mex_option(COMPILER CC)
     get_mex_option(COMPILER CXX)
+
+    get_mex_option(COMPFLAGS CFLAGS)
+    get_mex_option(COMPFLAGS CXXFLAGS)
+    get_mex_option(OPTIMFLAGS COPTIMFLAGS)
+    get_mex_option(OPTIMFLAGS CXXOPTIMFLAGS)
+    get_mex_option(DEBUGFLAGS CDEBUGFLAGS)
+    get_mex_option(DEBUGFLAGS CXXDEBUGFLAGS)
+
+    get_mex_option(LINKER LD)
+    get_mex_option(LINKFLAGS LDFLAGS)
+    get_mex_option(LINKDEBUGFLAGS LDDEBUGFLAGS)
   else()
     get_mex_option(CC)

@@ -172,7 +183,7 @@
       add_custom_command(COMMAND ${CMAKE_COMMAND} -E touch ${dummy_c_file}
                          OUTPUT ${dummy_c_file})
       add_library(exelast STATIC ${dummy_c_file})
-      target_link_libraries(exelast "${MEX_CLIBS} -ldl")  # note: the -ldl here might be overkill?  so far only needed it for drake_debug_mex.  (but it has to come later in the compiler arguments, too, in order to work.
+      target_link_libraries(exelast ${MEX_CLIBS} -ldl)  # note: the -ldl here might be overkill?  so far only needed it for drake_debug_mex.  (but it has to come later in the compiler arguments, too, in order to work.
     endif()

     target_link_libraries(${target} exelast)


nya_fetch

--- cmake/nya.cmake
+++ cmake/nya.cmake
@@ -21,7 +21,7 @@
 endif()

 # FetchContent into ../folder_name
-# nya_fetch(<url> <tag> <folder_name>)
+# nya_fetch(<git_url> <tag|branch|hash> <folder_name>)
 macro(nya_fetch)
     if(NOT ${ARGC} EQUAL 0)
         if(${ARGC} GREATER 1)


[CMake]: Fix PSXPC_N building.

[CMake]: Fix PSXPC_N building.

--- CMAKE/FindZLIB.cmake
+++ CMAKE/FindZLIB.cmake
@@ -139,4 +139,7 @@
                     IMPORTED_LOCATION "${ZLIB_LIBRARY}")
         endif()
     endif()
+else()
+#Hack to bypass zlib issues (PC_N)
+set(ZLIB_INCLUDE_DIR "NONE")
 endif()


added breakpad to cmake

added breakpad to cmake

--- CMakeOlxCommon.cmake
+++ CMakeOlxCommon.cmake
@@ -32,6 +32,7 @@
 OPTION(PYTHON_DED_EMBEDDED "Python embedded in dedicated server"  No)
 OPTION(OPTIM_PROJECTILES "Enable optimisations for projectiles" Yes)
 OPTION(MEMSTATS "Enable memory statistics and debugging" No)
+OPTION(BREAKPAD "Google Breakpad support" Yes)

 IF (DEBUG)
 	SET(CMAKE_BUILD_TYPE Debug)
@@ -75,6 +76,7 @@
 MESSAGE( "LIBZIP_BUILTIN = ${LIBZIP_BUILTIN}" )
 MESSAGE( "STLPORT = ${STLPORT}" )
 MESSAGE( "GCOREDUMPER = ${GCOREDUMPER}" )
+MESSAGE( "BREAKPAD = ${BREAKPAD}" )
 MESSAGE( "CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}" )
 MESSAGE( "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}" )
 MESSAGE( "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}" )
@@ -115,6 +117,20 @@
 	SET(ALL_SRCS ${OLXROOTDIR}/src/MacMain.m ${ALL_SRCS})
 ENDIF(APPLE)

+IF (BREAKPAD)
+	INCLUDE_DIRECTORIES(${OLXROOTDIR}/src/breakpad/external/src)
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/BreakPad.cpp ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/client/minidump_file_writer.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/client/linux/handler/exception_handler.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/client/linux/handler/linux_thread.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/client/linux/minidump_writer/linux_dumper.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/client/linux/minidump_writer/minidump_writer.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/common/convert_UTF.c ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/common/md5.c ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/common/string_conversion.cc ${ALL_SRCS})
+	SET(ALL_SRCS ${OLXROOTDIR}/src/breakpad/external/src/common/linux/guid_creator.cc ${ALL_SRCS})
+
+ENDIF (BREAKPAD)

 IF (GCOREDUMPER)
 	INCLUDE_DIRECTORIES(${OLXROOTDIR}/libs/coredumper/src)


relax cudnn version requirement

relax cudnn version requirement

--- caffe/cmake/Cuda.cmake
+++ caffe/cmake/Cuda.cmake
@@ -232,9 +232,9 @@

     message(STATUS "Found cuDNN: ver. ${CUDNN_VERSION} found (include: ${CUDNN_INCLUDE}, library: ${CUDNN_LIBRARY})")

-    string(COMPARE LESS "${CUDNN_VERSION_MAJOR}" 8 cuDNNVersionIncompatible)
+    string(COMPARE LESS "${CUDNN_VERSION_MAJOR}" 7 cuDNNVersionIncompatible)
     if(cuDNNVersionIncompatible)
-      message(FATAL_ERROR "cuDNN version >=8 is required.")
+      message(FATAL_ERROR "cuDNN version >=7 is required.")
     endif()

     set(CUDNN_VERSION "${CUDNN_VERSION}" PARENT_SCOPE)


Bug #53445 Build with -Wall and fix warnings that it generates Post-push fix: -Wall implies -Wunused on some platforms, which will generate thousands of warnings about unused parameters.

--- configure.cmake
+++ configure.cmake
@@ -56,7 +56,7 @@

 # Always enable -Wall for gnu C/C++
 IF(CMAKE_COMPILER_IS_GNUCXX)
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
 ENDIF()
 IF(CMAKE_COMPILER_IS_GNUCC)
   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")


cmake: do not strictly require liblo and jack

--- cmake/DPF-plugin.cmake
+++ cmake/DPF-plugin.cmake
@@ -122,6 +122,14 @@
 # Add build rules for a JACK program.
 #
 function(dpf__build_jack NAME DGL_LIBRARY)
+  find_package(PkgConfig)
+  pkg_check_modules(JACK "jack")
+  if(NOT JACK_FOUND)
+    dpf__warn_once_only(missing_jack
+      "JACK is not found, skipping the `jack` plugin targets")
+    return()
+  endif()
+
   dpf__add_executable("${NAME}-jack")
   dpf__add_plugin_main("${NAME}-jack" "jack")
   dpf__add_ui_main("${NAME}-jack" "jack" "${DGL_LIBRARY}")
@@ -129,9 +137,6 @@
   set_target_properties("${NAME}-jack" PROPERTIES
     RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>"
     OUTPUT_NAME "${NAME}")
-
-  find_package(PkgConfig)
-  pkg_check_modules(JACK "jack" REQUIRED)

   target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS})
   target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES})
@@ -159,7 +164,14 @@
 # Add build rules for a DSSI plugin.
 #
 function(dpf__build_dssi NAME DGL_LIBRARY)
-  # -- build for DSSI
+  find_package(PkgConfig)
+  pkg_check_modules(LIBLO "liblo")
+  if(NOT LIBLO_FOUND)
+    dpf__warn_once_only(missing_liblo
+      "liblo is not found, skipping the `dssi` plugin targets")
+    return()
+  endif()
+
   dpf__add_module("${NAME}-dssi")
   dpf__add_plugin_main("${NAME}-dssi" "dssi")
   target_link_libraries("${NAME}-dssi" PRIVATE "${NAME}-dsp")
@@ -175,9 +187,6 @@
     set_target_properties("${NAME}-dssi-ui" PROPERTIES
       RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}-dssi/$<0:>"
       OUTPUT_NAME "${NAME}_ui")
-
-    find_package(PkgConfig)
-    pkg_check_modules(LIBLO "liblo" REQUIRED)

     target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS})
     target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES})
@@ -469,3 +478,16 @@
   endif()
   set("${VAR}" "${_file}" PARENT_SCOPE)
 endfunction()
+
+# dpf__warn_once
+# ------------------------------------------------------------------------------
+#
+# Prints a warning message once only.
+#
+function(dpf__warn_once_only TOKEN MESSAGE)
+  get_property(_warned GLOBAL PROPERTY "dpf__have_warned_${TOKEN}")
+  if(NOT _warned)
+    set_property(GLOBAL PROPERTY "dpf__have_warned_${TOKEN}" TRUE)
+    message(WARNING "${MESSAGE}")
+  endif()
+endfunction()


use system variable instead of custom one

--- cmake/FindEigen2.cmake
+++ cmake/FindEigen2.cmake
@@ -1,4 +1,9 @@
 # - Try to find Eigen2 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+#   find_package(Eigen2 2.0.3)
+# to require version 2.0.3 to newer of Eigen2.
+#
 # Once done this will define
 #
 #  EIGEN2_FOUND - system has eigen lib with correct version
@@ -9,7 +14,7 @@
 # Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
 # Redistribution and use is allowed according to the terms of the BSD license.

-if(NOT EIGEN2_MIN_VERSION)
+if(NOT Eigen2_FIND_VERSION)
   if(NOT Eigen2_FIND_VERSION_MAJOR)
     set(Eigen2_FIND_VERSION_MAJOR 2)
   endif(NOT Eigen2_FIND_VERSION_MAJOR)
@@ -20,8 +25,8 @@
     set(Eigen2_FIND_VERSION_PATCH 0)
   endif(NOT Eigen2_FIND_VERSION_PATCH)

-  set(EIGEN2_MIN_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
-endif(NOT EIGEN2_MIN_VERSION)
+  set(Eigen2_FIND_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
+endif(NOT Eigen2_FIND_VERSION)

 macro(_eigen2_check_version)
   file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
@@ -34,16 +39,16 @@
   set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")

   set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
-  if(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+  if(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})
     set(EIGEN2_VERSION_OK FALSE)
-  else(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+  else(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})
     set(EIGEN2_VERSION_OK TRUE)
-  endif(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+  endif(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})

   if(NOT EIGEN2_VERSION_OK)

     message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
-                   "but at least version ${EIGEN2_MIN_VERSION} is required")
+                   "but at least version ${Eigen2_FIND_VERSION} is required")
   endif(NOT EIGEN2_VERSION_OK)
 endmacro(_eigen2_check_version)


cmake: syntax error

cmake: syntax error

introduced in a76904852c60b5b2d80508e32cd69694c2aff1fc, #196

--- cmake/FindGASNet.cmake
+++ cmake/FindGASNet.cmake
@@ -185,7 +185,7 @@
   mark_as_advanced(GASNet_ROOT_DIR)
   if(GASNet_ROOT_DIR)
     set(_GASNet_FIND_INCLUDE_OPTS PATHS ${GASNet_ROOT_DIR}/include NO_DEFAULT_PATH)
-  else
+  else()
     set(_GASNet_FIND_INCLUDE_OPTS HINTS ENV MPI_INCLUDE)
   endif()
   find_path(GASNet_INCLUDE_DIR gasnet.h ${_GASNet_FIND_INCLUDE_OPTS})


Add new Matlab version to MATLAB_VERSIONS_MAPPING

--- cmake/FindMatlab.cmake
+++ cmake/FindMatlab.cmake
@@ -263,6 +263,7 @@
 endif()

 set(MATLAB_VERSIONS_MAPPING
+  "R2022a=9.12"
   "R2021b=9.11"
   "R2021a=9.10"
   "R2020b=9.9"


cmake: Remove SHELL: tag in process_flags function

When fetching include, system include, compiler options, or compiler
defines, then it is important to strip the SHELL: (no de-duplication)
tag of any flag.

Signed-off-by: Torsten Rasmussen <a7c5b1d5a1f41fce6edfa3f7c2392ae0c59deafe@nordicsemi.no>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -293,6 +293,11 @@
     endforeach()

     if(NOT is_compile_lang_generator_expression)
+      # SHELL is used to avoid de-deplucation, but when process flags
+      # then this tag must be removed to return real compile/linker flags.
+      if(flag MATCHES "SHELL:[ ]*(.*)")
+        separate_arguments(flag UNIX_COMMAND ${CMAKE_MATCH_1})
+      endif()
       list(APPEND tmp_list ${flag})
     endif()
   endforeach()


VS2008 use FIXME_CMAKE_ABSOLUTE dev+

VS2008 use FIXME_CMAKE_ABSOLUTE dev+

--- cmake/BuildPCRE2.cmake
+++ cmake/BuildPCRE2.cmake
@@ -17,7 +17,7 @@
   -DWIN32:BOOL=${WIN32}
   -DTARGET_TEST_SYSTEM:STRING=${TARGET_TEST_SYSTEM}
   -DTARGET_TEST_CMAKE_COMMAND:STRING=${TARGET_TEST_SYSTEM_COMMAND}
-  -DCMAKE_PROJECT_pcre2_INCLUDE=${FIXME_CMAKE_ABSOLUTE}
+  -DCMAKE_PROJECT_INCLUDE:PATH=${FIXME_CMAKE_ABSOLUTE}
   )

 #


chore(cmake): undef _FORTIFY_SOURCE when building Debug

Fixes compilation

--- cmake/build/core.cmake
+++ cmake/build/core.cmake
@@ -16,6 +16,7 @@
 endif()

 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE")
   set(BUILDING_DEBUG TRUE)
 else()
   set(BUILDING_RELEASE TRUE)


Disable Standardese and Boost dependencies

--- cmake/deftargets.cmake
+++ cmake/deftargets.cmake
@@ -1,8 +1,6 @@
 include(CMakeParseArguments)
 include(GenerateExportHeader)

-include(cmake/boost)
-include(cmake/list_dependencies)
 include(cmake/utils.cmake)
 include(cmake/install.cmake)

@@ -203,10 +201,6 @@
         ${ARGS_INCLUDE_DIRS}
     )

-    if(TARGET_TYPE MATCHES ".*LIBRARY")
-        configure_standardese(TARGET ${NAME} ROOT_DIR "${current_includedir}")
-    endif()
-
     string(REGEX REPLACE "_" " " TARGET_TYPE "${TARGET_TYPE}")
     message(STATUS "SIPLASPLAS ${TARGET_TYPE} ${NAME}")


now exporting targets for dependencies as well.

--- WkDepends.cmake
+++ WkDepends.cmake
@@ -232,6 +232,8 @@
 			if (NOT dpdlib_type STREQUAL MODULE_LIBRARY)
 				TARGET_LINK_LIBRARIES(${target} ${dpdlib})
 				ADD_DEPENDENCIES(${target} ${dpdlib})
+				#Exporting targets
+				export(TARGETS ${dpdlib} APPEND FILE ${PROJECT_NAME}Export.cmake)
 			endif (NOT dpdlib_type STREQUAL MODULE_LIBRARY)

 			#We need to move project libraries and dependencies to the test target location after build.
@@ -309,6 +311,8 @@
 			if (NOT dpdlib_type STREQUAL MODULE_LIBRARY)
 				TARGET_LINK_LIBRARIES(${target} ${dpdlib})
 				ADD_DEPENDENCIES(${target} ${dpdlib})
+				#Exporting targets
+				export(TARGETS ${dpdlib} APPEND FILE ${PROJECT_NAME}Export.cmake)
 			endif (NOT dpdlib_type STREQUAL MODULE_LIBRARY)

 			#We need to move project libraries and dependencies to the test target location after build.


fptu-cmake: fix add_compile_flags macro.

--- cmake.fptu/utils.cmake
+++ cmake.fptu/utils.cmake
@@ -2,9 +2,9 @@
   foreach(_lang ${langs})
     string(REPLACE ";" " " _flags "${ARGN}")
     set("${_lang}_FLAGS" "${${_lang}_FLAGS} ${_flags}")
-    unset(${_lang})
-    unset(${_flags})
   endforeach()
+  unset(_lang)
+  unset(_flags)
 endmacro(add_compile_flags)

 macro(set_source_files_compile_flags)


Use custom TMPDIR for RPM creation

Use custom TMPDIR for RPM creation

--- cmake/CMakeALICE.cmake
+++ cmake/CMakeALICE.cmake
@@ -231,9 +231,9 @@
     configure_file("${AliRoot_SOURCE_DIR}/cmake/da.spec.in" "${DETECTOR}${_ALGORITHM}-da.spec" @ONLY)

     add_custom_command(TARGET ${DETECTOR}${ALGORITHM}da.exe POST_BUILD
-                       COMMAND mkdir ARGS -p da-${DETECTOR}${_ALGORITHM}-rpm/root/${DA_PREFIX}/
+                       COMMAND mkdir ARGS -p da-${DETECTOR}${_ALGORITHM}-rpm/root/${DA_PREFIX}/ ${CMAKE_CURRENT_BINARY_DIR}/rpmbuild.tmp
                        COMMAND cp ARGS ${DETECTOR}${ALGORITHM}da.exe da-${DETECTOR}${_ALGORITHM}-rpm/root/${DA_PREFIX}/
-                       COMMAND rpmbuild ARGS --verbose --define "_topdir ${CMAKE_CURRENT_BINARY_DIR}/da-${DETECTOR}${_ALGORITHM}-rpm" --define "%buildroot ${CMAKE_CURRENT_BINARY_DIR}/da-${DETECTOR}${_ALGORITHM}-rpm/root" -bb ${DETECTOR}${_ALGORITHM}-da.spec
+                       COMMAND env ARGS TMPDIR=${CMAKE_CURRENT_BINARY_DIR}/rpmbuild.tmp rpmbuild --verbose --define "_topdir ${CMAKE_CURRENT_BINARY_DIR}/da-${DETECTOR}${_ALGORITHM}-rpm" --define "%buildroot ${CMAKE_CURRENT_BINARY_DIR}/da-${DETECTOR}${_ALGORITHM}-rpm/root" -bb ${DETECTOR}${_ALGORITHM}-da.spec
                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM
                        COMMENT "RPM creation for ${DETECTOR}-${_ALGORITHM}"
     )


CMake: add source directory to includes

CMake: add source directory to includes

For Windows, make sure that the top-level directory is added to the
include path so that the examples can be built correctly.

--- cmake/CMakeWin32.cmake
+++ cmake/CMakeWin32.cmake
@@ -67,7 +67,7 @@
 # Module Definition and Compilation
 #

-INCLUDE_DIRECTORIES(${APR_INCLUDE_DIR} ${HTTPD_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(${APR_INCLUDE_DIR} ${HTTPD_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})

 ADD_LIBRARY(mod_websocket SHARED mod_websocket.c)
 SET_TARGET_PROPERTIES(mod_websocket


Automatically initialize submodule and detect python deps

--- cmake/DaemonCBSE.cmake
+++ cmake/DaemonCBSE.cmake
@@ -33,6 +33,27 @@
 endfunction()

 function(CBSE target definition output)
+    # Check if we need to initialize submodule
+    file(GLOB RESULT ${CMAKE_SOURCE_DIR}/src/utils/cbse)
+    list(LENGTH ${RESULT} RES_LEN)
+    if(RES_LEN EQUAL 0)
+        if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
+            find_package(Git REQUIRED)
+            if (GIT_FOUND)
+                execute_process(
+                    COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
+                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+            endif()
+        endif()
+    endif()
+    # Check if python has all the dependencies
+    # TODO: Execute pip directly here and install them
+    execute_process(
+        COMMAND ${PYTHON_EXECUTABLE} -c "import jinja2, yaml, collections.namedtuple, argparse, sys, os.path, re"
+        RESULT_VARIABLE RET)
+    if (NOT RET EQUAL 0)
+        message(FATAL_ERROR "Missing dependences for CBSE generation. Use pip -r install src/utils/cbse/requirements.txt to install")
+    endif()
     set(GENERATED_CBSE ${output}/backend/CBSEBackend.cpp
                        ${output}/backend/CBSEBackend.h
                        ${output}/backend/CBSEComponents.h)


C_INLINE_IS_INLINE

--- cmake/FindInline.cmake
+++ cmake/FindInline.cmake
@@ -27,6 +27,12 @@
     IF (_C_INLINE_FOUND)
       SET (C_INLINE "${_C_INLINE}" CACHE STRING "C inline keyword")
       MARK_AS_ADVANCED (C_INLINE)
+      IF ("${C_INLINE}" STREQUAL "inline")
+        SET (C_INLINE_IS_INLINE TRUE)
+      ELSE ()
+        SET (C_INLINE_IS_INLINE FALSE)
+      ENDIF ()
+      MARK_AS_ADVANCED (C_INLINE_IS_INLINE)
     ENDIF ()
     SET (C_INLINE_SINGLETON TRUE CACHE BOOL "C inline check singleton")
     MARK_AS_ADVANCED (C_INLINE_SINGLETON)


r9488/sofa : REMOVE: cmake messages when finding opencl paths

Former-commit-id: a3b6ccbb405003aa4d1eca9ca7a25e5a9d1abfd4

--- cmake/FindOpenCL.cmake
+++ cmake/FindOpenCL.cmake
@@ -46,8 +46,7 @@
 		ENDIF()
 		file(TO_CMAKE_PATH ${OPENCL_LIB_DIR} OPENCL_LIB_DIR)
 		GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIB_DIR} ABSOLUTE)
-
-		message("- ${OPENCL_LIB_DIR}")
+
 		FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib PATHS ${OPENCL_LIB_DIR} ENV OpenCL_LIBPATH)

 		GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
@@ -55,8 +54,6 @@
 		# On Win32 search relative to the library
 		FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" ENV OpenCL_INCPATH)
 		FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" ENV OpenCL_INCPATH)
-
-		message("- ${OPENCL_INCLUDE_DIRS}")

 	ELSE (WIN32)


Update gate file

Update gate file

--- cmake/HunterGate.cmake
+++ cmake/HunterGate.cmake
@@ -4,7 +4,7 @@
 # This is a gate file to Hunter package manager.
 # Usage: include this file using `include` command and add package you need:
 #
-#     include("HunterGate.cmake")
+#     include("cmake/HunterGate.cmake")
 #     hunter_add_package(Foo)
 #     hunter_add_package(Boo COMPONENTS Bar Baz)
 #
@@ -13,9 +13,20 @@
 #     * https://github.com/ruslo/hunter

 cmake_minimum_required(VERSION 2.8.10)
-
-set(HUNTER_MINIMUM_VERSION "0.3.2")
-set(HUNTER_MINIMUM_VERSION_HASH 969f2e912be035b4fd1e9cebc26b241737ff85a8)
+include(CMakeParseArguments)
+
+macro(hunter_minimum_required)
+  cmake_parse_arguments(HUNTER_MINIMUM "" "VERSION;URL;SHA1" "" ${ARGV})
+endmacro()
+
+# 01.
+# Customizable --
+hunter_minimum_required(
+    VERSION "0.4.2"
+    URL "https://github.com/ruslo/hunter/archive/v0.4.2.tar.gz"
+    SHA1 "e3f3d7d4f23f2c09a9df47d5ffa41b4fcc691fb3"
+)
+# -- end

 # Set HUNTER_ROOT cmake variable to suitable value.
 # Info about variable can be found in HUNTER_ROOT_INFO.
@@ -92,10 +103,9 @@
     )
   endif()

-  set(TEMP_DIR "${PROJECT_BINARY_DIR}/Hunter-activity/gate")
+  set(TEMP_DIR "${PROJECT_BINARY_DIR}/_3rdParty/gate")
   set(TEMP_BUILD "${TEMP_DIR}/_builds")

-  set(URL_BASE "https://github.com/ruslo/hunter/archive")
   file(
       WRITE
       "${TEMP_DIR}/CMakeLists.txt"
@@ -104,9 +114,9 @@
       "ExternalProject_Add(\n"
       "    Hunter\n"
       "    URL\n"
-      "    \"${URL_BASE}/v${HUNTER_MINIMUM_VERSION}.tar.gz\"\n"
+      "    \"${HUNTER_MINIMUM_URL}\"\n"
       "    URL_HASH\n"
-      "    SHA1=${HUNTER_MINIMUM_VERSION_HASH}\n"
+      "    SHA1=${HUNTER_MINIMUM_SHA1}\n"
       "    DOWNLOAD_DIR\n"
       "    \"${HUNTER_ROOT}/Download\"\n"
       "    SOURCE_DIR\n"
@@ -157,89 +167,72 @@
   message(STATUS "[hunter] downloaded to '${HUNTER_ROOT}'")
 endfunction()

-hunter_gate_detect_root() # set HUNTER_ROOT and HUNTER_ROOT_INFO
-
-if(NOT HUNTER_ROOT)
-  message(
-      FATAL_ERROR
-      "Internal error in 'hunter_gate_detect_root': HUNTER_ROOT is not setted"
-  )
-endif()
-
-# Beautify path, fix probable problems with windows path slashes
-get_filename_component(HUNTER_ROOT "${HUNTER_ROOT}" ABSOLUTE)
-
-if(NOT EXISTS "${HUNTER_ROOT}")
-  hunter_gate_do_download()
+# Get HUNTER_VERSION from ${HUNTER_ROOT}/Source/cmake/version.cmake
+# Preconditions: ${HUNTER_ROOT} is defined and is a directory
+function(hunter_gate_detect_version)
+  if(NOT HUNTER_ROOT)
+    message(FATAL_ERROR "Internal error")
+  endif()
+
   if(NOT EXISTS "${HUNTER_ROOT}")
-    message(
-        FATAL_ERROR
-        "Internal error in 'hunter_gate_do_download': "
-        "directory HUNTER_ROOT not found"
-    )
-  endif()
-endif()
-
-# at this point: HUNTER_ROOT exists and is file or directory
-if(NOT IS_DIRECTORY "${HUNTER_ROOT}")
-  message(
-      FATAL_ERROR
-      "HUNTER_ROOT is not directory (${HUNTER_ROOT})"
-      "(${HUNTER_ROOT_INFO})"
-  )
-endif()
-
-# at this point: HUNTER_ROOT exists and is directory
-file(GLOB _hunter_result "${HUNTER_ROOT}/*")
-list(LENGTH _hunter_result _hunter_result_len)
-if(_hunter_result_len EQUAL 0)
-  # HUNTER_ROOT directory is empty, let's download it
-  hunter_gate_do_download()
-endif()
-
-unset(_hunter_result)
-unset(_hunter_result_len)
-
-# at this point: HUNTER_ROOT exists and is not empty directory
-if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/Hunter")
-  message(
-      FATAL_ERROR
-      "HUNTER_ROOT directory exists (${HUNTER_ROOT})"
-      "but '${HUNTER_ROOT}/Source/cmake/Hunter' file not found"
-      "(${HUNTER_ROOT_INFO})"
-  )
-endif()
-
-# check version
-if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/version.cmake")
-  message(
-      FATAL_ERROR
-      "HUNTER_ROOT directory exists (${HUNTER_ROOT})"
-      "but '${HUNTER_ROOT}/Source/cmake/version.cmake' file not found"
-      "(${HUNTER_ROOT_INFO})"
-  )
-endif()
-
-unset(HUNTER_VERSION)
-include("${HUNTER_ROOT}/Source/cmake/version.cmake")
-if(NOT HUNTER_VERSION)
-  message(
-      FATAL_ERROR
-      "Internal error: HUNTER_VERSION is not set in `version.cmake`"
-  )
-endif()
-
-if(HUNTER_VERSION VERSION_LESS HUNTER_MINIMUM_VERSION)
-  message(
-      "Current version is ${HUNTER_VERSION}. "
-      "Minimum version is ${HUNTER_MINIMUM_VERSION}. "
-      "Try autoupdate..."
-  )
+    message(FATAL_ERROR "Internal error")
+  endif()
+
+  if(NOT IS_DIRECTORY "${HUNTER_ROOT}")
+    message(FATAL_ERROR "Internal error")
+  endif()
+
+  # check master (valid directory?)
+  if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/Hunter")
+    message(
+        FATAL_ERROR
+        "HUNTER_ROOT directory exists (${HUNTER_ROOT})"
+        "but '${HUNTER_ROOT}/Source/cmake/Hunter' file not found"
+        "(${HUNTER_ROOT_INFO})"
+    )
+  endif()
+
+  # check version
+  if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/version.cmake")
+    message(
+        FATAL_ERROR
+        "HUNTER_ROOT directory exists (${HUNTER_ROOT})"
+        "but '${HUNTER_ROOT}/Source/cmake/version.cmake' file not found"
+        "(${HUNTER_ROOT_INFO})"
+    )
+  endif()
+
+  unset(HUNTER_VERSION)
+  if(HUNTER_VERSION)
+    message(FATAL_ERROR "Internal error (HUNTER_VERSION in cache)")
+  endif()
+
+  include("${HUNTER_ROOT}/Source/cmake/version.cmake")
+  if(NOT HUNTER_VERSION)
+    message(
+        FATAL_ERROR
+        "Internal error: HUNTER_VERSION is not set in `version.cmake`"
+        " (${HUNTER_ROOT_INFO})"
+    )
+  endif()
+
+  set(HUNTER_VERSION ${HUNTER_VERSION} PARENT_SCOPE)
+endfunction()
+
+# Try to remove directories for autoupdate:
+# * ${HUNTER_ROOT}/Base
+# * ${HUNTER_ROOT}/Source
+function(hunter_gate_remove_old_version)
+  if(NOT HUNTER_ROOT)
+    message(FATAL_ERROR "Internal error")
+  endif()

   if(NOT EXISTS "${HUNTER_ROOT}/installed.by.gate")
     message(
         FATAL_ERROR
         "Please update version manually or remove directory `${HUNTER_ROOT}`."
+        " Version read from file `${HUNTER_ROOT}/Source/cmake/version.cmake`."
+        " (${HUNTER_ROOT_INFO})"
     )
   endif()

@@ -247,6 +240,7 @@
     message(
         FATAL_ERROR
         "Internal error: `installed.by.gate` and `.git`"
+        " (${HUNTER_ROOT_INFO})"
     )
   endif()
   # File `${HUNTER_ROOT}/installed.by.gate` exists, hence current version
@@ -309,38 +303,89 @@
         "${HUNTER_ROOT}/Source"
     )
   endif()
-
-  # Download new version
+endfunction()
+
+# 02.
+hunter_gate_detect_root() # set HUNTER_ROOT and HUNTER_ROOT_INFO
+
+# 03.
+if(NOT HUNTER_ROOT)
+  message(
+      FATAL_ERROR
+      "Internal error in 'hunter_gate_detect_root': HUNTER_ROOT is not set"
+  )
+endif()
+
+# Beautify path, fix probable problems with windows path slashes
+get_filename_component(HUNTER_ROOT "${HUNTER_ROOT}" ABSOLUTE)
+
+if(NOT EXISTS "${HUNTER_ROOT}")
+  # 04.
   hunter_gate_do_download()
-
-  # Sanity check: master file exists
-  if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/Hunter")
-    message(FATAL_ERROR "Broken download: master file not found")
-  endif()
-
-  # Sanity check: version is not less than minimum
-  if(NOT EXISTS "${HUNTER_ROOT}/Source/cmake/version.cmake")
-    message(FATAL_ERROR "Broken download: version.cmake not found")
-  endif()
-
-  unset(HUNTER_VERSION)
-  include("${HUNTER_ROOT}/Source/cmake/version.cmake")
-  if(NOT HUNTER_VERSION)
-    message(
-        FATAL_ERROR
-        "Internal error: HUNTER_VERSION is not set in `version.cmake`"
-    )
-  endif()
+  if(NOT EXISTS "${HUNTER_ROOT}")
+    message(
+        FATAL_ERROR
+        "Internal error in 'hunter_gate_do_download': "
+        "directory HUNTER_ROOT not found"
+    )
+  endif()
+endif()
+
+# 05.
+
+# at this point: HUNTER_ROOT exists (is file or directory)
+if(NOT IS_DIRECTORY "${HUNTER_ROOT}")
+  message(
+      FATAL_ERROR
+      "HUNTER_ROOT is not directory (${HUNTER_ROOT})"
+      "(${HUNTER_ROOT_INFO})"
+  )
+endif()
+
+# at this point: HUNTER_ROOT exists and is directory
+file(GLOB _hunter_result "${HUNTER_ROOT}/*")
+list(LENGTH _hunter_result _hunter_result_len)
+if(_hunter_result_len EQUAL 0)
+  # 06.
+  # HUNTER_ROOT directory is empty, let's download it
+  hunter_gate_do_download()
+endif()
+
+unset(_hunter_result)
+unset(_hunter_result_len)
+
+# 07.
+hunter_gate_detect_version()
+
+if(HUNTER_VERSION VERSION_LESS HUNTER_MINIMUM_VERSION)
+  message(
+      "Current version is ${HUNTER_VERSION}. "
+      "Minimum version is ${HUNTER_MINIMUM_VERSION}. "
+      "Try autoupdate..."
+  )
+
+  # 08.
+  hunter_gate_remove_old_version()
+
+  # 09.
+  hunter_gate_do_download()
+
+  # 10.
+  hunter_gate_detect_version()

   if(HUNTER_VERSION VERSION_LESS HUNTER_MINIMUM_VERSION)
     message(FATAL_ERROR "Broken download: version is less than minimum")
   endif()
 endif()

+# 11.
 # HUNTER_ROOT found or downloaded if not exists, i.e. can be used now
 include("${HUNTER_ROOT}/Source/cmake/Hunter")

 include(hunter_status_debug)
-hunter_status_debug("${HUNTER_ROOT_INFO}")
+hunter_status_debug(
+    "${HUNTER_ROOT_INFO}"
+    "(ver.: ${HUNTER_VERSION} minimum: ${HUNTER_MINIMUM_VERSION})"
+)

 include(hunter_add_package)


Avoid using list(JOIN) in order to support older CMake

--- cmake/Sanitizers.cmake
+++ cmake/Sanitizers.cmake
@@ -24,7 +24,7 @@
     list(APPEND SIMDEE_SANITIZERS "thread")
   endif()

-  list(JOIN SIMDEE_SANITIZERS "," SIMDEE_SANITIZER_LIST)
+  string(REPLACE ";" "," SIMDEE_SANITIZER_LIST "${SIMDEE_SANITIZERS}")

 endif()


Fix CMake warning about doc target, only use `doxygen' target

Also, to avoid conflicts with the doc directory, the default output dir has been
changed to doxygen.

--- cmake/UseDoxygen.cmake
+++ cmake/UseDoxygen.cmake
@@ -32,7 +32,7 @@
 #  	 "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/"
 #
 #  DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored.
-#  	Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc".
+#  	Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doxygen".
 #
 #  DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation
 #  	to be built.
@@ -70,7 +70,7 @@
 endif()

 if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
-	usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc"
+	usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen"
 		PATH "Doxygen output directory")
 	usedoxygen_set_default(DOXYFILE_HTML_DIR "html"
 		STRING "Doxygen HTML output directory")
@@ -134,11 +134,4 @@

 	configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
-
-	get_target_property(DOC_TARGET doc TYPE)
-	if(NOT DOC_TARGET)
-		add_custom_target(doc)
-	endif()
-
-	add_dependencies(doc doxygen)
 endif()


Drop qt devices if ENABLE_qt (which activates the build of the plplotqtd
library which the qt devices depend on) is false.

svn path=/trunk/; revision=12630

--- cmake/modules/qt.cmake
+++ cmake/modules/qt.cmake
@@ -102,6 +102,36 @@
   endif(QT4_FOUND)
 endif(ANY_QT_DEVICE)

+if(DEFAULT_NO_BINDINGS)
+  option(ENABLE_qt "Enable Qt bindings" OFF)
+  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" OFF)
+else(DEFAULT_NO_BINDINGS)
+  option(ENABLE_qt "Enable Qt bindings" ON)
+  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" ON)
+endif(DEFAULT_NO_BINDINGS)
+
+# ENABLE_qt depends on PLD_extqt
+if(NOT ANY_QT_DEVICE)
+    set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE)
+endif(NOT ANY_QT_DEVICE)
+
+if(ENABLE_qt AND NOT PLD_extqt)
+  message(STATUS
+    "WARNING: PLD_extqt is OFF so "
+    "setting ENABLE_qt to OFF."
+    )
+  set(ENABLE_qt OFF CACHE BOOL "Enable Qt bindings" FORCE)
+endif(ENABLE_qt AND NOT PLD_extqt)
+
+# All qt devices depend on ENABLE_qt
+if(NOT ENABLE_qt)
+  message(STATUS
+    "WARNING: ENABLE_qt is OFF so "
+    "setting all qt devices to OFF."
+    )
+  set(ANY_QT_DEVICE OFF)
+endif(ENABLE_qt AND NOT PLD_extqt)
+
 if(NOT ANY_QT_DEVICE)
     set(PLD_bmpqt OFF CACHE BOOL "Enable Qt Windows bmp device" FORCE)
     set(PLD_jpgqt OFF CACHE BOOL "Enable Qt jpg device" FORCE)
@@ -115,22 +145,6 @@
     set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE)
     set(PLD_memqt OFF CACHE BOOL "Enable Qt mem device" FORCE)
 endif(NOT ANY_QT_DEVICE)
-
-if(DEFAULT_NO_BINDINGS)
-  option(ENABLE_qt "Enable Qt bindings" OFF)
-  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" OFF)
-else(DEFAULT_NO_BINDINGS)
-  option(ENABLE_qt "Enable Qt bindings" ON)
-  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" ON)
-endif(DEFAULT_NO_BINDINGS)
-
-if(ENABLE_qt AND NOT PLD_extqt)
-  message(STATUS
-    "WARNING: PLD_extqt is OFF so "
-    "setting ENABLE_qt to OFF."
-    )
-  set(ENABLE_qt OFF CACHE BOOL "Enable Qt bindings" FORCE)
-endif(ENABLE_qt AND NOT PLD_extqt)

 if(ENABLE_pyqt4 AND NOT ENABLE_python)
   message(STATUS


enabling assertions again in RelWithDebInfo mode

--- common/cmake/icc.cmake
+++ common/cmake/icc.cmake
@@ -28,7 +28,7 @@
 SET(CMAKE_CXX_FLAGS "-Wall -fPIC -std=c++11 -no-ansi-alias -static-intel -fasm-blocks")
 SET(CMAKE_CXX_FLAGS_DEBUG          "-DDEBUG  -g -O0")
 SET(CMAKE_CXX_FLAGS_RELEASE        "-DNDEBUG    -O3 -restrict")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG  -g -O3 -restrict")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DDEBUG  -g -O3 -restrict")
 SET(CMAKE_EXE_LINKER_FLAGS "")

 IF (NOT RTCORE_EXPORT_ALL_SYMBOLS)


pw_protobuf_compiler: Add pw_build to cmake deps

We need an interface dependency on pw_build to inherit its build
options. This is breaking linking in some Matter builds that pass the
arch flags by injecting dependencies into pw_build.

No-Docs-Update-Reason: bug fix

Change-Id: If1c2062502839e0470981b60bad1010321e03ff5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66760
Reviewed-by: Rob Oliver <a5e5d1b61ce0a2226e72fcc143bfa649e214acf1@google.com>
Reviewed-by: Armando Montanez <97ef6fdb231c129ac8827d9f0c4106bfbf57f74f@google.com>
Commit-Queue: Michael Spang <e1fb1a05abba8fb04acbcbe6d766da7764320db0@google.com>

--- pw_protobuf_compiler/proto.cmake
+++ pw_protobuf_compiler/proto.cmake
@@ -187,7 +187,7 @@
   # Create the library with the generated source files.
   add_library("${NAME}.pwpb" INTERFACE)
   target_include_directories("${NAME}.pwpb" INTERFACE "${OUT_DIR}/pwpb")
-  target_link_libraries("${NAME}.pwpb" INTERFACE pw_protobuf ${DEPS})
+  target_link_libraries("${NAME}.pwpb" INTERFACE pw_build pw_protobuf ${DEPS})
   add_dependencies("${NAME}.pwpb" "${NAME}._generate.pwpb")
 endfunction(_pw_pwpb_library)

@@ -211,6 +211,7 @@
   target_include_directories("${NAME}.raw_rpc" INTERFACE "${OUT_DIR}/raw_rpc")
   target_link_libraries("${NAME}.raw_rpc"
     INTERFACE
+      pw_build
       pw_rpc.raw
       pw_rpc.server
       ${DEPS}
@@ -244,6 +245,7 @@
       add_library("${NAME}.nanopb" INTERFACE)
       target_link_libraries("${NAME}.nanopb"
         INTERFACE
+          pw_build
           pw_third_party.nanopb
           ${DEPS}
       )
@@ -262,7 +264,7 @@
       # Create the library with the generated source files.
       add_library("${NAME}.nanopb" EXCLUDE_FROM_ALL ${generated_outputs})
       target_include_directories("${NAME}.nanopb" PUBLIC "${OUT_DIR}/nanopb")
-      target_link_libraries("${NAME}.nanopb" PUBLIC pw_third_party.nanopb ${DEPS})
+      target_link_libraries("${NAME}.nanopb" PUBLIC pw_build pw_third_party.nanopb ${DEPS})
     endif()

     add_dependencies("${NAME}.nanopb" "${NAME}._generate.nanopb")
@@ -299,6 +301,7 @@
   target_link_libraries("${NAME}.nanopb_rpc"
     INTERFACE
       "${NAME}.nanopb"
+      pw_build
       pw_rpc.nanopb.client
       pw_rpc.nanopb.method_union
       pw_rpc.server


[build system]: add ruby check before mocking

--- tools/cmake/component.cmake
+++ tools/cmake/component.cmake
@@ -556,13 +556,25 @@
                         INCLUDE_DIRS ${__INCLUDE_DIRS}
                         REQUIRES ${__REQUIRES})

-    execute_process(COMMAND ${CMAKE_COMMAND} -E env "UNITY_DIR=${IDF_PATH}/components/unity/unity"
+    add_custom_command(
+        OUTPUT ruby_found SYMBOLIC
+        COMMAND "ruby" "-v"
+        COMMENT "Try to find ruby. If this fails, you need to install ruby"
+    )
+
+    # This command builds the mocks.
+    # First, environment variable UNITY_DIR is set. This is necessary to prevent unity from looking in its own submodule
+    # which doesn't work in our CI yet...
+    # The rest is a straight forward call to cmock.rb, consult cmock's documentation for more information.
+    add_custom_command(
+        OUTPUT ${MOCK_GENERATED_SRCS} ${MOCK_GENERATED_HEADERS}
+        DEPENDS ruby_found
+        COMMAND ${CMAKE_COMMAND} -E env "UNITY_DIR=${IDF_PATH}/components/unity/unity"
             ruby
             ${CMOCK_DIR}/lib/cmock.rb
             -o${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_config.yaml
             ${__MOCK_HEADER_FILES}
-            WORKING_DIRECTORY ${MOCK_GEN_DIR}
-            RESULT_VARIABLE cmock_result)
+      )
 endfunction()

 #


For downstream - fix macro redefinition warning on VS static build. [ci only: AppVeyor]

--- CMake/Modules/Urho3D-CMake-common.cmake
+++ CMake/Modules/Urho3D-CMake-common.cmake
@@ -397,7 +397,9 @@
 endif ()
 if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
     set (URHO3D_LIB_TYPE STATIC)
-    add_definitions (-DURHO3D_STATIC_DEFINE)
+    if (NOT MSVC)   # This define will be baked into the export header for MSVC compiler
+        add_definitions (-DURHO3D_STATIC_DEFINE)
+    endif ()
 endif ()

 # Add definition for AngelScript


Improve ctkMacroCompilePythonScript

Improve ctkMacroCompilePythonScript

The macro now add the "py" extension if needed

It's also now possible to pass absolute path in the list of scripts

--- CMake/ctkMacroCompilePythonScript.cmake
+++ CMake/ctkMacroCompilePythonScript.cmake
@@ -28,8 +28,20 @@
   set(copied_files)
   set(copied_python_files)
   FOREACH(file ${MY_SCRIPTS})
-    SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}.py")
-    SET(tgt "${MY_DESTINATION_DIR}/${file}.py")
+    # Append "py" extension if needed
+    get_filename_component(file_ext ${file} EXT)
+    IF(NOT "${file_ext}" MATCHES "py")
+      SET(file "${file}.py")
+    ENDIF()
+
+    SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+    SET(tgt "${MY_DESTINATION_DIR}/${file}")
+    IF(IS_ABSOLUTE ${file})
+      SET(src ${file})
+      file(RELATIVE_PATH tgt_file ${CMAKE_CURRENT_BINARY_DIR} ${file})
+      SET(tgt "${MY_DESTINATION_DIR}/${tgt_file}")
+    ENDIF()
+
     SET(copied_python_files ${copied_python_files} ${tgt})
     SET(copied_files ${copied_files} ${tgt})
     ADD_CUSTOM_COMMAND(DEPENDS ${src}


Update android toolchain with r10d support

--- CMake/toolchain/android.toolchain.cmake
+++ CMake/toolchain/android.toolchain.cmake
@@ -85,9 +85,15 @@
 #        "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
 #            sets VFPV3 as floating-point unit (has 32 registers instead of 16).
 #        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
+#        "arm64-v8a" - matches to the NDK ABI with the same name.
+#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
 #        "x86" - matches to the NDK ABI with the same name.
 #            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "x86_64" - matches to the NDK ABI with the same name.
+#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
 #        "mips" - matches to the NDK ABI with the same name.
+#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "mips64" - matches to the NDK ABI with the same name.
 #            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
@@ -181,13 +187,13 @@
 #    ANDROID and BUILD_ANDROID will be set to true, you may test any of these
 #    variables to make necessary Android-specific configuration changes.
 #
-#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually
+#    Also ARMEABI or ARMEABI_V7A or ARM64_V8A or X86 or X86_64 or MIPS or MIPS64 will be set true, mutually
 #    exclusive. NEON option will be set true if VFP is set to NEON.
 #
 #    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
 #    libraries will be installed.
 #    Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
-#    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
+#    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}
 #    (depending on the target ABI). This is convenient for Android packaging.
 #
 #  Change Log:
@@ -303,6 +309,9 @@
 #     [~] fix copying of shared STL
 #   - April 2014
 #     [+] updated for NDK r9d
+#   - July 2014
+#     [+] updated for NDK r10c
+#     [+] arm64_v8a, x86_64, mips64 toolchain support (experimental)
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )
@@ -329,7 +338,7 @@
 # rpath makes low sence for Android
 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )

-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10c -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
 if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -344,13 +353,18 @@
 endif()

 set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
+set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
 set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
+set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
 set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
+set( ANDROID_SUPPORTED_ABIS_mips64el "mips64" )

 set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
-
+set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 "L" )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 "L" )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 "L" )

 macro( __LIST_FILTER listvar regex )
  if( ${listvar} )
@@ -653,10 +667,16 @@
    string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
    if( __machine MATCHES i686 )
     set( __arch "x86" )
+   elseif( __machine MATCHES x86_64 )
+    set( __arch "x86_64" )
    elseif( __machine MATCHES arm )
     set( __arch "arm" )
+   elseif( __machine MATCHES aarch64 )
+    set( __arch "arm64" )
    elseif( __machine MATCHES mipsel )
     set( __arch "mipsel" )
+   elseif( __machine MATCHES mips64el )
+    set( __arch "mips64el" )
    endif()
    list( APPEND __availableToolchainMachines "${__machine}" )
    list( APPEND __availableToolchainArchs "${__arch}" )
@@ -740,6 +760,13 @@
  set( ANDROID_ARCH_FULLNAME "x86" )
  set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
+elseif( ANDROID_ABI STREQUAL "x86_64" )
+ set( X86_64 true )
+ set( ANDROID_NDK_ABI_NAME "x86_64" )
+ set( ANDROID_ARCH_NAME "x86_64" )
+ set( ANDROID_ARCH_FULLNAME "x86_64" )
+ set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
 elseif( ANDROID_ABI STREQUAL "mips" )
  set( MIPS true )
  set( ANDROID_NDK_ABI_NAME "mips" )
@@ -747,6 +774,13 @@
  set( ANDROID_ARCH_FULLNAME "mipsel" )
  set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "mips" )
+elseif( ANDROID_ABI STREQUAL "mips64" )
+ set( MIPS64 true )
+ set( ANDROID_NDK_ABI_NAME "mips64" )
+ set( ANDROID_ARCH_NAME "mips64" )
+ set( ANDROID_ARCH_FULLNAME "mips64el" )
+ set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "mips64" )
 elseif( ANDROID_ABI STREQUAL "armeabi" )
  set( ARMEABI true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
@@ -787,8 +821,23 @@
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
  set( NEON true )
+elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
+ set( ARM64_V8A true )
+ set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
+ set( ANDROID_ARCH_NAME "arm64" )
+ set( ANDROID_ARCH_FULLNAME "arm64" )
+ set( ANDROID_LLVM_TRIPLE "armv8-none-linux-androideabi" )
+ set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
+ set( VFPV3 true )
+ set( NEON true )
 else()
  message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." )
+endif()
+
+if( X86_64 )
+ set( ANDROID_NDK_OUTPUT_ABI_NAME "x86-64" )
+else()
+ set( ANDROID_NDK_OUTPUT_ABI_NAME ${ANDROID_NDK_ABI_NAME} )
 endif()

 if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
@@ -854,40 +903,40 @@
 unset( __availableToolchainArchs )
 unset( __availableToolchainCompilerVersions )

-# choose native API level
-__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
-string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
-# adjust API level
-set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
-foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
+if( NOT ANDROID_NATIVE_API_LEVEL STREQUAL "L" )
+ string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+ # adjust API level
+ set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
+ foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
  if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
-  set( __real_api_level ${__level} )
- endif()
-endforeach()
-if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
+ set( __real_api_level ${__level} )
+ endif()
+ endforeach()
+ if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
  message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
  set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
-endif()
-unset(__real_api_level)
-# validate
-list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
-if( __levelIdx EQUAL -1 )
+ endif()
+ unset(__real_api_level)
+ # validate
+ list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
+ if( __levelIdx EQUAL -1 )
  message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." )
-else()
+ else()
  if( BUILD_WITH_ANDROID_NDK )
-  __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
-  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
-   message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
-  endif()
-  unset( __realApiLevel )
+ __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
+ if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
+ message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
+ endif()
+ unset( __realApiLevel )
  endif()
  set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
  if( CMAKE_VERSION VERSION_GREATER "2.8" )
-  list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
-  set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- endif()
-endif()
+ list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
+ set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
+ endif()
+  endif()
 unset( __levelIdx )
+endif()

 # remember target ABI
@@ -1208,7 +1257,13 @@
  set( CMAKE_C_COMPILER_ID Clang)
 endif()
 set( CMAKE_C_PLATFORM_ID Linux )
-set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+
+if( ARM64_V8A OR X86_64 OR MIPS64 )
+ set( CMAKE_C_SIZEOF_DATA_PTR 8 )
+else()
+ set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+endif()
+
 set( CMAKE_C_HAS_ISYSROOT 1 )
 set( CMAKE_C_COMPILER_ABI ELF )
 CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@@ -1216,7 +1271,13 @@
  set( CMAKE_CXX_COMPILER_ID Clang)
 endif()
 set( CMAKE_CXX_PLATFORM_ID Linux )
-set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
+
+if( ARM64_V8A OR X86_64 OR MIPS64 )
+ set( CMAKE_C_SIZEOF_DATA_PTR 8 )
+else()
+ set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+endif()
+
 set( CMAKE_CXX_HAS_ISYSROOT 1 )
 set( CMAKE_CXX_COMPILER_ABI ELF )
 set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@@ -1273,7 +1334,7 @@
    set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
   endif()
  endif()
-elseif( X86 )
+elseif( X86 OR X86_64 )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
@@ -1282,7 +1343,7 @@
  endif()
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
-elseif( MIPS )
+elseif( MIPS OR MIPS64)
  set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
@@ -1319,6 +1380,8 @@
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2
 elseif( ARMEABI )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
+elseif( ARM64_V8A )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv8-a" )
 endif()

 if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") )
@@ -1552,11 +1615,11 @@

 if(NOT _CMAKE_IN_TRY_COMPILE)
  if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
-  set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
+   set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "Output directory for applications" )
  else()
   set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
  endif()
- set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
+  set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "path for android libs" )
 endif()

 # copy shaed stl library to build directory
@@ -1633,10 +1696,16 @@
   set( ${VAR} "armeabi" )
  elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
   set( ${VAR} "armeabi-v7a" )
+ elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARM64_V8A" )
+  set( ${VAR} "arm64-v8a" )
  elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
   set( ${VAR} "x86" )
+ elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86_64" )
+  set( ${VAR} "x86_64" )
  elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
   set( ${VAR} "mips" )
+ elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS64" )
+  set( ${VAR} "mips64" )
  else()
   set( ${VAR} "unknown" )
  endif()
@@ -1703,7 +1772,7 @@

 # Variables controlling behavior or set by cmake toolchain:
-#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
+#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "arm64-v8a", "x86", "x86_64", "mips", "mips64"
 #   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
 #   ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
 #   ANDROID_FORBID_SYGWIN : ON/OFF
@@ -1737,16 +1806,19 @@
 #   ARMEABI : TRUE for arm v6 and older devices
 #   ARMEABI_V6 : TRUE for arm v6
 #   ARMEABI_V7A : TRUE for arm v7a
+#   ARM64_V8A : TRUE for arm64 v8a
 #   NEON : TRUE if NEON unit is enabled
 #   VFPV3 : TRUE if VFP version 3 is enabled
 #   X86 : TRUE if configured for x86
+#   X86_64 : TRUE if configured for x86_64
+#   MIPS64 : TRUE if configured for mips64
 #   MIPS : TRUE if configured for mips
 #   BUILD_ANDROID : always TRUE
 #   BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
 #   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
 #   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
 #   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d; set only for NDK
+#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d, r10d; set only for NDK
 #   ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform


cmake: avoid incorrectly setting KRB5_INCLUDE_DIRS to "/include"

Summary:
Do not add "${KRB5_PREFIX}/include" to KRB5_INCLUDE_DIRS when
KRB5_PREFIX is unset.  Otherwise this causes problems for the generated
package config file since they reference include directories that do not
actually exist.

Reviewed By: wez

Differential Revision: D7479063

fbshipit-source-id: 706bf9ef1e1a7d145e0690c00e6fad3bca188cb6

--- thrift/cmake/FindKrb5.cmake
+++ thrift/cmake/FindKrb5.cmake
@@ -74,7 +74,9 @@
   ENDIF("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$")
 ENDIF(KRB5_FOUND)

-SET(KRB5_INCLUDE_DIRS "${KRB5_PREFIX}/include" ${KRB5_INCLUDE_DIRS})
+IF(KRB5_PREFIX)
+  SET(KRB5_INCLUDE_DIRS "${KRB5_PREFIX}/include" ${KRB5_INCLUDE_DIRS})
+ENDIF(KRB5_PREFIX)

 # Lookup the libraries needed for the components requested.
 IF(KRB5_FOUND)


CLANG: Improve compiler flags

CLANG: Improve compiler flags

--- cmake/toolchains/Toolchain-posix-clang-native.cmake
+++ cmake/toolchains/Toolchain-posix-clang-native.cmake
@@ -9,7 +9,6 @@
     -Wpointer-arith
     -Wlogical-op
     -Wmissing-declarations
-    -Wpacked
     -Wno-unused-parameter
     -Werror=format-security
     -Werror=array-bounds
@@ -19,8 +18,11 @@
     -Werror=unused-variable
     -Werror=double-promotion
     -Werror=reorder
-	-Werror=uninitialized
-	-Werror=init-self
+    -Werror=uninitialized
+    -Werror=init-self
+    -Werror=return-type
+    -Wno-packed
+    -Wno-frame-larger-than=
     #-Wcast-qual  - generates spurious noreturn attribute warnings,
     #               try again later
     #-Wconversion - would be nice, but too many "risky-but-safe"


[fixed] some version stuff and [added] botgTestDir

--- cmake/BOTG.cmake
+++ cmake/BOTG.cmake
@@ -146,8 +146,6 @@
                 ELSE()
                     MESSAGE(STATUS "[BootsOnTheGround] package=${PACKAGE_NAME} could not add invalid flag='${flag}'!")
                 ENDIF()
-            ELSE()
-                MESSAGE(WARNING "[BootsOnTheGround] package=${PACKAGE_NAME} re-added flag='${flag}'!")
             ENDIF()
         ENDFOREACH()
     ENDIF()
@@ -173,8 +171,7 @@
     SET( sources )
     FOREACH( source ${library_SOURCES} )
         STRING( REGEX REPLACE ".in$" "" replaced "${source}" )
-        MESSAGE( STATUS "s[] ${replaced}" )
-        IF( NOT "${replaced}" STREQUAL "" )
+        IF( NOT "${source}" STREQUAL "${replaced}" )
             CONFIGURE_FILE( "${source}" "${CMAKE_CURRENT_BINARY_DIR}/${replaced}" )
             SET( source "${CMAKE_CURRENT_BINARY_DIR}/${replaced}" )
         ENDIF()
@@ -185,8 +182,7 @@
     SET( headers )
     FOREACH( header ${library_HEADERS} )
         STRING( REGEX REPLACE ".in$" "" replaced "${header}" )
-        MESSAGE( STATUS "h[] ${replaced}" )
-        IF( NOT "${replaced}" STREQUAL "" )
+        IF( NOT "${header}" STREQUAL "${replaced}" )
             CONFIGURE_FILE( "${header}" "${CMAKE_CURRENT_BINARY_DIR}/${replaced}" )
             SET( header "${CMAKE_CURRENT_BINARY_DIR}/${replaced}" )
         ENDIF()
@@ -196,9 +192,6 @@
     ENDFOREACH()

     #call TriBITS to add a library
-    MESSAGE( STATUS "[] ${name}")
-    MESSAGE( STATUS "[] ${headers}" )
-    MESSAGE( STATUS "[] ${sources}" )
     TRIBITS_ADD_LIBRARY( ${name}
         SOURCES
             "${sources}"
@@ -212,10 +205,9 @@
     ENDFOREACH()

     #set include directories
-    TARGET_INCLUDE_DIRECTORIES( ${name} PUBLIC
-        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>  #For C++
-        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>  #For fortran modules/configured files
-        $<INSTALL_INTERFACE:include>
+    INCLUDE_DIRECTORIES(
+        ${CMAKE_CURRENT_SOURCE_DIR}  #For C++
+        ${CMAKE_CURRENT_BINARY_DIR}  #For fortran modules/configured files
     )

 ENDMACRO()
@@ -262,6 +254,13 @@
 ENDFUNCTION()
 #-------------------------------------------------------------------------------
 # PUBLIC
+# Add test directory
+#
+MACRO( botgTestDir )
+    TRIBITS_ADD_TEST_DIRECTORIES( ${ARGN} )
+ENDMACRO()
+#-------------------------------------------------------------------------------
+# PUBLIC
 # Resolve version number.
 #
 MACRO( botgResolveVersion )
@@ -298,15 +297,21 @@

     # Load some fundamental identification data.
     INCLUDE( "${CMAKE_SOURCE_DIR}/ProjectName.cmake" )
+    IF( NOT DEFINED PROJECT_NAME )
+        SET(PROJECT_NAME "MY_PROJECT")
+    ENDIF()
     INCLUDE( "${CMAKE_SOURCE_DIR}/Version.cmake" )
+    IF( NOT DEFINED PROJECT_VERSION )
+        SET(PROJECT_VERSION "0.0.0")
+    ENDIF()
     PROJECT( "${PROJECT_NAME}"
         VERSION "${PROJECT_VERSION}"
         LANGUAGES C Fortran CXX
     )

     # Set variable version strings for TriBITS.
-    STRING(REPLACE "." ";" vlist ${PROJECT_VERSION})
-    LIST(GET vlist 0 ${PROJECT_NAME}_MAJOR_VERSION )
+    STRING(REPLACE "." ";" vlist "${PROJECT_VERSION}")
+    LIST(GET vlist 0 "${PROJECT_NAME}_MAJOR_VERSION" )

     # Turn off MPI by default.
     SET(TPL_ENABLE_MPI OFF CACHE BOOL "Turn off MPI by default.")
@@ -382,11 +387,6 @@

         # Miscellaneous wrap-up.
         botgProcessTPLS()
-
-        # Add standard test directory.
-        IF( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test" )
-            TRIBITS_ADD_TEST_DIRECTORIES(test)
-        ENDIF()

         #Inside a subpackage
         IF( ${is_superpackage} )