Don't clobber LD_LIBRARY_PATH for autotools projects

Prepend the global install dir to LD_LIBRARY_PATH, rather than
just overwriting an existing value. Without this patch, a toolchain
relying on LD_LIBRARY_PATH to find the C library will fail.

--- cmake/modules/hunter_autotools_project.cmake
+++ cmake/modules/hunter_autotools_project.cmake
@@ -111,7 +111,7 @@
   set(default_path "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin")
   set(shell_env_path "PATH=${PARAM_GLOBAL_INSTALL_DIR}/bin:${default_path}")

-  set(shell_ld_path "LD_LIBRARY_PATH=${PARAM_GLOBAL_INSTALL_DIR}/lib")
+  set(shell_ld_path "LD_LIBRARY_PATH=${PARAM_GLOBAL_INSTALL_DIR}/lib:$ENV{LD_LIBRARY_PATH}")

   set(d1 "${PARAM_GLOBAL_INSTALL_DIR}/lib/pkgconfig")
   set(d2 "${PARAM_GLOBAL_INSTALL_DIR}/share/pkgconfig")


Add HUNTER_PACKAGE_BUILD

Add HUNTER_PACKAGE_BUILD

--- cmake/modules/hunter_create_cache_file.cmake
+++ cmake/modules/hunter_create_cache_file.cmake
@@ -208,6 +208,13 @@
   )
   # }

+  # Package can use this variable to check if it's building by Hunter
+  file(
+      APPEND
+      "${temp_path}"
+      "set(HUNTER_PACKAGE_BUILD ON CACHE INTERNAL \"\")\n"
+  )
+
   # Atomic operation
   file(RENAME "${temp_path}" "${cache_path}")
 endfunction()


Bug 536 - Freetype 2.4.10

Bug 536 - Freetype 2.4.10

--HG--
branch : v1-8

--- CMake/Packages/FindFreetype.cmake
+++ CMake/Packages/FindFreetype.cmake
@@ -31,7 +31,7 @@
   FREETYPE_INCLUDE_DIR
 )

-set(FREETYPE_LIBRARY_NAMES freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
+set(FREETYPE_LIBRARY_NAMES freetype2410 freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
 get_debug_names(FREETYPE_LIBRARY_NAMES)

 use_pkgconfig(FREETYPE_PKGC freetype2)


Fixed ctkMacroBuildQtPlugin to build shared libraries

--- CMake/ctkMacroBuildQtPlugin.cmake
+++ CMake/ctkMacroBuildQtPlugin.cmake
@@ -17,7 +17,7 @@
     MESSAGE(SEND_ERROR "EXPORT_DIRECTIVE is mandatory")
   ENDIF(NOT DEFINED MYQTPLUGIN_EXPORT_DIRECTIVE)
   IF(NOT DEFINED MYQTPLUGIN_LIBRARY_TYPE)
-    SET(MYQTLIB_LIBRARY_TYPE "SHARED")
+    SET(MYQTPLUGIN_LIBRARY_TYPE "SHARED")
   ENDIF(NOT DEFINED MYQTPLUGIN_LIBRARY_TYPE)

   # Define library name
@@ -64,7 +64,7 @@
     ${MYQTPLUGIN_UI_CXX}
     )

-  ADD_LIBRARY(${lib_name} ${OV_LIBRARY_TYPE}
+  ADD_LIBRARY(${lib_name} ${MYQTPLUGIN_LIBRARY_TYPE}
     ${MYQTPLUGIN_SRCS}
     ${MYQTPLUGIN_UI_CXX}
     ${MYQTPLUGIN_QRC_SRCS}


Do not add the EP_MITK target to modules anymore.

--- CMake/mitkMacroCreateModule.cmake
+++ CMake/mitkMacroCreateModule.cmake
@@ -165,9 +165,9 @@

         ENDIF(NOT MODULE_QT_MODULE)

-        IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK)
-          ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK)
-        ENDIF()
+        #IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK)
+        #  ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK)
+        #ENDIF()

         # install only if shared lib (for now)
         IF(NOT _STATIC OR MINGW)


COMP: deactivated test, because it isn't running on linux/mac

--- Modules/IGT/Testing/files.cmake
+++ Modules/IGT/Testing/files.cmake
@@ -11,6 +11,7 @@
    mitkNavigationDataRecorderTest.cpp
    mitkNavigationDataReferenceTransformFilterTest.cpp
    mitkNavigationDataSequentialPlayerTest.cpp
+   mitkNavigationDataSourceTest.cpp
    mitkNavigationDataToMessageFilterTest.cpp
    mitkNavigationDataToNavigationDataFilterTest.cpp
    mitkNavigationDataToPointSetFilterTest.cpp
@@ -22,9 +23,8 @@
    mitkTrackingVolumeGeneratorTest.cpp
    mitkTrackingDeviceTest.cpp
    mitkTrackingToolTest.cpp
-# This test fails randomly, see bug #8033
    mitkVirtualTrackingDeviceTest.cpp
-   mitkNavigationDataPlayerTest.cpp
+   # mitkNavigationDataPlayerTest.cpp # deactivated see bug 11636
    mitkTrackingDeviceSourceTest.cpp
    mitkTrackingDeviceSourceConfiguratorTest.cpp
    mitkNavigationDataEvaluationFilterTest.cpp
@@ -32,7 +32,7 @@

    # ------------------ Navigation Tool Management Tests -------------------
    mitkNavigationToolStorageTest.cpp
-   mitkNavigationToolStorageSerializerAndDeserializerTest.cpp #deactivated, see bug #10701
+   mitkNavigationToolStorageSerializerAndDeserializerTest.cpp
    mitkNavigationToolTest.cpp
    mitkNavigationToolReaderAndWriterTest.cpp
    # -----------------------------------------------------------------------


COMP: Disable -Warray-bounds for GCC 4.7, 4.8.

-Warray-bounds causes a number of false positives with -O3 that are cluttering up the
dashboard.

Change-Id: Ibaa23046c60ad5ffc2945b869005072292338d00

--- CMake/ITKSetStandardCompilerFlags.cmake
+++ CMake/ITKSetStandardCompilerFlags.cmake
@@ -190,6 +190,11 @@
   #-----------------------------------------------------------------------------
   #ITK requires special compiler flags on some platforms.
   if(CMAKE_COMPILER_IS_GNUCXX)
+    # GCC's -Warray-bounds has been shown to throw false positives with -O3 on 4.7 and 4.8.
+    if(UNIX AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.6" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9")
+      set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -Wno-array-bounds")
+    endif()
+
    if(APPLE)
      option(ITK_USE_64BITS_APPLE_TRUNCATION_WARNING "Turn on warnings on 64bits to 32bits truncations." OFF)
      mark_as_advanced(ITK_USE_64BITS_APPLE_TRUNCATION_WARNING)
@@ -211,7 +216,6 @@
          message("-fopenmp causes incorrect compliation of HDF, removing from ${listname}")
        endif()
      endforeach()
-
    endif()

    # gcc must have -msse2 option to enable sse2 support


iox-#482 add cmake output for deployment options

Signed-off-by: Dietrich Krönke <ea45bc0219d3b6c3a6b9cf3abdfa172e6bfa16ff@apex.ai>

--- iceoryx_posh/cmake/iceoryx_posh_deployment.cmake
+++ iceoryx_posh/cmake/iceoryx_posh_deployment.cmake
@@ -15,42 +15,52 @@
 # SPDX-License-Identifier: Apache-2.0

 # configure deployment
+message("[i] <<<<<<<<<<<<< Start iceoryx_posh configuration: >>>>>>>>>>>>>")
 if(ONE_TO_MANY_ONLY)
      message("[i] Using 1:n communication only!")
      set(IOX_COMMUNICATION_POLICY OneToManyPolicy)
 endif()

 if(NOT IOX_COMMUNICATION_POLICY)
+    message("[i] Using m:n communication only!")
     set(IOX_COMMUNICATION_POLICY ManyToManyPolicy)
 endif()

 if(NOT IOX_MAX_PUBLISHERS)
     set(IOX_MAX_PUBLISHERS 512)
 endif()
+message("[i] IOX_MAX_PUBLISHERS:" ${IOX_MAX_PUBLISHERS})

 if(NOT IOX_MAX_SUBSCRIBERS)
     set(IOX_MAX_SUBSCRIBERS 1024)
 endif()
+message("[i] IOX_MAX_SUBSCRIBERS:" ${IOX_MAX_SUBSCRIBERS})

 if(NOT IOX_MAX_INTERFACE_NUMBER)
     set(IOX_MAX_INTERFACE_NUMBER 4)
 endif()
+message("[i] IOX_MAX_INTERFACE_NUMBER:" ${IOX_MAX_INTERFACE_NUMBER})

 if(NOT IOX_MAX_SUBSCRIBERS_PER_PUBLISHER)
     set(IOX_MAX_SUBSCRIBERS_PER_PUBLISHER 256)
 endif()
+message("[i] IOX_MAX_SUBSCRIBERS_PER_PUBLISHER:" ${IOX_MAX_SUBSCRIBERS_PER_PUBLISHER})

 if(NOT IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY)
     set(IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY 8)
 endif()
+message("[i] IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY:" ${IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY})

 if(NOT IOX_MAX_PUBLISHER_HISTORY)
     set(IOX_MAX_PUBLISHER_HISTORY 16)
 endif()
+message("[i] IOX_MAX_PUBLISHER_HISTORY:" ${IOX_MAX_PUBLISHER_HISTORY})

 if(NOT IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY)
     set(IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY 256)
 endif()
+message("[i] IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY:" ${IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY})
+message("[i] <<<<<<<<<<<<<< End iceoryx_posh configuration: >>>>>>>>>>>>>>")

 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/iceoryx_posh_deployment.hpp.in"
   "${CMAKE_BINARY_DIR}/generated/iceoryx/include/iceoryx_posh/iceoryx_posh_deployment.hpp" @ONLY)


Set CMAKE_SYSTEM_NAME to distortos

Set CMAKE_SYSTEM_NAME to distortos

This causes distortos.cmake platform file to be loaded early during
configuration.

--- cmake/Toolchain-arm-none-eabi.cmake
+++ cmake/Toolchain-arm-none-eabi.cmake
@@ -12,7 +12,7 @@
 endif()
 set(CMAKE_TOOLCHAIN_ARM_NONE_EABI_CMAKE_ 1)

-set(CMAKE_SYSTEM_NAME Generic)
+set(CMAKE_SYSTEM_NAME distortos)
 set(CMAKE_SYSTEM_VERSION 1)
 set(CMAKE_SYSTEM_PROCESSOR arm)


Fixed retrieving BUILD_NUMBER from env

Fixed retrieving BUILD_NUMBER from env

--- cmake/modules/TeRaVersionInfo.cmake
+++ cmake/modules/TeRaVersionInfo.cmake
@@ -13,7 +13,7 @@
 else()
 	set( RELEASE_VER 0 )
 endif()
-if( $ENV{BUILD_NUMBER} )
+if( DEFINED ENV{BUILD_NUMBER} )
 	set( BUILD_VER $ENV{BUILD_NUMBER} )
 elseif(PROJECT_VERSION_TWEAK)
 	set( BUILD_VER ${PROJECT_VERSION_TWEAK} )


cmake: toolchain/xtools: update to align with latest sdk-ng

The target.cmake for xtools needs to be updated for changes in
sdk-ng repo. This is simply a copy from the target.cmake for
0.10 SDK.

Signed-off-by: Daniel Leung <d94e04d205b5962d7873a139ef298b03c1717f72@intel.com>

--- cmake/toolchain/xtools/target.cmake
+++ cmake/toolchain/xtools/target.cmake
@@ -2,17 +2,21 @@

 set(CROSS_COMPILE_TARGET_arm         arm-zephyr-eabi)
 set(CROSS_COMPILE_TARGET_nios2     nios2-zephyr-elf)
-set(CROSS_COMPILE_TARGET_riscv   riscv32-zephyr-elf)
+set(CROSS_COMPILE_TARGET_riscv   riscv64-zephyr-elf)
 set(CROSS_COMPILE_TARGET_mips     mipsel-zephyr-elf)
 set(CROSS_COMPILE_TARGET_xtensa   xtensa-zephyr-elf)
 set(CROSS_COMPILE_TARGET_arc         arc-zephyr-elf)
-set(CROSS_COMPILE_TARGET_x86        i586-zephyr-elf)
+
+if(CONFIG_X86_64)
+  set(CROSS_COMPILE_TARGET_x86 x86_64-zephyr-elf)
+else()
+  set(CROSS_COMPILE_TARGET_x86 i586-zephyr-elf)
+endif()

 set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
 set(SYSROOT_TARGET       ${CROSS_COMPILE_TARGET})

 set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
-set(SYSROOT_DIR   ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})

 if("${ARCH}" STREQUAL "xtensa")
   set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET})
@@ -24,3 +28,4 @@
   LIST(APPEND TOOLCHAIN_LIBS hal)
   LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib)
 endif()
+set(SYSROOT_DIR   ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})


Use the --profiling-funcs setting instead of source maps, fixes #23

--- src/common.cmake
+++ src/common.cmake
@@ -24,13 +24,10 @@
         -Wl,--wrap=getc,--wrap=ungetc
         # Output options
         --minify 0
+        --profiling-funcs
         -sENVIRONMENT=web
         -sEXPORT_ES6=1
         -sMODULARIZE=1
-        # Source maps - unfortunately it doesn't seem possible to make a generic source-map-base
-        #-g
-        #-gsource-map
-        #--source-map-base=http://127.0.0.1:8080/dist/web/
         # Optimisations
         -O3
         -sTEXTDECODER=2


Fix CONFIG_FILTER_INTRA builds with CMake.

Omit filterintra_predictors_test.cc from the build to mimic
configure behavior.

BUG=aomedia:683

Change-Id: I2057b25f5cf69ed1434a3e3833d7c30072a0b811


- Fix toolchain for iOS, C++11 mode

- Fix toolchain for iOS, C++11 mode

--- cmake/Toolchains/all-ios.toolchain.cmake
+++ cmake/Toolchains/all-ios.toolchain.cmake
@@ -214,3 +214,5 @@
 add_definitions (-fvisibility=hidden)
 set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
 set ( CMAKE_LIBRARY_ARCHITECTURE "ios-universal" CACHE STRING "" )
+
+set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "" )


fix cmake check for dlsym() when a subproject of mysql 5.6

--- cmake_modules/TokuFeatureDetection.cmake
+++ cmake_modules/TokuFeatureDetection.cmake
@@ -74,6 +74,8 @@
 check_function_exists(random_r HAVE_RANDOM_R)
 check_function_exists(mincore HAVE_MINCORE)

+## clear this out in case mysql modified it
+set(CMAKE_REQUIRED_LIBRARIES "")
 set(EXTRA_SYSTEM_LIBS "")
 check_function_exists(dlsym HAVE_DLSYM_WITHOUT_DL)
 if (NOT HAVE_DLSYM_WITHOUT_DL)


CMake: make commands lowercase to match the rest

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -485,8 +485,8 @@
   message(STATUS "Checking if LLVM is built with assertions")
   separate_arguments(_FLAGS UNIX_COMMAND "${LLVM_CXXFLAGS}")

-  SET (_TEST_SOURCE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/llvmbuiltwithassertions.cc")
-  FILE (WRITE "${_TEST_SOURCE}"
+  set(_TEST_SOURCE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/llvmbuiltwithassertions.cc")
+  file(WRITE "${_TEST_SOURCE}"
     "
       #include <llvm/Support/Debug.h>
       int main(int argc, char** argv) {
@@ -496,7 +496,7 @@

   set(TRY_COMPILE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS} -UNDEBUG")

-  TRY_COMPILE(_TRY_SUCCESS ${CMAKE_BINARY_DIR} "${_TEST_SOURCE}"
+  try_compile(_TRY_SUCCESS ${CMAKE_BINARY_DIR} "${_TEST_SOURCE}"
     CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${LLVM_INCLUDE_DIRS}"
     CMAKE_FLAGS "-DLINK_DIRECTORIES:STRING=${LLVM_LIBDIR}"
     LINK_LIBRARIES "${LLVM_LIBS} ${LLVM_SYSLIBS} ${LLVM_LDFLAGS}"
@@ -504,7 +504,7 @@
     OUTPUT_VARIABLE _TRY_COMPILE_OUTPUT
   )

-  FILE(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log"
+  file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log"
     "Test -NDEBUG flag: ${_TRY_COMPILE_OUTPUT}\n")

   if(_TRY_SUCCESS)
@@ -538,8 +538,8 @@

 if(NOT DEFINED ${CACHE_VAR_NAME})
   message(STATUS "Find out LLC target triple (for host ${LLVM_HOST_TARGET})")
-  SET (_EMPTY_C_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/tripletfind.c")
-  FILE (WRITE "${_EMPTY_C_FILE}" "")
+  set(_EMPTY_C_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/tripletfind.c")
+  file(WRITE "${_EMPTY_C_FILE}" "")

   execute_process(COMMAND ${CLANG} "${CLANG_TARGET_OPTION}${LLVM_HOST_TARGET}" -x c ${_EMPTY_C_FILE} -S -emit-llvm -o - RESULT_VARIABLE RES_VAR OUTPUT_VARIABLE OUTPUT_VAR)
   if(RES_VAR)


Fix issue #655

Fix issue #655

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -238,8 +238,8 @@
 string(REGEX REPLACE "-W[^ ]*" "" LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")

 # Llvm-config does not include clang libs
-set(CLANG_LIBNAMES clangFrontendTool clangFrontend clangDriver clangSerialization
-    clangCodeGen clangParse clangSema clangRewrite clangRewriteFrontend
+set(CLANG_LIBNAMES clangCodeGen clangFrontendTool clangFrontend clangDriver clangSerialization
+    clangParse clangSema clangRewrite clangRewriteFrontend
     clangStaticAnalyzerFrontend clangStaticAnalyzerCheckers
     clangStaticAnalyzerCore clangAnalysis clangEdit clangAST clangLex clangBasic)


FIX: incorrect handling of mqueue.h

FIX: incorrect handling of mqueue.h

--- CheckLists.cmake
+++ CheckLists.cmake
@@ -4,6 +4,15 @@
 		message(FATAL_ERROR ${MSG})
 	endif (NOT ${VARIABLE})
 endmacro (FailIfNotSet)
+
+macro (DefineIfSet VARIABLE)
+	if (${VARIABLE})
+		set(MSG "Adding definition " ${VARIABLE} "")
+		message(STATUS ${MSG})
+
+		add_definitions(-D${VARIABLE})
+	endif (${VARIABLE})
+endmacro(DefineIfSet)

 include (CheckIncludeFiles)
 if (UNIX)
@@ -59,16 +68,8 @@
 	FailIfNotSet(HAVE_SYS_MMAN_H sys/mman.h)

 	CHECK_INCLUDE_FILES(mqueue.h HAVE_MQUEUE_H)
+	DefineIfSet(HAVE_MQUEUE_H)
 endif (UNIX)
-
-macro (DefineIfSet VARIABLE)
-	if (${VARIABLE})
-		set(MSG "Adding definition " ${VARIABLE} "")
-		message(STATUS ${MSG})
-
-		add_definitions(-D${VARIABLE})
-	endif (${VARIABLE})
-endmacro(DefineIfSet)

 include(CheckFunctionExists)
 check_function_exists(strlcpy HAVE_STRLCPY)


Add MINC support for config with VTK on

Add MINC support for config with VTK on

--- SuperBuild/External_ITKv4.cmake
+++ SuperBuild/External_ITKv4.cmake
@@ -155,6 +155,7 @@
       ${${proj}_WRAP_ARGS}
       ${${proj}_FFTWF_ARGS}
       ${${proj}_FFTWD_ARGS}
+      ${${proj}_MINC_ARGS}
       )
     endif()


Upgrade pip before installing numpy

Upgrade pip before installing numpy

The older version of pip doesn't know about the newer versions of
MacOS so rejects our wheel.

--- projects/apple/numpy.cmake
+++ projects/apple/numpy.cmake
@@ -1,3 +1,11 @@
 set(numpy_platform_string "cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64")

-include(numpy.common)
+add_external_project(numpy
+  DEPENDS python
+  CONFIGURE_COMMAND ""
+  INSTALL_COMMAND
+  ${python_pip_executable} install -U pip
+  COMMAND ${python_pip_executable} install "numpy-1.16.3-${numpy_platform_string}.whl"
+  BUILD_IN_SOURCE 1
+  BUILD_COMMAND ""
+)


SVN_SILENT made messages (.desktop file)

--- vlc/vlc.desktop.cmake
+++ vlc/vlc.desktop.cmake
@@ -11,7 +11,10 @@

 Name=VLC
 Name[cs]=VLC
+Name[da]=VLC
 Name[es]=VLC
+Name[hu]=VLC
+Name[nds]=VLC
 Name[nl]=VLC
 Name[pt]=VLC
 Name[pt_BR]=VLC
@@ -21,7 +24,10 @@

 Comment=Phonon VLC backend
 Comment[cs]=Podpůrná vrstva VLC
+Comment[da]=Phonon VLC-motor
 Comment[es]=Motor VLC para Phonon
+Comment[hu]=Phonon VLC-backend
+Comment[nds]=VLC-Hülpprogramm för Phonon
 Comment[nl]=VLC-backend van Phonon
 Comment[pt]=Infra-estrutura do VLC para o Phonon
 Comment[pt_BR]=Infraestrutura do VLC para o Phonon


Added some Qt paths to cmake.

Added some Qt paths to cmake.


Skip header installation when destination include dir is not defined. This should prevent cross-compiling with host tool building from installing header files for the host target.

--- CMake/Modules/Urho3D-CMake-common.cmake
+++ CMake/Modules/Urho3D-CMake-common.cmake
@@ -980,7 +980,7 @@
     if (NOT ARG_DESTINATION)
         message (FATAL_ERROR "Couldn't setup install command because the install destination is not specified.")
     endif ()
-    if (NOT ARG_BUILD_TREE_ONLY)
+    if (NOT ARG_BUILD_TREE_ONLY AND DEST_INCLUDE_DIR)
         install (${INSTALL_TYPE} ${INSTALL_SOURCES} DESTINATION ${ARG_DESTINATION} ${INSTALL_PERMISSIONS} ${INSTALL_MATCHING})
     endif ()


On Cygwin all code is position independent and since gcc issues a warning about using this flag let's remove it

--- cmake/Modules/DefineCompilerFlags.cmake
+++ cmake/Modules/DefineCompilerFlags.cmake
@@ -11,15 +11,17 @@
     endif (WITH_CXX)

     add_definitions(-D_REENTRANT)           # for gmtime_r()
-    add_definitions(-D_XOPEN_SOURCE) 	    # for popen() and pclose()
+    add_definitions(-D_XOPEN_SOURCE)        # for popen() and pclose()
     add_definitions(-D_XOPEN_SOURCE_EXTENDED) # for strdup(), which isn't part of C99
     add_definitions(-D__STDC_FORMAT_MACROS) # for PRI*PTR format macros, required by C99

-    # with -fPIC
-    check_c_compiler_flag("-fPIC" WITH_FPIC)
-    if (WITH_FPIC)
-      add_definitions(-fPIC)
-    endif (WITH_FPIC)
+    if (NOT CYGWIN)
+        # with -fPIC
+        check_c_compiler_flag("-fPIC" WITH_FPIC)
+        if (WITH_FPIC)
+            add_definitions(-fPIC)
+        endif (WITH_FPIC)
+    endif (NOT CYGWIN)

     if (CMAKE_SIZEOF_VOID_P MATCHES "8")
       # with large file support


Update Android CMake support to revision 98d85aeb99921aca6ec8a5313c00e7b6a4a989dd of https://github.com/taka-no-me/android-cmake.

--- android/android.toolchain.cmake
+++ android/android.toolchain.cmake
@@ -29,12 +29,9 @@
 # POSSIBILITY OF SUCH DAMAGE.

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r9
-#  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
+#  Android CMake toolchain file, for use with the Android NDK r5-r10d
+#  Requires cmake 2.6.3 or newer (2.8.9 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
@@ -42,15 +39,9 @@
 #   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
 #   $ make -j8
 #
-#  Usage Linux (using standalone toolchain):
-#   $ export ANDROID_STANDALONE_TOOLCHAIN=/absolute/path/to/android-toolchain
-#   $ mkdir build && cd build
-#   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
-#   $ make -j8
-#
 #  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
 #
@@ -66,50 +57,63 @@
 #    ANDROID_NDK=/opt/android-ndk - path to the NDK root.
 #      Can be set as environment variable. Can be set only at first cmake run.
 #
-#    ANDROID_STANDALONE_TOOLCHAIN=/opt/android-toolchain - path to the
-#      standalone toolchain. This option is not used if full NDK is found
-#      (ignored if ANDROID_NDK is set).
-#      Can be set as environment variable. Can be set only at first cmake run.
-#
 #    ANDROID_ABI=armeabi-v7a - specifies the target Application Binary
 #      Interface (ABI). This option nearly matches to the APP_ABI variable
 #      used by ndk-build tool from Android NDK.
 #
 #      Possible targets are:
-#        "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
-#      "armeabi-v6 with VFP" (is forced to be ON) ABIs.
+#      instead of Thumb. Is not available for "armeabi-v6 with VFP"
+#      (is forced to be ON) ABI.
 #
 #    ANDROID_NO_UNDEFINED=ON - set ON to show all undefined symbols as linker
 #      errors even if they are not used.
@@ -117,13 +121,6 @@
 #    ANDROID_SO_UNDEFINED=OFF - set ON to allow undefined symbols in shared
 #      libraries. Automatically turned for NDK r5x and r6x due to GLESv2
 #      problems.
-#
-#    LIBRARY_OUTPUT_PATH_ROOT=${CMAKE_SOURCE_DIR} - where to output binary
-#      files. See additional details below.
-#
-#    ANDROID_SET_OBSOLETE_VARIABLES=ON - if set, then toolchain defines some
-#      obsolete variables which were used by previous versions of this file for
-#      backward compatibility.
 #
 #    ANDROID_STL=gnustl_static - specify the runtime to use.
 #
@@ -181,128 +178,10 @@
 #    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.
-#
-#    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}
-#    (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
-#   - November 2013
-#     [+] updated for NDK r9b
-#   - December 2013
-#     [+] updated for NDK r9c
-#   - January 2014
-#     [~] fix copying of shared STL
-#   - April 2014
-#     [+] updated for NDK r9d
+#    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.
+#
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )
@@ -313,146 +192,146 @@
 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
+# rpath makes low sense 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} -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
-if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
+# NDK search paths
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10d -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 )
-  set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}/android-ndk" "$ENV{SystemDrive}/NVPACK/android-ndk" )
+  set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}" "$ENV{SystemDrive}/NVPACK" )
  else()
   file( TO_CMAKE_PATH "$ENV{HOME}" ANDROID_NDK_SEARCH_PATHS )
-  set( ANDROID_NDK_SEARCH_PATHS /opt/android-ndk "${ANDROID_NDK_SEARCH_PATHS}/NVPACK/android-ndk" )
- endif()
-endif()
-if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
+  set( ANDROID_NDK_SEARCH_PATHS /opt "${ANDROID_NDK_SEARCH_PATHS}/NVPACK" )
+ endif()
+endif()
+if( NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH )
  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_SUPPORTED_ABIS_x86_64 "x86_64" )
+set( ANDROID_SUPPORTED_ABIS_mips "mips" )
+set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
+
+# API level defaults
 set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )

 macro( __LIST_FILTER listvar regex )
- if( ${listvar} )
-  foreach( __val ${${listvar}} )
-   if( __val MATCHES "${regex}" )
-    list( REMOVE_ITEM ${listvar} "${__val}" )
-   endif()
+  if( ${listvar} )
+    foreach( __val ${${listvar}} )
+      if( __val MATCHES "${regex}" )
+        list( REMOVE_ITEM ${listvar} "${__val}" )
+      endif()
+    endforeach()
+  endif()
+endmacro()
+
+macro( __INIT_VARIABLE var_name )
+  set( __test_path 0 )
+  foreach( __var ${ARGN} )
+    if( __var STREQUAL "PATH" )
+      set( __test_path 1 )
+      break()
+    endif()
   endforeach()
- endif()
+
+  if( __test_path AND NOT EXISTS "${${var_name}}" )
+    unset( ${var_name} CACHE )
+  endif()
+
+  if( " ${${var_name}}" STREQUAL " " )
+    set( __values 0 )
+    foreach( __var ${ARGN} )
+      if( __var STREQUAL "VALUES" )
+        set( __values 1 )
+      elseif( NOT __var STREQUAL "PATH" )
+        if( __var MATCHES "^ENV_.*$" )
+          string( REPLACE "ENV_" "" __var "${__var}" )
+          set( __value "$ENV{${__var}}" )
+        elseif( DEFINED ${__var} )
+          set( __value "${${__var}}" )
+        elseif( __values )
+          set( __value "${__var}" )
+        else()
+          set( __value "" )
+        endif()
+
+        if( NOT " ${__value}" STREQUAL " " AND (NOT __test_path OR EXISTS "${__value}") )
+          set( ${var_name} "${__value}" )
+          break()
+        endif()
+      endif()
+    endforeach()
+    unset( __value )
+    unset( __values )
+  endif()
+
+  if( __test_path )
+    file( TO_CMAKE_PATH "${${var_name}}" ${var_name} )
+  endif()
+  unset( __test_path )
 endmacro()

-macro( __INIT_VARIABLE var_name )
- set( __test_path 0 )
- foreach( __var ${ARGN} )
-  if( __var STREQUAL "PATH" )
-   set( __test_path 1 )
-   break()
-  endif()
- endforeach()
- if( __test_path AND NOT EXISTS "${${var_name}}" )
-  unset( ${var_name} CACHE )
- endif()
- if( "${${var_name}}" STREQUAL "" )
-  set( __values 0 )
-  foreach( __var ${ARGN} )
-   if( __var STREQUAL "VALUES" )
-    set( __values 1 )
-   elseif( NOT __var STREQUAL "PATH" )
-    set( __obsolete 0 )
-    if( __var MATCHES "^OBSOLETE_.*$" )
-     string( REPLACE "OBSOLETE_" "" __var "${__var}" )
-     set( __obsolete 1 )
-    endif()
-    if( __var MATCHES "^ENV_.*$" )
-     string( REPLACE "ENV_" "" __var "${__var}" )
-     set( __value "$ENV{${__var}}" )
-    elseif( DEFINED ${__var} )
-     set( __value "${${__var}}" )
-    else()
-     if( __values )
-      set( __value "${__var}" )
-     else()
-      set( __value "" )
-     endif()
-    endif()
-    if( NOT "${__value}" STREQUAL "" )
-     if( __test_path )
-      if( EXISTS "${__value}" )
-       file( TO_CMAKE_PATH "${__value}" ${var_name} )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-       break()
-      endif()
-     else()
-      set( ${var_name} "${__value}" )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-      break()
-     endif()
-    endif()
-   endif()
-  endforeach()
-  unset( __value )
-  unset( __values )
-  unset( __obsolete )
- elseif( __test_path )
-  file( TO_CMAKE_PATH "${${var_name}}" ${var_name} )
- endif()
- unset( __test_path )
-endmacro()
-
 macro( __DETECT_NATIVE_API_LEVEL _var _path )
- 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." )
- endif()
- string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
- unset( __apiFileContent )
- unset( __ndkApiLevelRegex )
+  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." )
+  endif()
+  string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
+  unset( __apiFileContent )
+  unset( __ndkApiLevelRegex )
 endmacro()

 macro( __DETECT_TOOLCHAIN_MACHINE_NAME _var _root )
  if( EXISTS "${_root}" )
-  file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
-  __LIST_FILTER( __gccExePath "^[.].*" )
-  list( LENGTH __gccExePath __gccExePathsCount )
-  if( NOT __gccExePathsCount EQUAL 1  AND NOT _CMAKE_IN_TRY_COMPILE )
-   message( WARNING "Could not determine machine name for compiler from ${_root}" )
-   set( ${_var} "" )
+    file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
+    __LIST_FILTER( __gccExePath "^[.].*" )
+    list( LENGTH __gccExePath __gccExePathsCount )
+    if( NOT __gccExePathsCount EQUAL 1  AND NOT _CMAKE_IN_TRY_COMPILE )
+      message( WARNING "Could not determine machine name for compiler from ${_root}" )
+      set( ${_var} "" )
+    else()
+      get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
+      string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
+    endif()
+    unset( __gccExePath )
+    unset( __gccExePathsCount )
+    unset( __gccExeName )
   else()
-   get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
-   string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
-  endif()
-  unset( __gccExePath )
-  unset( __gccExePathsCount )
-  unset( __gccExeName )
- else()
-  set( ${_var} "" )
- endif()
+    set( ${_var} "" )
+  endif()
 endmacro()

@@ -500,17 +379,19 @@
 endif()

 # see if we have path to Android NDK
-__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
+if( NOT ANDROID_NDK AND NOT ANDROID_STANDALONE_TOOLCHAIN )
+  __INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
+endif()
 if( NOT ANDROID_NDK )
  # see if we have path to Android standalone toolchain
- __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN OBSOLETE_ANDROID_NDK_TOOLCHAIN_ROOT OBSOLETE_ENV_ANDROID_NDK_TOOLCHAIN_ROOT )
+ __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN )

  if( NOT ANDROID_STANDALONE_TOOLCHAIN )
   #try to find Android NDK in one of the the default locations
   set( __ndkSearchPaths )
   foreach( __ndkSearchPath ${ANDROID_NDK_SEARCH_PATHS} )
    foreach( suffix ${ANDROID_SUPPORTED_NDK_VERSIONS} )
-    list( APPEND __ndkSearchPaths "${__ndkSearchPath}${suffix}" )
+    list( APPEND __ndkSearchPaths "${__ndkSearchPath}/android-ndk${suffix}" )
    endforeach()
   endforeach()
   __INIT_VARIABLE( ANDROID_NDK PATH VALUES ${__ndkSearchPaths} )
@@ -537,12 +418,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
@@ -565,7 +449,7 @@
     or
       export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain
     or put the toolchain or NDK in the default path:
-      sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}
+      sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}/android-ndk
       sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
 endif()

@@ -623,12 +507,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 )
@@ -644,24 +534,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()
@@ -721,7 +631,7 @@
 endif()

 # choose target ABI
-__INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${ANDROID_SUPPORTED_ABIS} )
+__INIT_VARIABLE( ANDROID_ABI VALUES ${ANDROID_SUPPORTED_ABIS} )
 # verify that target ABI is supported
 list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
 if( __androidAbiIdx EQUAL -1 )
@@ -737,28 +647,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
@@ -767,14 +694,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 )
@@ -782,7 +707,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 )
@@ -798,7 +722,7 @@
 endif()

 if( ANDROID_ARCH_NAME STREQUAL "arm" AND NOT ARMEABI_V6 )
- __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD OBSOLETE_FORCE_ARM VALUES OFF )
+ __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD VALUES OFF )
  set( ANDROID_FORCE_ARM_BUILD ${ANDROID_FORCE_ARM_BUILD} CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1" FORCE )
  mark_as_advanced( ANDROID_FORCE_ARM_BUILD )
 else()
@@ -816,7 +740,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()
@@ -827,7 +751,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 )
@@ -856,15 +780,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()
@@ -876,12 +801,13 @@
 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 )
  endif()
  set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
+ set( CMAKE_ANDROID_API ${ANDROID_NATIVE_API_LEVEL} )
  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} )
@@ -893,23 +819,14 @@
 # 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()

 # runtime choice (STL, rtti, exceptions)
 if( NOT ANDROID_STL )
- # honor legacy ANDROID_USE_STLPORT
- if( DEFINED ANDROID_USE_STLPORT )
-  if( ANDROID_USE_STLPORT )
-   set( ANDROID_STL stlport_static )
-  endif()
-  message( WARNING "You are using an obsolete variable ANDROID_USE_STLPORT to select the STL variant. Use -DANDROID_STL=stlport_static instead." )
- endif()
- if( NOT ANDROID_STL )
   set( ANDROID_STL gnustl_static )
- endif()
 endif()
 set( ANDROID_STL "${ANDROID_STL}" CACHE STRING "C++ runtime" )
 set( ANDROID_STL_FORCE_FEATURES ON CACHE BOOL "automatically configure rtti and exceptions support based on C++ runtime" )
@@ -1036,7 +953,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()
@@ -1069,7 +986,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 )
@@ -1077,12 +994,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 )
@@ -1103,7 +1020,7 @@
   else()
    set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
   endif()
-  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" )
+  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" "${__libstl}/include/backward" )
   if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
    set( __libstl                "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
   else()
@@ -1205,10 +1122,14 @@
 include( CMakeForceCompiler )
 CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
 if( ANDROID_COMPILER_IS_CLANG )
- set( CMAKE_C_COMPILER_ID Clang)
+ 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 )
@@ -1216,7 +1137,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 )
@@ -1227,6 +1148,14 @@
 set( CMAKE_ASM_COMPILER_FORCED TRUE )
 set( CMAKE_COMPILER_IS_GNUASM 1)
 set( CMAKE_ASM_SOURCE_FILE_EXTENSIONS s S asm )
+
+foreach( lang C CXX ASM )
+ if( ANDROID_COMPILER_IS_CLANG )
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_CLANG_VERSION} )
+ else()
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_COMPILER_VERSION} )
+ endif()
+endforeach()

 # flags and definitions
 remove_definitions( -DANDROID )
@@ -1257,8 +1186,15 @@
 endif()

 # NDK flags
-if( ARMEABI OR ARMEABI_V7A )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
+if (ARM64_V8A )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -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} -funwind-tables" )
  if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
   set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
   set( ANDROID_CXX_FLAGS_DEBUG   "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
@@ -1273,17 +1209,15 @@
    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" )
- else()
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fPIC" )
  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 )
- set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
+elseif( MIPS OR MIPS64 )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fno-strict-aliasing -finline-functions -funwind-tables -fmessage-length=0" )
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
@@ -1361,14 +1295,14 @@
 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 )
 else()
  __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES OFF )
 endif()
-__INIT_VARIABLE( ANDROID_NO_UNDEFINED OBSOLETE_NO_UNDEFINED VALUES ON )
+__INIT_VARIABLE( ANDROID_NO_UNDEFINED                       VALUES ON )
 __INIT_VARIABLE( ANDROID_FUNCTION_LEVEL_LINKING             VALUES ON )
 __INIT_VARIABLE( ANDROID_GOLD_LINKER                        VALUES ON )
 __INIT_VARIABLE( ANDROID_NOEXECSTACK                        VALUES ON )
@@ -1376,8 +1310,8 @@

 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_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Put each function in separate section and enable garbage collection of unused input sections at link time" )
+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 )
@@ -1412,9 +1346,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
@@ -1438,13 +1372,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()
@@ -1482,6 +1410,16 @@
  set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
  set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
  set( CMAKE_EXE_LINKER_FLAGS    "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
+endif()
+
+# pie/pic
+if( NOT (ANDROID_NATIVE_API_LEVEL LESS 16) AND (NOT DEFINED ANDROID_APP_PIE OR ANDROID_APP_PIE) AND (CMAKE_VERSION VERSION_GREATER 2.8.8) )
+ set( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
+else()
+ set( CMAKE_POSITION_INDEPENDENT_CODE FALSE )
+ set( CMAKE_CXX_FLAGS "-fpic ${CMAKE_CXX_FLAGS}" )
+ set( CMAKE_C_FLAGS   "-fpic ${CMAKE_C_FLAGS}" )
 endif()

 # configure rtti
@@ -1547,27 +1485,31 @@
 endif()

 # setup output directories
-set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
 set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )

-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" )
- 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" )
+if( DEFINED LIBRARY_OUTPUT_PATH_ROOT
+      OR EXISTS "${CMAKE_SOURCE_DIR}/AndroidManifest.xml"
+      OR (EXISTS "${CMAKE_SOURCE_DIR}/../AndroidManifest.xml" AND EXISTS "${CMAKE_SOURCE_DIR}/../jni/") )
+  set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "Root for binaries output, set this to change where Android libs are installed to" )
+  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" )
+    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 "Output directory for Android libs" )
+  endif()
 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 )
+if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" AND DEFINED LIBRARY_OUTPUT_PATH )
+  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()

@@ -1628,25 +1570,10 @@
 endmacro()

-macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
- if( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI" )
-  set( ${VAR} "armeabi" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
-  set( ${VAR} "armeabi-v7a" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
-  set( ${VAR} "x86" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
-  set( ${VAR} "mips" )
- else()
-  set( ${VAR} "unknown" )
- endif()
-endmacro()
-
-
 # export toolchain settings for the try_compile() command
-if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
+if( NOT _CMAKE_IN_TRY_COMPILE )
  set( __toolchain_config "")
- foreach( __var NDK_CCACHE  LIBRARY_OUTPUT_PATH_ROOT  ANDROID_FORBID_SYGWIN  ANDROID_SET_OBSOLETE_VARIABLES
+ foreach( __var NDK_CCACHE  LIBRARY_OUTPUT_PATH_ROOT  ANDROID_FORBID_SYGWIN
                 ANDROID_NDK_HOST_X64
                 ANDROID_NDK
                 ANDROID_NDK_LAYOUT
@@ -1665,9 +1592,10 @@
                 ANDROID_RELRO
                 ANDROID_LIBM_PATH
                 ANDROID_EXPLICIT_CRT_LINK
+                ANDROID_APP_PIE
                 )
   if( DEFINED ${__var} )
-   if( "${__var}" MATCHES " ")
+   if( ${__var} MATCHES " ")
     set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" )
    else()
     set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" )
@@ -1692,19 +1620,9 @@
 endif()

-# set some obsolete variables for backward compatibility
-set( ANDROID_SET_OBSOLETE_VARIABLES ON CACHE BOOL "Define obsolete Andrid-specific cmake variables" )
-mark_as_advanced( ANDROID_SET_OBSOLETE_VARIABLES )
-if( ANDROID_SET_OBSOLETE_VARIABLES )
- set( ANDROID_API_LEVEL ${ANDROID_NATIVE_API_LEVEL} )
- set( ARM_TARGET "${ANDROID_ABI}" )
- set( ARMEABI_NDK_NAME "${ANDROID_NDK_ABI_NAME}" )
-endif()
-
-
 # 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
@@ -1715,47 +1633,42 @@
 #   ANDROID_RELRO : ON/OFF
 #   ANDROID_FORCE_ARM_BUILD : ON/OFF
 #   ANDROID_STL_FORCE_FEATURES : ON/OFF
-#   ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
+#   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`
 # Can be set only at the first run:
-#   ANDROID_NDK
-#   ANDROID_STANDALONE_TOOLCHAIN
+#   ANDROID_NDK : path to your NDK install
+#   NDK_CCACHE : path to your ccache executable
 #   ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
 #   ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
 #   ANDROID_NDK_LAYOUT : the inner NDK structure (RELEASE, LINARO, ANDROID)
 #   LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
-#   NDK_CCACHE : <path to your ccache executable>
-# Obsolete:
-#   ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
-#   ARM_TARGET : superseded by ANDROID_ABI
-#   ARM_TARGETS : superseded by ANDROID_ABI (can be set only)
-#   ANDROID_NDK_TOOLCHAIN_ROOT : superseded by ANDROID_STANDALONE_TOOLCHAIN (can be set only)
-#   ANDROID_USE_STLPORT : superseded by ANDROID_STL=stlport_static
-#   ANDROID_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL (completely removed)
+#   ANDROID_STANDALONE_TOOLCHAIN
 #
 # Primary read-only variables:
 #   ANDROID : always TRUE
 #   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
-#   BUILD_ANDROID : always TRUE
+#   MIPS64 : TRUE if configured for mips64
 #   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_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 r10d; 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
-# Obsolete:
-#   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"
@@ -1766,13 +1679,10 @@
 #   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:
 #   ANDROID_DEFAULT_NDK_API_LEVEL
 #   ANDROID_DEFAULT_NDK_API_LEVEL_${ARCH}
 #   ANDROID_NDK_SEARCH_PATHS
-#   ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
 #   ANDROID_SUPPORTED_ABIS_${ARCH}
 #   ANDROID_SUPPORTED_NDK_VERSIONS


BUG: Address memory leak, remove NumPy build dep in BridgeNumPy

This addresses a memory leak, reported on the mailing list, and remove the
build dependency on NumPy as well as other improvements.

git shortlog --no-merges 6218266e7..9b5b17a462e8

  HYUN JAE KANG (5):
        ENH: Update the module of ITKBridgeNumPy
        ENH : Add itemset function to itkndarray class
        BUG. Fixed inappropriate argument number of _GetArrayFromImage
        STYLE: Removed debug messages.
        ENH: Update itkPyBuffer.py

  Matt McCormick (13):
        ENH: Build the module externally
        ENH: Add CTestConfig.cmake
        ENH: Add Docker testing
        ENH: Add CircleCI configuration
        STYLE: Fix KWStyle test
        BUG: Address memory leak in GetImageFromArray
        BUG: Address CPython API exception raising
        BUG: Fix itkPyBufferTest name
        BUG: Do not add tests with ITK < 4.11
        BUG: Update testing ITK version to in development 4.11
        ENH: Add Docker image caching in CircleCI
        ENH: Use local Debian mirror to improve package download reliability
        DOC: Update README

Change-Id: I1700fa0d95e418c3d2f86e9c676df9c924402dba

--- Modules/Remote/BridgeNumPy.remote.cmake
+++ Modules/Remote/BridgeNumPy.remote.cmake
@@ -12,5 +12,5 @@
   See http://insight-journal.org/browse/publication/85
       https://hdl.handle.net/1926/188"
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKBridgeNumPy.git
-  GIT_TAG 6218266e76d00439bbad32d1d3acec069442aeab
+  GIT_TAG 9b5b17a462e88478f3ea780b805b6a3a5e10dee5
   )


Adding additional directories to search for the Ogre framework when using a prebuilt SDK with your own projects under OS X

--- CMake/Utils/FindPkgMacros.cmake
+++ CMake/Utils/FindPkgMacros.cmake
@@ -131,6 +131,10 @@
       /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
       ${CMAKE_CURRENT_SOURCE_DIR}/lib/Release
       ${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug
+      ${OGRE_PREFIX_PATH}/lib/Release
+      ${OGRE_PREFIX_PATH}/lib/Debug
+      ${OGRE_PREFIX_BUILD}/lib/Release
+      ${OGRE_PREFIX_BUILD}/lib/Debug
     )
     FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
       SET(fwkpath ${dir}/${fwk}.framework)


incompressible: whitespace

incompressible: whitespace

--- phSolver/incompressible/test/testing.cmake
+++ phSolver/incompressible/test/testing.cmake
@@ -11,8 +11,8 @@
   cp ${CDIR}/numstart.dat ${CDIR}/4-procs_case/numstart.dat)
 ic_parallel_test(sync 4 ${CDIR} ${PHASTA_BINARY_DIR}/bin/phastaIC.exe)
 set(compareArgs
-  ${CDIR}/4-procs_case-SyncIO-2/
-  ${CDIR}/4-procs_case-SyncIO-2_ref/
+  ${CDIR}/4-procs_case-SyncIO-2/
+  ${CDIR}/4-procs_case-SyncIO-2_ref/
   2 1e-6)
 ic_parallel_test(compare-sync 4 ${CDIR}
   ${PHASTA_BINARY_DIR}/bin/checkphasta ${compareArgs})
@@ -32,9 +32,9 @@
 ic_serial_test(resetNumStart-posix
   cp ${CDIR}/numstart.dat ${CDIR}/4-procs_case/numstart.dat)
 ic_parallel_test(posix 4 ${CDIR} ${PHASTA_BINARY_DIR}/bin/phastaIC.exe)
-set(compareArgs
-  ${CDIR}/4-procs_case-Posix/
-  ${CDIR}/4-procs_case-Posix_ref/
+set(compareArgs
+  ${CDIR}/4-procs_case-Posix/
+  ${CDIR}/4-procs_case-Posix_ref/
   0 1e-6)
 ic_parallel_test(compare-posix 4 ${CDIR}
   ${PHASTA_BINARY_DIR}/bin/checkphasta ${compareArgs})


ManageTransaltion: MANAGE_GETTEXT

ManageTransaltion: MANAGE_GETTEXT

--- Modules/ManageTranslation.cmake
+++ Modules/ManageTranslation.cmake
@@ -2,6 +2,9 @@
 # This module supports software translation by:
 #   1) Creates gettext related targets.
 #   2) Communicate to Zanata servers.
+#
+# By calling MANAGE_GETTEXT(), following variables are available in cache:
+#   - MANAGE_TRANSLATION_LOCALES: Locales that would be processed.
 #
 # Included Modules:
 #   - ManageArchive
@@ -26,6 +29,7 @@
 #
 # Defines following functions:
 #   ADD_POT_FILE(<potFile> [SRCS <src> ...]
+#       [PO_DIR <dir>]
 #	[XGETTEXT_OPTIONS <opt> ...]
 #       [COMMAND <cmd> ...]
 #       [DEPENDS <file> ...]
@@ -35,16 +39,23 @@
 #       * Parameters:
 #         + potFile: .pot file with path.
 #         + SRCS src ... : Source files for xgettext to work on.
+#         + PO_DIR dir: Directory of .po files.
+#             This option is mandatory if .pot and associated .po files
+#             are not in the same directory.
+#           Default: Same directory of <potFile>.
 #         + XGETTEXT_OPTIONS opt ... : xgettext options.
 #         + COMMAND cmd ... : Non-xgettext command that create pot file.
 #         + DEPENDS file ... : Files that pot file depends on.
 #             SRCS files are already depended on, so no need to list here.
 #       * Variables to cache:
-#         + MANAGE_TRANSLATION_GETTEXT_POT_LIST: List of pot file.
+#         + MANAGE_TRANSLATION_GETTEXT_POT_FILES: List of pot file.
+#         + MANAGE_TRANSLATION_GETTEXT_POT_FILE_<potFile>_PO_DIR:
+#             Directory of po files which associated with <potFile>.
 #
 #   MANAGE_GETTEXT([ALL]
+#       [POT_FILE <potFile>]
 #       [SRCS <src> ...]
-#       [POT_FILE <potFile>]
+#       [PO_DIR <dir>]
 #	[LOCALES <locale> ... | SYSTEM_LOCALES]
 #       [MSGFMT_OPTIONS <msgfmtOpt>]
 #       [MSGMERGE_OPTIONS <msgmergeOpt>]
@@ -63,16 +74,21 @@
 #         + or nothing to use the existing po files.
 #       * Parameters:
 #         + ALL: (Optional) make target "all" depends on gettext targets.
-#         + SRCS src ... : Source files for xgettext to work on.
-#         + POT_FILE potFile: (optional) pot files with path.
+#         + POT_FILE potFile: (Optional) pot files with path.
 #           Default: ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pot
-#         + LOCALES locale ... : (optional) Locale list to be generated.
-#         + SYSTEM_LOCALES: (optional) System locales from locale -a.
-#         + MSGFMT_OPTIONS msgfmtOpt: (optional) msgfmt options.
+#         + SRCS src ... : (Optional) Source files for xgettext to work
+#             on.
+#         + PO_DIR dir: Directory of .po files.
+#             This option is mandatory if .pot and associated .po files
+#             are not in the same directory.
+#           Default: Same directory of <potFile>.
+#         + LOCALES locale ... : (Optional) Locale list to be generated.
+#         + SYSTEM_LOCALES: (Optional) System locales from locale -a.
+#         + MSGFMT_OPTIONS msgfmtOpt: (Optional) msgfmt options.
 #           Default: ${MANAGE_TRANSLATION_MSGFMT_OPTIONS}
-#         + MSGMERGE_OPTIONS msgmergeOpt: (optional) msgmerge options.
+#         + MSGMERGE_OPTIONS msgmergeOpt: (Optional) msgmerge options.
 #           Default: ${MANAGE_TRANSLATION_MSGMERGE_OPTIONS}, which is
-#         + XGETTEXT_OPTIONS xgettextOpt: (optional) xgettext options.
+#         + XGETTEXT_OPTIONS xgettextOpt: (Optional) xgettext options.
 #           Default: ${XGETTEXT_OPTIONS_C}
 #         + COMMAND cmd ... : Non-xgettext command that create pot file.
 #         + DEPENDS file ... : Files that pot file depends on.
@@ -82,13 +98,14 @@
 #         + gmo_files: Converts po files to mo files.
 #         + update_po: Update po files according to pot files.
 #       * Variables read:
-#         + MANAGE_GETTEXT_POT_LIST:
+#         + MANAGE_GETTEXT_POT_FILES:
 #            (Optional) List of pot file.
 #       * Variables to cache:
+#         + MSGINIT_CMD: the full path to the msginit tool.
 #         + MSGMERGE_CMD: the full path to the msgmerge tool.
 #         + MSGFMT_CMD: the full path to the msgfmt tool.
 #         + XGETTEXT_CMD: the full path to the xgettext.
-#         + MANAGE_GETTEXT_LOCALES: Locales to be processed.
+#         + MANAGE_LOCALES: Locales to be processed.
 #
 #   MANAGE_ZANATA(serverUrl [YES])
 #   - Use Zanata (was flies) as translation service.
@@ -120,8 +137,20 @@
 INCLUDE(ManageFile)
 INCLUDE(ManageDependency)

-SET(XGETTEXT_OPTIONS_C --language=C --keyword=_ --keyword=N_
-    --keyword=C_:1c,2 --keyword=NC_:1c,2 -s
+SET(XGETTEXT_OPTIONS_COMMON --from-code=UTF-8 --indent
+    --sort-by-file
+    )
+
+SET(XGETTEXT_OPTIONS_C ${XGETTEXT_OPTIONS_COMMON}
+    --language=C
+    --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 -s
+    --keyword=gettext --keyword=dgettext:2
+    --keyword=dcgettext:2 --keyword=ngettext:1,2
+    --keyword=dngettext:2,3 --keyword=dcngettext:2,3
+    --keyword=gettext_noop --keyword=pgettext:1c,2
+    --keyword=dpgettext:2c,3 --keyword=dcpgettext:2c,3
+    --keyword=npgettext:1c,2,3 --keyword=dnpgettext:2c,3,4
+    --keyword=dcnpgettext:2c,3,4.
     )

 SET(MANAGE_TRANSLATION_MSGFMT_OPTIONS
@@ -136,11 +165,6 @@
     )
 SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM "1")

-IF(NOT TARGET translations)
-    ADD_CUSTOM_TARGET(translations
-	COMMENT "translations: Making translations"
-	)
-ENDIF(NOT TARGET translations)
 SET(_gettext_dependency_missing 0)

 #######################################
@@ -151,7 +175,7 @@
     IF(DEFINED XGETTEXT_CMD)
 	RETURN()
     ENDIF(DEFINED XGETTEXT_CMD)
-    FOREACH(_name "xgettext" "msgmerge" "msgfmt")
+    FOREACH(_name "xgettext" "msgmerge" "msgfmt" "msginit")
 	STRING(TOUPPER "${_name}" _cmd)
 	FIND_PROGRAM_ERROR_HANDLING(${_cmd}_CMD
 	    ERROR_MSG " gettext support is disabled."
@@ -185,11 +209,23 @@
 		)
 	    RETURN()
 	ENDIF()
+	## Source files
+	SET(_srcList "")
+	SET(_srcList_abs "")
+	FOREACH(_sF ${_o_SRCS})
+	    FILE(RELATIVE_PATH _relFile
+		"${CMAKE_CURRENT_BINARY_DIR}" "${_sF}")
+	    LIST(APPEND _srcList ${_relFile})
+	    GET_FILENAME_COMPONENT(_absPoFile ${_sF} ABSOLUTE)
+	    LIST(APPEND _srcList_abs ${_absPoFile})
+	ENDFOREACH(_sF ${_o_SRCS})
+
 	ADD_CUSTOM_COMMAND(OUTPUT ${potFile}
 	    COMMAND ${XGETTEXT_CMD} ${_o_XGETTEXT_OPTIONS}
 	    -o ${potFile}
 	    --package-name=${PROJECT_NAME}
 	    --package-version=${PRJ_VER} ${_o_SRCS}
+	    --msgid-bugs-address=${MAINTAINER}
 	    DEPENDS ${_o_SRCS} ${_o_DEPENDS}
 	    COMMENT "${potFile}: xgettext: Extract translatable messages"
 	    )
@@ -200,13 +236,77 @@
 	    COMMENT "${potFile}: Extract translatable messages"
 	    )
     ENDIF("${_o_COMMAND}" STREQUAL "")
-    LIST(APPEND MANAGE_TRANSLATION_GETTEXT_POT_LIST ${potFile})
-    SET(MANAGE_TRANSLATION_GETTEXT_POT_LIST
-	"${MANAGE_TRANSLATION_GETTEXT_POT_LIST}"
+    LIST(APPEND MANAGE_TRANSLATION_GETTEXT_POT_FILES ${potFile})
+    SET(MANAGE_TRANSLATION_GETTEXT_POT_FILES
+	"${MANAGE_TRANSLATION_GETTEXT_POT_FILES}"
 	CACHE INTERNAL "List of pot files"
 	)
-ENDFUNCTION(ADD_POT_FILE potFile)
-
+
+    ## In case potFile is not in source control
+    SOURCE_ARCHIVE_CONTENTS_ADD("${potFile}")
+
+    GET_FILENAME_COMPONENT(_potName "${potFile}" NAME_WE)
+    GET_FILENAME_COMPONENT(_potDir "${potFile}" PATH)
+    IF(_o_PO_DIR STREQUAL "")
+	SET(_o_PO_DIR "${potDir}")
+    ENDIF()
+    GET_FILENAME_COMPONENT(_potName "${potFile}" NAME_WE)
+    SET(MANAGE_TRANSLATION_GETTEXT_POT_FILE_${_potName}_PO_DIR
+	"${_o_PO_DIR}" CACHE INTERNAL "PO dir for ${_potName}"
+	)
+ENDFUNCTION(ADD_POT_FILE)
+
+## Internal
+# MANAGE_GETTEXT_GET_PO_FILES(<var> <pot>)
+#   - Get the po file list associate to the given pot
+#     * Parameters:
+#       + var: Returns po file list related to pot.
+#       + pot: .pot file.
+FUNCTION(MANAGE_GETTEXT_GET_PO_FILES var pot)
+    IF("${MANAGE_TRANSLATION_LOCALES}" STREQUAl "")
+	M_MSG(${M_ERROR} "MANAGE_GETTEXT_GET_PO_FILES: MANAGE_TRANSLATION_LOCALES is empty. Specify locale by either LOCALES or SYSTEM_LOCALES")
+	RETURN()
+    ENDIF("${MANAGE_TRANSLATION_LOCALES}" STREQUAl "")
+    GET_FILENAME_COMPONENT(_potName "${potFile}" NAME_WE)
+    SET(_list "")
+    FOREACH(_l ${MANAGE_TRANSLATION_LOCALES})
+	LIST(APPEND _list
+	    "${MANAGE_TRANSLATION_GETTEXT_POT_FILE_${_potName}_PO_DIR}/${_l}.po"
+	    )
+    ENDFOREACH(_l)
+    SET(${var} "${_l}" PARENT_SCOPE)
+ENDFUNCTION(MANAGE_GETTEXT_GET_PO_FILES)
+
+## Internal
+MACRO(MANAGE_GETTEXT_LOCALES potDirList)
+    IF(NOT "${_o_LOCALES}" STREQUAL "")
+	## Locale is defined
+    ELSEIF(DEFINED _o_SYSTEM_LOCALES)
+	EXECUTE_PROCESS(
+	    COMMAND locale -a | grep -e '^[a-z]*_[A_Z]*$' | xargs | sed -e 's/ /;/g'
+	    OUTPUT_VARIABLE _o_LOCALES
+	    OUTPUT_STRIP_TRAILING_WHITESPACE
+	    )
+    ELSE(NOT DEFINED _o_SYSTEM_LOCALES)
+	## LOCALES is not specified, detect now
+	FOREACH(_potDir ${potDirList})
+	    EXECUTE_PROCESS(
+		COMMAND find ${_potDir} -name "*.po" -printf '%f ' | sed -e 's/.po /;/g'
+		OUTPUT_VARIABLE _locales
+		OUTPUT_STRIP_TRAILING_WHITESPACE
+		)
+	    LIST(APPEND _o_LOCALES ${_locales})
+	ENDFOREACH(_potDir)
+	LIST(REMOVE_DUPLICATES ${_o_LOCALES})
+	IF("${_o_LOCALES}" STREQUAL "")
+	    ## Failed to find any locale
+	    M_MSG(${M_ERROR} "MANAGE_GETTEXT: Failed to detect locales, specify SYSTEM_LOCALES in MANAGE_GETTEXT to use locales available in your system")
+	ENDIF()
+    ENDIF()
+    SET(MANAGE_TRANSLATION_LOCALES "${_o_LOCALES}" CACHE INTERNAL
+	"Locales"
+	)
+ENDMACRO(MANAGE_GETTEXT_LOCALES)

 FUNCTION(MANAGE_GETTEXT)
     MANAGE_DEPENDENCY(BUILD_REQUIRES GETTEXT REQUIRED)
@@ -218,131 +318,123 @@
     ENDIF(_gettext_dependency_missing)

     SET(_validOptions
-	"SRCS" "XGETTEXT_OPTIONS" "COMMAND" "DEPENDS"
+	"SRCS" "PO_DIR" "XGETTEXT_OPTIONS" "COMMAND" "DEPENDS"
 	"ALL" "LOCALES" "SYSTEM_LOCALES" "POT_FILE"
 	"MSGFMT_OPTIONS" "MSGMERGE_OPTIONS"
 	)
     VARIABLE_PARSE_ARGN(_o _validOptions ${ARGN})
     IF(DEFINED _o_ALL)
 	SET(_all "ALL")
+    ELSE()
+	SET(_all "")
     ENDIF(DEFINED _o_ALL)

-    ## Pot files
-    IF(_o_POT_FILES)
-	SET(_o_POT_FILES
-	    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pot"
+    ## Pot file
+    SET(_potFile "")
+    IF("${_o_POT_FILE}" STREQUAL "")
+	IF("${MANAGE_TRANSLATION_GETTEXT_POT_FILES}" STREQUAL "")
+	    SET(_potFile
+		"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pot"
+		)
+	ENDIF()
+    ELSE()
+	## POT_FILE is specified
+	SET(_potFile "${_o_POT_FILE}")
+    ENDIF()
+    IF(_potFile)
+	SET(_validAddPotFileOptList
+	    "SRCS" "PO_DIR" "XGETTEXT_OPTIONS" "COMMAND" "DEPENDS"
 	    )
-    ENDIF(_o_POT_FILES)
-    ## In case pot files are not in source control
-    SOURCE_ARCHIVE_CONTENTS_ADD(${_o_POT_FILES})
-
-    ## Directory that contains pot
+	VARIABLE_TO_ARGN(_addPotFileOptList _o _validAddPotFileOptList)
+	## Add new pot file
+	ADD_POT_FILE("${_potFile}" ${_addPotFileOptList})
+    ENDIF(_potFile)
+
+    ## Locales
     SET(_potDirList "")
-    FOREACH(_pot ${_o_POT_FILES})
-	GET_FILENAME_COMPONENT(_potDir ${_pot} PATH)
+    FOREACH(_pot ${MANAGE_TRANSLATION_GETTEXT_POT_FILES})
+	GET_FILENAME_COMPONENT(_potDir "${_pot}" PATH)
 	LIST(APPEND _potDirList "${_potDir}")
     ENDFOREACH(_pot)
-
-    ## Locales
-    IF("${_o_LOCALES}" STREQUAL "")
-	IF(DEFINED _o_SYSTEM_LOCALES)
-	    EXECUTE_PROCESS(
-		COMMAND locale -a | grep -e '^[a-z]*_[A_Z]*$' | xargs | sed -e 's/ /;/g'
-		OUTPUT_VARIABLE _o_LOCALES
-		OUTPUT_STRIP_TRAILING_WHITESPACE
-		)
-	ELSE()
-	    ## LOCALES is not specified, detect now
-	    FOREACH(_potDir ${_potDirList})
-		EXECUTE_PROCESS(
-		    COMMAND find ${_potDir} -name "*.po" -printf '%f ' | sed -e 's/.po /;/g'
-		    OUTPUT_VARIABLE _locales
-		    OUTPUT_STRIP_TRAILING_WHITESPACE
-		    )
-		LIST(APPEND _o_LOCALES ${_locales})
-	    ENDFOREACH(_potDir)
-	    LIST(REMOVE_DUPLICATES ${_o_LOCALES})
-	ENDIF(DEFINED _o_SYSTEM_LOCALES)
-    ENDIF("${_o_LOCALES}" STREQUAL "")
+    MANAGE_GETTEXT_LOCALES(_potDirList)

     ## Other options
-    FOREACH(_oName "MSGFMT" "MSGMERGE" "XGETTEXT")
+    FOREACH(_oName "MSGFMT" "MSGMERGE")
 	IF(NOT _o_${_oName}_OPTIONS)
 	    SET(_o_${_oName}_OPTIONS
 		"${MANAGE_TRANSLATION_${_oName}_OPTIONS}"
 		)
 	ENDIF(NOT _o_${_oName}_OPTIONS)
-    ENDFOREACH(_oName "MSGFMT" "MSGMERGE" "XGETTEXT")
-
-    ## Source files
-    SET(_srcList "")
-    SET(_srcList_abs "")
-    FOREACH(_sF ${_o_SRCS})
-	FILE(RELATIVE_PATH _relFile
-	    "${CMAKE_CURRENT_BINARY_DIR}" "${_sF}")
-	LIST(APPEND _srcList ${_relFile})
-	GET_FILENAME_COMPONENT(_absPoFile ${_sF} ABSOLUTE)
-	LIST(APPEND _srcList_abs ${_absPoFile})
-    ENDFOREACH(_sF ${_o_SRCS})
-
-    ### Generating pot files
-    FOREACH(_pot ${_o_POT_FILES})
-	ADD_CUSTOM_COMMAND(OUTPUT ${_pot}
-	GET_FILENAME_COMPONENT(_potDir ${_pot} PATH)
-	LIST(APPEND _potDirList "${_potDir}")
-    ENDFOREACH(_pot)
-    ADD_CUSTOM_TARGET_COMMAND(pot_file
-	NO_FORCE OUTPUT ${_o_POT_FILES} ${_all}
-	COMMAND ${XGETTEXT_CMD} ${_o_XGETTEXT_OPTIONS}
-	-o ${_o_POT_FILES}
-	--package-name=${PROJECT_NAME}
-	--package-version=${PRJ_VER} ${_srcList}
-	DEPENDS ${_srcList_abs}
-	COMMENT "Extract translatable messages to ${_potFile}"
-	)
-
-    ### Generating gmo files
-    SET(_gmoList "")
-    SET(_poList "")
-    FOREACH(_locale ${_o_LOCALES})
-	SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_locale}.gmo)
-	SET(_poFile ${CMAKE_CURRENT_SOURCE_DIR}/${_locale}.po)
-	SOURCE_ARCHIVE_CONTENTS_ADD("${_poFile}")
-	ADD_CUSTOM_COMMAND(OUTPUT ${_poFile}
-	    COMMAND ${MSGMERGE_CMD}
-	    ${_o_MSGMERGE_OPTIONS} ${_poFile} ${_o_POT_FILES}
-	    DEPENDS ${_o_POT_FILES}
-	    COMMENT "Running ${MSGMERGE_CMD}"
-	    )
-
-	ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile}
-	    COMMAND ${MSGFMT_CMD}
-	    ${_o_MSGFMT_OPTIONS} -o ${_gmoFile} ${_poFile}
-	    DEPENDS ${_poFile}
-	    COMMENT "Running ${MSGFMT_CMD}"
-	    )
-
-	LIST(APPEND _gmoList "${_gmoFile}")
-	## No need to use MANAGE_FILE_INSTALL
-	## As this will handle by rpmbuild
-	INSTALL(FILES ${_gmoFile} DESTINATION
-	    ${DATA_DIR}/locale/${_locale}/LC_MESSAGES
-	    RENAME ${_o_POT_FILES_NAME}.mo
-	    )
-    ENDFOREACH(_locale ${_o_LOCALES})
-    SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_potFile}" )
+    ENDFOREACH(_oName)
+
+    ## Make all pot files
+    ADD_CUSTOM_TARGET(pot_file
+	DEPENDS ${MANAGE_TRANSLATION_GETTEXT_POT_FILES}
+	COMMENT "pot_file: ${MANAGE_TRANSLATION_GETTEXT_POT_FILES}"
+	)
+
+    ## For each pot files
+    SET(_gmoFileList "")
+    FOREACH(_pot ${MANAGE_TRANSLATION_GETTEXT_POT_FILES})
+	GET_FILENAME_COMPONENT(_potName "${_pot}" NAME_WE)
+	MANAGE_GETTEXT_GET_PO_FILES(_poFileList ${_pot})
+	FOREACH(_po ${_poFileList})
+	    GET_FILENAME_COMPONENT(_poFile ${_po} NAME)
+	    SET(_poDir
+		"${MANAGE_TRANSLATION_GETTEXT_POT_FILE_${_potName}_PO_DIR}"
+		)
+	    STRING(REPLACE ".po" "" _loc "${_poFile}")
+
+	    ### Create and update  po files
+	    ADD_CUSTOM_COMMAND(OUTPUT ${_po}
+		COMMAND if [ -r ${_po} ];
+		then ${MSGMERGE_CMD}
+		${MANAGE_TRANSLATION_MSGMERGE_OPTIONS}
+	       	--lang=${_loc} 	${_po} ${_pot};
+		else ${MSGINIT_CMD} --output ${_po} --input ${_pot};
+		fi
+		DEPENDS ${_pot}
+		COMMENT "po: ${_po} from ${_pot}"
+		)
+	    SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_loc}.gmo)
+
+	    ### Generate gmo files
+	    FILE(RELATIVE_PATH _poR
+		"${CMAKE_CURRENT_SOURCE_DIR}" "${_po}")
+	    GET_FILENAME_COMPONENT(_poDirR "${_poR}" PATH)
+	    SET(_gmo "${CMAKE_CURRENT_BINARY_DIR}/${_poDirR}/${_loc}.gmo")
+	    ADD_CUSTOM_COMMAND(OUTPUT ${_gmo}
+		COMMAND ${MSGFMT_CMD}
+		${MANAGE_TRANSLATION_MSGMERGE_OPTIONS}
+                -o ${_gmo} ${_po}
+		DEPENDS ${_po}
+		COMMENT "gmo: ${_gmo}"
+		)
+	    LIST(APPEND _gmoFileList "${_gmo}")
+
+	    ### Install gmo
+	    INSTALL(FILES ${_gmo} DESTINATION
+		${DATA_DIR}/locale/${_locale}/LC_MESSAGES
+		RENAME ${_potName}.mo
+		)
+	ENDFOREACH(_po ${_poFileList})
+    ENDFOREACH(_pot ${MANAGE_TRANSLATION_GETTEXT_POT_FILES})

     ADD_CUSTOM_TARGET(gmo_files ${_all}
-	DEPENDS ${_gmoList}
-	COMMENT "Generate gmo files for translation"
-	)
-
+	DEPENDS ${_gmoFileList}
+	COMMENT "gmo_files"
+	)
+
+    ADD_CUSTOM_TARGET(translations ${_all}
+	COMMENT "translations: Making translations"
+	)
     ADD_DEPENDENCIES(translations gmo_files)
 ENDFUNCTION(MANAGE_GETTEXT)

-    #========================================
-    # ZANATA support
+#========================================
+# ZANATA support
+#
     MACRO(MANAGE_ZANATA serverUrl)
 	SET(ZANATA_SERVER "${serverUrl}")
 	FIND_PROGRAM(ZANATA_CMD zanata)


Disable EIGEN BUILD_TESTING

Disable EIGEN BUILD_TESTING

--- Superbuild/Projects/eigen.cmake
+++ Superbuild/Projects/eigen.cmake
@@ -3,5 +3,7 @@
     ${CMAKE_COMMAND} -E copy_if_different
     ${SuperBuild_PROJECTS_DIR}/patches/eigen.cmake.language_support.cmake
     <SOURCE_DIR>/cmake/language_support.cmake
-  CMAKE_ARGS -DEIGEN_BUILD_PKGCONFIG=off
+  CMAKE_ARGS
+    -DEIGEN_BUILD_PKGCONFIG=off
+    -DBUILD_TESTING:BOOL=OFF
   )


Fix USE_HARDENING=1 MinGW builds

Fix USE_HARDENING=1 MinGW builds

When -pie is supplied without the entry point flag, all binaries fail to
execute, even the single-file include-bin.

--- cmake/DaemonFlags.cmake
+++ cmake/DaemonFlags.cmake
@@ -224,6 +224,14 @@
         try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")
         try_c_cxx_flag(FPIE "-fPIE")
         try_linker_flag(LINKER_PIE "-pie")
+        if (${FLAG_LINKER_PIE} AND MINGW)
+            # https://github.com/msys2/MINGW-packages/issues/4100
+            if (ARCH STREQUAL "x86")
+                set_linker_flag("-Wl,-e,_mainCRTStartup")
+            else()
+                set_linker_flag("-Wl,-e,mainCRTStartup")
+            endif()
+        endif()
     endif()

     # Linker flags


Fix cmake for changes in llvm-config (llvm 3.5)

llvm-config --ldflags no longer prints the libraries, and has
separate command for that: llvm-config --system-libs

Fixes issue 112 on cmake side

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -136,6 +136,11 @@
 #LLVM_CXX_FLAGS="$LLVM_CXX_FLAGS -fno-rtti"
 set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")

+if(NOT LLVM_VERSION VERSION_LESS "3.5")
+  run_llvm_config(LLVM_SYSLIBS --system-libs)
+  set(LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSLIBS}")
+endif()
+
 ####################################################################

 macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)


add USE_ALLEGRO to cmake

add USE_ALLEGRO to cmake

git-svn-id: 39e099a8ed5324aded674b764a67f7a08796d9a7@3911 662fdd30-d327-0410-a531-f549c87e1e9e

--- cmake/FindALLEGRO.cmake
+++ cmake/FindALLEGRO.cmake
@@ -28,7 +28,8 @@

 IF (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
    SET(ALLEGRO_FOUND TRUE)
-    SET( ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY} )
+   SET( ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY} )
+   add_definitions(-DUSE_ALLEGRO)
 ELSE (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
    SET(ALLEGRO_FOUND FALSE)
    SET( ALLEGRO_LIBRARIES )
@@ -48,4 +49,4 @@
 MARK_AS_ADVANCED(
   ALLEGRO_LIBRARY
   ALLEGRO_INCLUDE_DIR
-  )+  )


Revert "Temporarily revert LLVM 14 support for release 1.8 branch"

Restore support for LLVM 14 in master branch

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -39,6 +39,7 @@
     NAMES
       "llvmtce-config"
       "llvm-config"
+      "llvm-config-mp-14.0" "llvm-config-14" "llvm-config140"
       "llvm-config-mp-13.0" "llvm-config-13" "llvm-config130"
       "llvm-config-mp-12.0" "llvm-config-12" "llvm-config120"
       "llvm-config-mp-11.0" "llvm-config-11" "llvm-config110"
@@ -205,8 +206,11 @@
 elseif(LLVM_VERSION MATCHES "^13[.]")
   set(LLVM_MAJOR 13)
   set(LLVM_13_0 1)
+elseif(LLVM_VERSION MATCHES "^14[.]")
+  set(LLVM_MAJOR 14)
+  set(LLVM_14_0 1)
 else()
-  message(FATAL_ERROR "LLVM version between 6.0 and 13.0 required, found: ${LLVM_VERSION}")
+  message(FATAL_ERROR "LLVM version between 6.0 and 14.0 required, found: ${LLVM_VERSION}")
 endif()

 #############################################################


LLVM: Disable support for unused features to reduce system deps

--- cmake/llvm.cmake
+++ cmake/llvm.cmake
@@ -47,9 +47,9 @@
         # System libs that LLVM depend on.
         # See `llvm-config --system-libs`
         if (APPLE)
-            set(SYSTEM_LIBS pthread z m curses)
+            set(SYSTEM_LIBS pthread)
         elseif (UNIX)
-            set(SYSTEM_LIBS pthread z m tinfo dl)
+            set(SYSTEM_LIBS pthread dl)
         endif()

         include(ExternalProject)
@@ -59,7 +59,10 @@
             SOURCE_DIR llvm/src/llvm
             URL http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz
             URL_HASH SHA256=555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46
-            CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+            CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
+                       -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+                       -DLLVM_ENABLE_TERMINFO=OFF  # Disable terminal color support
+                       -DLLVM_ENABLE_ZLIB=OFF      # Disable compression support -- not needed at all
                        -DLLVM_TARGETS_TO_BUILD=X86
                        -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF
                        -DLLVM_INCLUDE_TESTS=OFF