android/android.toolchain.cmake: Update from https://github.com/taka-no-me/android-cmake/blob/master/android.toolchain.cmake.

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

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r8
+#  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).
 #  See home page: https://github.com/taka-no-me/android-cmake
 #
@@ -87,8 +87,7 @@
 #        "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
-#            (It is not tested on real devices by the authos of this toolchain)
+#        "mips" - matches to the NDK ABI with the same name.
 #            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
@@ -292,6 +291,18 @@
 #   - 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
 # ------------------------------------------------------------------------------

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

-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+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)
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -464,7 +475,7 @@

 # detect current host platform
-if( NOT DEFINED ANDROID_NDK_HOST_X64 AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64" OR CMAKE_HOST_APPLE) )
  set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
  mark_as_advanced( ANDROID_NDK_HOST_X64 )
 endif()
@@ -484,9 +495,7 @@
  message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
 endif()

-# CMAKE_HOST_SYSTEM_PROCESSOR on MacOS X always says i386 on Intel platform
-# So we do not trust ANDROID_NDK_HOST_X64 on Apple hosts
-if( NOT ANDROID_NDK_HOST_X64 AND NOT CMAKE_HOST_APPLE)
+if( NOT ANDROID_NDK_HOST_X64 )
  set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
 endif()

@@ -634,30 +643,27 @@

 macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
  foreach( __toolchain ${${__availableToolchainsLst}} )
-  # Skip renderscript folder. It's not C++ toolchain
-  if (NOT ${__toolchain} STREQUAL "renderscript")
-   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}" )
-   else()
-     set( __gcc_toolchain "${__toolchain}" )
+  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}" )
+  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 )
+    set( __arch "x86" )
+   elseif( __machine MATCHES arm )
+    set( __arch "arm" )
+   elseif( __machine MATCHES mipsel )
+    set( __arch "mipsel" )
    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 )
-     set( __arch "x86" )
-    elseif( __machine MATCHES arm )
-     set( __arch "arm" )
-    elseif( __machine MATCHES mipsel )
-     set( __arch "mipsel" )
-    endif()
-    list( APPEND __availableToolchainMachines "${__machine}" )
-    list( APPEND __availableToolchainArchs "${__arch}" )
-    list( APPEND __availableToolchainCompilerVersions "${__version}" )
-    list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
-   endif()
-   unset( __gcc_toolchain )
-  endif()
+   list( APPEND __availableToolchainMachines "${__machine}" )
+   list( APPEND __availableToolchainArchs "${__arch}" )
+   list( APPEND __availableToolchainCompilerVersions "${__version}" )
+   list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+  endif()
+  unset( __gcc_toolchain )
  endforeach()
 endmacro()

@@ -687,6 +693,7 @@
   endif()
   __LIST_FILTER( __availableToolchainsLst "^[.]" )
   __LIST_FILTER( __availableToolchainsLst "llvm" )
+  __LIST_FILTER( __availableToolchainsLst "renderscript" )
   __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
   if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
    __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
@@ -975,7 +982,11 @@
  set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )

  if( NOT ANDROID_STL STREQUAL "none" )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}" )
+  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/include/c++/${ANDROID_COMPILER_VERSION}" )
+  if( NOT EXISTS "${ANDROID_STL_INCLUDE_DIRS}" )
+   # old location ( pre r8c )
+   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}" )
+  endif()
   if( ARMEABI_V7A AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/bits" )
    list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}" )
   elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb/bits" )
@@ -1130,15 +1141,7 @@
 # case of shared STL linkage
 if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
  string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
- if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
-  get_filename_component( __libstlname "${__libstl}" NAME )
-  execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
-  if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
-   message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
-  endif()
-  unset( __fileCopyProcess )
-  unset( __libstlname )
- endif()
+ # TODO: check if .so file exists before the renaming
 endif()

@@ -1503,7 +1506,8 @@

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

 # detect if need link crtbegin_so.o explicitly
 if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
@@ -1554,6 +1558,18 @@
  endif()
  set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
 endif()
+
+# copy shaed stl library to build directory
+if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
+ get_filename_component( __libstlname "${__libstl}" NAME )
+ execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
+ if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
+  message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
+ endif()
+ unset( __fileCopyProcess )
+ unset( __libstlname )
+endif()
+

 # set these global flags for cmake client scripts to change behavior
 set( ANDROID True )
@@ -1663,6 +1679,19 @@
 endif()

+# force cmake to produce / instead of \ in build commands for Ninja generator
+if( CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_HOST_WIN32 )
+ # it is a bad hack after all
+ # CMake generates Ninja makefiles with UNIX paths only if it thinks that we are going to build with MinGW
+ set( CMAKE_COMPILER_IS_MINGW TRUE ) # tell CMake that we are MinGW
+ set( CMAKE_CROSSCOMPILING TRUE )    # stop recursion
+ enable_language( C )
+ enable_language( CXX )
+ # unset( CMAKE_COMPILER_IS_MINGW ) # can't unset because CMake does not convert back-slashes in response files without it
+ unset( MINGW )
+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 )
@@ -1717,7 +1746,7 @@
 #   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; set only for NDK
+#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d; set only for NDK
 #   ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform


Update FW: reduce ColorCamera still pool: 4 -> 1 frame

--- cmake/Depthai/DepthaiDeviceSideConfig.cmake
+++ cmake/Depthai/DepthaiDeviceSideConfig.cmake
@@ -2,7 +2,7 @@
 set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "fe17fa5db71454e10b9745ec70a2ce09f17f45d6")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "2d4eac697a1c0f12d07b82188378fb15d984a1b9")

 # "version if applicable"
 set(DEPTHAI_DEVICE_SIDE_VERSION "")


Install the tbb library when built with the builtin_tbb option.

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -1129,23 +1129,24 @@
       set(builtin_tbb ON CACHE BOOL "" FORCE)
     endif()
   endif()
-  if(builtin_tbb)
-    set(tbb_version 44_20160128)
-    ExternalProject_Add(
-      TBB
-      URL ${repository_tarfiles}/tbb${tbb_version}oss_src.tgz
-      INSTALL_DIR ${CMAKE_BINARY_DIR}
-      CONFIGURE_COMMAND ""
-      BUILD_COMMAND make CPLUS=${CMAKE_CXX_COMPILER} CONLY=${CMAKE_C_COMPILER}
-      INSTALL_COMMAND ${CMAKE_COMMAND} -Dinstall_dir=<INSTALL_DIR> -Dsource_dir=<SOURCE_DIR>
-                                       -P ${CMAKE_SOURCE_DIR}/cmake/scripts/InstallTBB.cmake
-      INSTALL_COMMAND ""
-      BUILD_IN_SOURCE 1
-      LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
-    )
-    set(TBB_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
-    set(TBB_LIBRARIES ${CMAKE_BINARY_DIR}/lib/libtbb${CMAKE_SHARED_LIBRARY_SUFFIX})
-  endif()
+endif()
+if(builtin_tbb)
+  set(tbb_version 44_20160128)
+  ExternalProject_Add(
+    TBB
+    URL ${repository_tarfiles}/tbb${tbb_version}oss_src.tgz
+    INSTALL_DIR ${CMAKE_BINARY_DIR}
+    CONFIGURE_COMMAND ""
+    BUILD_COMMAND make CPLUS=${CMAKE_CXX_COMPILER} CONLY=${CMAKE_C_COMPILER}
+    INSTALL_COMMAND ${CMAKE_COMMAND} -Dinstall_dir=<INSTALL_DIR> -Dsource_dir=<SOURCE_DIR>
+                                      -P ${CMAKE_SOURCE_DIR}/cmake/scripts/InstallTBB.cmake
+    INSTALL_COMMAND ""
+    BUILD_IN_SOURCE 1
+    LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
+  )
+  set(TBB_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
+  set(TBB_LIBRARIES ${CMAKE_BINARY_DIR}/lib/libtbb${CMAKE_SHARED_LIBRARY_SUFFIX})
+  install(FILES ${CMAKE_BINARY_DIR}/lib/libtbb${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
 endif()

 #---Check for OCC--------------------------------------------------------------------


SuperBuild: geotiff: try cmake build on all platforms

--- SuperBuild/CMake/External_geotiff.cmake
+++ SuperBuild/CMake/External_geotiff.cmake
@@ -26,49 +26,49 @@
 ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GEOTIFF TIFF PROJ JPEG ZLIB)

 set(GEOTIFF_SB_CONFIG)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_INCLUDE_DIR)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_LIBRARY)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_INCLUDE_DIR)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_LIBRARY)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_INCLUDE_DIR)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_LIBRARY)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_INCLUDE_DIR)
-ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_LIBRARY)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_INCLUDE_DIR)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_LIBRARY)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_INCLUDE_DIR)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_LIBRARY)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_INCLUDE_DIR)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_LIBRARY)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_INCLUDE_DIR)
+# ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_LIBRARY)

-#RK: we are forced to use autoconf on osx due to cmake's find_* functions
-#Do we need to use the same of Linux ?
-if(UNIX)
-  set(GEOTIFF_SB_CONFIG)
-  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF PROJ_ROOT     --with-proj)
-  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF TIFF_ROOT     --with-libtiff)
-  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF JPEG_ROOT     --with-jpeg)
-  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF ZLIB_ROOT     --with-libz)
+# #RK: we are forced to use autoconf on osx due to cmake's find_* functions
+# #Do we need to use the same of Linux ?
+# if(UNIX)
+#   set(GEOTIFF_SB_CONFIG)
+#   ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF PROJ_ROOT     --with-proj)
+#   ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF TIFF_ROOT     --with-libtiff)
+#   ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF JPEG_ROOT     --with-jpeg)
+#   ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF ZLIB_ROOT     --with-libz)

-  ExternalProject_Add(GEOTIFF
-    PREFIX GEOTIFF
-    URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.2.tar.gz"
-    URL_MD5 96ab80e0d4eff7820579957245d844f8
-    SOURCE_DIR ${GEOTIFF_SB_SRC}
-    BINARY_DIR ${GEOTIFF_SB_SRC}
-    INSTALL_DIR ${SB_INSTALL_PREFIX}
-    DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
-    DEPENDS ${GEOTIFF_DEPENDENCIES}
-    CONFIGURE_COMMAND
-    ${SB_ENV_CONFIGURE_CMD}
-    ${GEOTIFF_SB_SRC}/configure
-    ${SB_CONFIGURE_ARGS}
-    ${GEOTIFF_SB_CONFIG}
-    LOG_BUILD 1
-    LOG_INSTALL 1
-    )
+#   ExternalProject_Add(GEOTIFF
+#     PREFIX GEOTIFF
+#     URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.2.tar.gz"
+#     URL_MD5 96ab80e0d4eff7820579957245d844f8
+#     SOURCE_DIR ${GEOTIFF_SB_SRC}
+#     BINARY_DIR ${GEOTIFF_SB_SRC}
+#     INSTALL_DIR ${SB_INSTALL_PREFIX}
+#     DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
+#     DEPENDS ${GEOTIFF_DEPENDENCIES}
+#     CONFIGURE_COMMAND
+#     ${SB_ENV_CONFIGURE_CMD}
+#     ${GEOTIFF_SB_SRC}/configure
+#     ${SB_CONFIGURE_ARGS}
+#     ${GEOTIFF_SB_CONFIG}
+#     LOG_BUILD 1
+#     LOG_INSTALL 1
+#     )

-  # [LOG_CONFIGURE 1]           # Wrap configure in script to log output
-  # [LOG_BUILD 1]               # Wrap build in script to log output
-  # [LOG_TEST 1]                # Wrap test in script to log output
-  # [LOG_INSTALL 1]             # Wrap install in script to log output
-  SUPERBUILD_PATCH_SOURCE(GEOTIFF)
+#   # [LOG_CONFIGURE 1]           # Wrap configure in script to log output
+#   # [LOG_BUILD 1]               # Wrap build in script to log output
+#   # [LOG_TEST 1]                # Wrap test in script to log output
+#   # [LOG_INSTALL 1]             # Wrap install in script to log output
+#   SUPERBUILD_PATCH_SOURCE(GEOTIFF)

-else()
+# else()

   ExternalProject_Add(GEOTIFF
     PREFIX GEOTIFF
@@ -91,7 +91,7 @@
     LOG_INSTALL 1
     )

-endif()
+#endif()

 set(_SB_GEOTIFF_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
 if(WIN32)


Compile wasm contracts that are part of eosio source with -O3, like the eoscpp tool would

--- CMakeModules/wasm.cmake
+++ CMakeModules/wasm.cmake
@@ -91,7 +91,7 @@

     add_custom_command(OUTPUT ${outfile}.bc
       DEPENDS ${infile}
-      COMMAND ${WASM_CLANG} -emit-llvm -O0 --std=c++14 --target=wasm32 -ffreestanding
+      COMMAND ${WASM_CLANG} -emit-llvm -O3 --std=c++14 --target=wasm32 -ffreestanding
               -nostdlib -fno-threadsafe-statics -fno-rtti -fno-exceptions -I ${INCLUDE_FOLDERS}
               -c ${infile} -o ${outfile}.bc
       IMPLICIT_DEPENDS CXX ${infile}


ARROW-8689: [C++] Fix linking S3FS benchmarks

Closes #7094 from pitrou/ARROW-8689-s3fs-benchmark-failing

Authored-by: Antoine Pitrou <9359a4d812173b65a3a0094cd86363e79731a3c2@python.org>
Signed-off-by: Antoine Pitrou <9359a4d812173b65a3a0094cd86363e79731a3c2@python.org>

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -703,10 +703,12 @@

 # - Parquet requires boost only with gcc 4.8 (because of missing std::regex).
 # - Gandiva has a compile-time (header-only) dependency on Boost, not runtime.
-# - Tests and Flight benchmarks need Boost at runtime.
+# - Tests need Boost at runtime.
+# - S3FS and Flight benchmarks need Boost at runtime.
 if(ARROW_BUILD_INTEGRATION
    OR ARROW_BUILD_TESTS
    OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS)
+   OR (ARROW_S3 AND ARROW_BUILD_BENCHMARKS)
    OR ARROW_GANDIVA
    OR (ARROW_WITH_THRIFT AND Thrift_SOURCE STREQUAL "BUNDLED")
    OR (ARROW_PARQUET


Warn users of TestCPP11 if it runs multiple times (for each subproject).

--- TestCPP11.cmake
+++ TestCPP11.cmake
@@ -6,6 +6,11 @@
   return()
 endif()
 set(TESTS_CPP11_DONE ON)
+
+if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
+  message(WARNING "For better performance, include TestCPP11 in the top-level "
+    "project so that it is run only once.")
+endif()

 set(TESTS_CPP11 sharedptr tuple auto nullptr array final_override unordered_map
   template_alias)


set CPM0014 to not warn when adding a subdirectory without CMakeLists.txt

--- Shared/CMake/JamomaUtilFunctions.cmake
+++ Shared/CMake/JamomaUtilFunctions.cmake
@@ -56,6 +56,7 @@

 ## Add max externals recursively ##
 function(addExternals)
+	cmake_policy(SET CMP0014 OLD) # don't warn if folder doesn't contain a CMakeLists.txt file
 	SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
 	SET(IS_EXTERNAL 1)
 	FOREACH(subdir ${SUBDIRS})


Update JamomaUtilFunctions.cmake

Update JamomaUtilFunctions.cmake

--- Shared/CMake/JamomaUtilFunctions.cmake
+++ Shared/CMake/JamomaUtilFunctions.cmake
@@ -183,12 +183,12 @@
 	MARK_AS_ADVANCED (MaxAPI_LIB)
 	SET(MaxAPI_LIB ${MaxAPI_LIB})

-	FIND_LIBRARY(MaxAudio_LIB MaxAudio
+	FIND_LIBRARY(MaxAudio_LIB NAMES MaxAudio MaxAudioAPI
 				 PATH ${CMAKE_CURRENT_SOURCE_DIR}/../source/c74support/msp-includes/)
 	MARK_AS_ADVANCED (MaxAudio_LIB)
 	SET(MaxAudio_LIB ${MaxAudio_LIB})

-	FIND_LIBRARY(Jitter_LIB jitlib
+	FIND_LIBRARY(Jitter_LIB NAMES jitlib JitterAPI
 				 PATH ${CMAKE_CURRENT_SOURCE_DIR}/../source/c74support/jit-includes/)
 	MARK_AS_ADVANCED (Jitter_LIB)
 	SET(Jitter_LIB ${Jitter_LIB})


fixed: leftover variable w/ wrong prefix

--- cmake/HUGH_SUPPORT_SetupOptions.cmake
+++ cmake/HUGH_SUPPORT_SetupOptions.cmake
@@ -13,4 +13,4 @@
 include(CMakeAddons_SetupOptions)

 # tracing
-option(DCS08961_TRACE_ALL "Enable runtime function tracing for everything!" OFF)
+option(HUGH_TRACE_ALL "Enable runtime function tracing for everything!" OFF)


Remove -Werror when using check_cxx_compiler_flag because it was causing compiler-rt breakages.

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@243784 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/Modules/HandleLibcxxFlags.cmake
+++ cmake/Modules/HandleLibcxxFlags.cmake
@@ -96,7 +96,7 @@
 macro(add_compile_flags_if_supported)
   foreach(flag ${ARGN})
       mangle_name("${flag}" flagname)
-      check_cxx_compiler_flag("-Werror ${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
+      check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
       add_compile_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
   endforeach()
 endmacro()


fixed cmake policy CMP0022:

fixed cmake policy CMP0022:

either use all-plain or all-keyword style of target_link_libraries

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -215,7 +215,7 @@
     foreach(lib ${ARGN})
       add_space_separated_property(TARGET ${lib} COMPILE_FLAGS --coverage)
       add_space_separated_property(TARGET ${lib} LINK_FLAGS --coverage)
-      target_link_libraries(${lib} gcov)
+      target_link_libraries(${lib} LINK_PRIVATE gcov)
     endforeach(lib)
   endif (USE_GCOV)
 endfunction(maybe_add_gcov_to_libraries)


Use PATCH_COMMAND for tensorflow patching

--- tensorflow_cc/cmake/TensorflowShared.cmake
+++ tensorflow_cc/cmake/TensorflowShared.cmake
@@ -10,12 +10,12 @@
   BUILD_IN_SOURCE 1
   DOWNLOAD_COMMAND ""
   UPDATE_COMMAND ""
-            # The grpc integrated in v1.15.0 needs patching, see https://github.com/clearlinux/distribution/issues/1151.
-  CONFIGURE_COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-Rename-gettid-functions.patch" .
-            COMMAND git apply v1.15.0-Rename-gettid-functions.patch
-            COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-workspace.bzl.patch" .
-            COMMAND git apply v1.15.0-workspace.bzl.patch
-            COMMAND tensorflow/contrib/makefile/compile_linux_protobuf.sh
+  # The grpc integrated in v1.15.0 needs patching, see https://github.com/clearlinux/distribution/issues/1151.
+  PATCH_COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-Rename-gettid-functions.patch" .
+        COMMAND git apply v1.15.0-Rename-gettid-functions.patch
+        COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-workspace.bzl.patch" .
+        COMMAND git apply v1.15.0-workspace.bzl.patch
+  CONFIGURE_COMMAND tensorflow/contrib/makefile/compile_linux_protobuf.sh
             # Do not fail on warnings when building nsync
             COMMAND sed -i "s/ -Werror//g" tensorflow/contrib/makefile/compile_nsync.sh
             COMMAND tensorflow/contrib/makefile/compile_nsync.sh


Update vtk 5.10 to latest patch, was not compiling anymore on Mac OS 10.9

--- cmake/externals/projects_modules/VTK.cmake
+++ cmake/externals/projects_modules/VTK.cmake
@@ -50,7 +50,7 @@
 ## #############################################################################

 # Set GIT_TAG to latest commit of origin/release-5.10 known to work
-set(tag d3b66526624ba8e55addcddb0ec28c40982473ac)
+set(tag ed00ef1c94964bfdd4e0a4097311154758bbe083)
 if (NOT DEFINED ${ep}_SOURCE_DIR)
     set(location GIT_REPOSITORY "git://vtk.org/VTK.git" GIT_TAG ${tag})
 endif()


Fix for SALOME_CONFIGURE_PREPARE() macros: correction of the previous integration

--- salome_adm/cmake_files/SalomeMacros.cmake
+++ salome_adm/cmake_files/SalomeMacros.cmake
@@ -851,7 +851,7 @@
   IF(NOT _list_len EQUAL 0)
     SET(${result} "${${result}};${_tmp_res}")  # LIST(APPEND ...) doesn't handle well empty elements!?
   ELSE()
-    SET(${result} "${_tmp_res}")               # to avoid first excess ; at the beginning of the list
+    SET(${result} "${_tmp_res}")               # to avoid first redundant ; at the beginning of the list
   ENDIF()
 ENDMACRO(SALOME_APPEND_LIST_OF_LIST)

@@ -879,9 +879,7 @@
     IF(${_prereq}_DIR)
       SET(_PREREQ_LIST "${_PREREQ_LIST} ${_prereq}")
       SET(_PREREQ_DIR_LIST "${_PREREQ_DIR_LIST} \"${${_prereq}_DIR}\"")
-      MESSAGE(STATUS "before _PREREQ_COMPO_LIST=${_PREREQ_COMPO_LIST}")
       SALOME_APPEND_LIST_OF_LIST(_PREREQ_COMPO_LIST Salome${_prereq}_COMPONENTS)
-      MESSAGE(STATUS "after _PREREQ_COMPO_LIST=${_PREREQ_COMPO_LIST}")
     ENDIF()
   ENDFOREACH()
 ENDMACRO(SALOME_CONFIGURE_PREPARE)


emscripten: set initial memory size to 32MB

--- cmake-toolchains/emscripten.toolchain.cmake
+++ cmake-toolchains/emscripten.toolchain.cmake
@@ -30,7 +30,7 @@
 option(FIPS_EMSCRIPTEN_DEMANGLE "compile with libcxxabi-provided demangling support" OFF)
 option(FIPS_EMSCRIPTEN_USE_FETCH "use fetch API" OFF)
 option(FIPS_EMSCRIPTEN_USE_MINIMAL_RUNTIME "use the minimal JS runtime" OFF)
-set(FIPS_EMSCRIPTEN_TOTAL_MEMORY 8388608 CACHE STRING "initial heap size in bytes")
+set(FIPS_EMSCRIPTEN_TOTAL_MEMORY 33554432 CACHE STRING "initial heap size in bytes")
 set(FIPS_EMSCRIPTEN_LTO_LEVEL 1 CACHE STRING "link-time-optimization level (0..3)")
 set(FIPS_EMSCRIPTEN_MEM_INIT_METHOD 1 CACHE STRING "how to represent initial memory content (0..2)")
 set(FIPS_EMSCRIPTEN_SHELL_HTML "shell.html" CACHE STRING "path to shell html file")


USB bootloader with support for missing 24MHz USB osc (OAK-D Pro-PoE initial flashing)

--- cmake/Depthai/DepthaiBootloaderConfig.cmake
+++ cmake/Depthai/DepthaiBootloaderConfig.cmake
@@ -1,7 +1,7 @@
 # Maturity level "snapshot" / "release"
-set(DEPTHAI_BOOTLOADER_MATURITY "release")
-#set(DEPTHAI_BOOTLOADER_MATURITY "snapshot")
+#set(DEPTHAI_BOOTLOADER_MATURITY "release")
+set(DEPTHAI_BOOTLOADER_MATURITY "snapshot")

 # "version if applicable"
-set(DEPTHAI_BOOTLOADER_VERSION "0.0.15")
-#set(DEPTHAI_BOOTLOADER_VERSION "870bec4ca0ef026ddb9c490a38dfe9d097614554")
+#set(DEPTHAI_BOOTLOADER_VERSION "0.0.15")
+set(DEPTHAI_BOOTLOADER_VERSION "bb9e4c86ce3c22da0aeb92dc18c8b28458bed4af")


Update FW: initial support for LUX-D-LITE: IMX214 and OV7251

--- cmake/Depthai/DepthaiDeviceSideConfig.cmake
+++ cmake/Depthai/DepthaiDeviceSideConfig.cmake
@@ -2,7 +2,7 @@
 set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "d2b298e834f3cf746071059e2c1e1c4d37b724af")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "459203870e45507d1eaabe31766a7a42d0b616bb")

 # "version if applicable"
 set(DEPTHAI_DEVICE_SIDE_VERSION "")


set correct checksum for openui5 package

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -1579,7 +1579,7 @@
 ExternalProject_Add(
    OPENUI5
    URL ${CMAKE_SOURCE_DIR}/net/http/openui5/openui5.tar.gz
-   URL_HASH SHA256=32e50e3e8808295c67ecb7561ea9cd9beb76dd934263170fbbd05ff59b6d501d
+   URL_HASH SHA256=cbe503155fb5fc563c9dce02f4b5bf2163963b3bf118dd20756aa05d0a8693a3
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""


Revert "Follow style of current externals for Vc"

This reverts commit 3010e26e2763193ead22ab49958649e2c74faffa.

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -1273,12 +1273,13 @@
   set(Vc_PROJECT "Vc-${Vc_VERSION}")
   set(Vc_SRC_URI "${lcgpackages}/${Vc_PROJECT}.tar.gz")
   set(Vc_SRC_MD5 "a248e904f0b1a330ad8f37ec50cbad30")
-  set(Vc_DESTDIR "${CMAKE_BINARY_DIR}/${Vc_PROJECT}")
+  set(Vc_DESTDIR "${CMAKE_BINARY_DIR}/externals/install/${Vc_PROJECT}")
   set(Vc_ROOTDIR "${Vc_DESTDIR}/${CMAKE_INSTALL_PREFIX}")
   set(Vc_LIBNAME "${CMAKE_STATIC_LIBRARY_PREFIX}Vc${CMAKE_STATIC_LIBRARY_SUFFIX}")
   set(Vc_LIBRARY "${Vc_ROOTDIR}/${_LIBDIR_DEFAULT}/${Vc_LIBNAME}")

   ExternalProject_Add(${Vc_PROJECT}
+    PREFIX externals
     URL     ${Vc_SRC_URI}
     URL_MD5 ${Vc_SRC_MD5}
     BUILD_IN_SOURCE 0


fixed test

fixed test

--- tests/invoke_cmake.cmake
+++ tests/invoke_cmake.cmake
@@ -4,11 +4,8 @@
   cmake(--help-command string --result)
   ans(res)

-  json_print(${res})
+  map_tryget(${res} result)
+  ans(error)

-
-
-  message("res ${res}")
-
-  assert("${res}" MATCHES "String operations.")
+  assert(NOT error)
 endfunction()


Ensure cmake config storage produces a valid command line.

- Quote the generator since it's almost always more than one word.
- Include AOM_TARGET_CPU when autodetected, and omit it in favor
  of including the toolchain file when a toolchain file is
  specified.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: If0ba115074b96c93fc93c97747d8f60e919bf6f7

--- build/cmake/aom_configure.cmake
+++ build/cmake/aom_configure.cmake
@@ -17,7 +17,6 @@
 # aom_config_defaults.cmake (because it turns every config variable into a cache
 # variable with its own help string).
 get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
-
 foreach(cache_var ${cmake_cache_vars})
   get_property(cache_var_helpstring CACHE ${cache_var} PROPERTY HELPSTRING)
   set(cmdline_helpstring  "No help, variable specified on the command line.")
@@ -25,6 +24,7 @@
     set(AOM_CMAKE_CONFIG "${AOM_CMAKE_CONFIG} -D${cache_var}=${${cache_var}}")
   endif ()
 endforeach()
+string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)

 include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
 include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
@@ -51,10 +51,16 @@
   endif ()
 endif ()

-# Add generator and target to the config string.
+if (CMAKE_TOOLCHAIN_FILE)
+  # Add toolchain file to config string.
+  set(toolchain_string "-DCMAKE_TOOLCHAIN_FILE=\\\"${CMAKE_TOOLCHAIN_FILE}\\\"")
+  set(AOM_CMAKE_CONFIG "${toolchain_string} ${AOM_CMAKE_CONFIG}")
+else ()
+  # Add detected CPU to the config string.
+  set(AOM_CMAKE_CONFIG "-DAOM_TARGET_CPU=${AOM_TARGET_CPU} ${AOM_CMAKE_CONFIG}")
+endif ()
+set(AOM_CMAKE_CONFIG "-G \\\"${CMAKE_GENERATOR}\\\" ${AOM_CMAKE_CONFIG}")
 string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)
-set(AOM_CMAKE_CONFIG "CMAKE_GENERATOR=${CMAKE_GENERATOR} ${AOM_CMAKE_CONFIG}")
-set(AOM_CMAKE_CONFIG "AOM_TARGET_CPU=${AOM_TARGET_CPU} ${AOM_CMAKE_CONFIG}")

 message("--- aom_configure: Detected CPU: ${AOM_TARGET_CPU}")
 set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME})


Porting to ParaView 4.1: udpated list of required VTK modules in FindSalomeVTK module.

--- salome_adm/cmake_files/FindSalomeVTK.cmake
+++ salome_adm/cmake_files/FindSalomeVTK.cmake
@@ -31,8 +31,8 @@
   vtkRenderingAnnotation
   vtkFiltersParallel
   vtkIOExport
-  #vtkWrappingPythonCore  ## ParaView 4.0.1
-  vtkWrappingPython
+  vtkWrappingPythonCore  ## ParaView 4.0.1
+  #vtkWrappingPython
   vtkIOXML
   vtkFiltersVerdict
   vtkRenderingLabel


ARROW-4191: [C++] Use same CC and AR for jemalloc as for the main sources

Author: Korn, Uwe <Uwe.Korn@blue-yonder.com>

Closes #3347 from xhochy/ARROW-4191 and squashes the following commits:

44df02a23 <Korn, Uwe> ARROW-4191:  Use same CC and AR for jemalloc as for the main sources

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -772,7 +772,7 @@
   ExternalProject_Add(jemalloc_ep
     URL ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jemalloc/${JEMALLOC_VERSION}.tar.gz
     PATCH_COMMAND touch doc/jemalloc.3 doc/jemalloc.html
-    CONFIGURE_COMMAND ./autogen.sh "--prefix=${JEMALLOC_PREFIX}" "--with-jemalloc-prefix=je_arrow_" "--with-private-namespace=je_arrow_private_" "--disable-tls"
+    CONFIGURE_COMMAND ./autogen.sh "AR=${CMAKE_AR}" "CC=${CMAKE_C_COMPILER}" "--prefix=${JEMALLOC_PREFIX}" "--with-jemalloc-prefix=je_arrow_" "--with-private-namespace=je_arrow_private_" "--disable-tls"
     ${EP_LOG_OPTIONS}
     BUILD_IN_SOURCE 1
     BUILD_COMMAND ${MAKE} ${MAKE_BUILD_ARGS}


SVN failure is no longer fatal.

SVN failure is no longer fatal.

--- CPM.cmake
+++ CPM.cmake
@@ -1002,7 +1002,8 @@
   if (result)
     set(msg "Command failed: ${result}\n")
     set(msg "${msg} '${cmd}'")
-    message(FATAL_ERROR "${msg}")
+    set(msg "Skipping SVN update.")
+    message("${msg}")
   endif()
 endmacro()


only create custom targets when they don't exist already (use case add_subdirectory)

--- builds/cmake/Modules/ClangFormat.cmake
+++ builds/cmake/Modules/ClangFormat.cmake
@@ -18,10 +18,13 @@
   set(CLANG_FORMAT "clang-format")
 endif()

-add_custom_target(
+# only create custom targets if they don't exist already (add_subdirectory)
+if (NOT TARGET clang-format)
+    add_custom_target(
         clang-format
         COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
-)
+    )
+endif()

 function(JOIN VALUES GLUE OUTPUT)
   string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
@@ -30,23 +33,30 @@

 configure_file(builds/cmake/clang-format-check.sh.in clang-format-check.sh @ONLY)

-add_custom_target(
+if (NOT TARGET clang-format-check)
+    add_custom_target(
         clang-format-check
         COMMAND chmod +x clang-format-check.sh
         COMMAND ./clang-format-check.sh
         COMMENT "Checking correct formatting according to .clang-format file using ${CLANG_FORMAT}"
-)
+    )
+endif()

-add_custom_target(
+if (NOT TARGET clang-format-check-CI)
+    add_custom_target(
         clang-format-check-CI
         COMMAND chmod +x clang-format-check.sh
         COMMAND ./clang-format-check.sh --CI
         COMMENT "Checking correct formatting according to .clang-format file using ${CLANG_FORMAT}"
-)
+    )
+endif()

-add_custom_target(
+if (NOT TARGET clang-format-diff)
+    add_custom_target(
         clang-format-diff
         COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
         COMMAND git diff ${ALL_SOURCE_FILES}
         COMMENT "Formatting with clang-format (using ${CLANG_FORMAT}) and showing differences with latest commit"
-)
+    )
+endif()
+


CMake: Disable CUDA for incompatible C++ standards

--- cmake/configure/configure_1_cuda.cmake
+++ cmake/configure/configure_1_cuda.cmake
@@ -44,6 +44,29 @@
         "Reconfigure with a sufficient cmake version."
         )
     ENDIF()
+
+    #
+    # CUDA 8.0 requires C++11 support, CUDA 9.0 requires C++14 support.
+    # Make sure that deal.II is configured appropriately
+    #
+    MACRO(_cuda_ensure_feature_off _version _feature)
+      IF(${CUDA_VERSION_MAJOR} EQUAL ${_version})
+        IF(${_feature})
+          SET(${var} FALSE)
+          MESSAGE(STATUS "CUDA ${_version} requires ${_feature} to be set to off.")
+          SET(CUDA_ADDITIONAL_ERROR_STRING
+            ${CUDA_ADDITIONAL_ERROR_STRING}
+            "CUDA ${_version} is not compatible with the C++ standard\n"
+            "enabled by ${_feature}.\n"
+            "Please disable ${_feature}, e.g. by reconfiguring with\n"
+            "  cmake -D${_feature}=OFF ."
+            )
+        ENDIF()
+      ENDIF()
+    ENDMACRO()
+    _cuda_ensure_feature_off(8 DEAL_II_WITH_CXX14)
+    _cuda_ensure_feature_off(9 DEAL_II_WITH_CXX17)
+

     IF("${DEAL_II_CUDA_FLAGS_SAVED}" MATCHES "-arch[ ]*sm_([0-9]*)")
       SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}")


SVN_SILENT made messages (.desktop file)

--- plugins/gabble/ktpaccountskcm_plugin_gabble.desktop.cmake
+++ plugins/gabble/ktpaccountskcm_plugin_gabble.desktop.cmake
@@ -12,7 +12,7 @@
 Comment[et]=Gabble'i ühendusehaldurit kasutavate kontode kohandatud konto seadistamise kasutajaliides
 Comment[fi]=Gabble-yhteyshallintaa käyttävien tilien mukautettu hallintakäyttöliittymä.
 Comment[fr]=Interface utilisateur personnalisée pour la configuration de comptes en utilisant le gestionnaire de connexions « Gabble ».
-Comment[gl]=Interface de usuario de configuración personalizada da conta para contas que empreguen o xestor de conexións Gabble.
+Comment[gl]=Interface de usuario de configuración personalizada de contas que empreguen o xestor de conexións Gabble.
 Comment[hu]=Egyedi beállítófelület a Gabble kapcsolatkezelőt használó azonosítókhoz.
 Comment[ia]=Interfacie de usator pro configuration de conto personalisate pro contos usante le gerente de connexion Gabble.
 Comment[it]=Interfaccia utente personalizzata di configurazione account per account che usano il gestore di connessioni Gabble.


[Apple Clang] Expose llvm-config from stage2 builds in stage1

This exposes the stage2-llvm-config target though the stage1 build configuration.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@264125 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/caches/Apple-stage1.cmake
+++ cmake/caches/Apple-stage1.cmake
@@ -37,6 +37,7 @@
   check-all
   check-llvm
   check-clang
+  llvm-config
   test-suite
   test-depends
   llvm-test-depends


fixed duplicate python installation by catkin_python_setup() and generate_messages()

--- cmake/catkin_python_setup.cmake
+++ cmake/catkin_python_setup.cmake
@@ -3,6 +3,12 @@
   check_unused_arguments("catkin_python_setup" "${ARGN}")

   assert(PROJECT_NAME)
+
+  # mark that catkin_python_setup() was called in order to disable installation of gen/py stuff in generate_messages()
+  set(${PROJECT_NAME}_CATKIN_PYTHON_SETUP TRUE PARENT_SCOPE)
+  if(${PROJECT_NAME}_GENERATE_MESSAGES)
+    message(FATAL_ERROR "generate_messages() must be called after catkin_python_setup() in project ${PROJECT_NAME}")
+  endif()

   # Use PROJECT_NAME as pkg_name
   set(pkg_name ${PROJECT_NAME})
@@ -36,7 +42,6 @@
     configure_file(${catkin_EXTRAS_DIR}/templates/safe_execute_install.cmake.in
       ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/safe_execute_install.cmake)

-    install(CODE "message(COMMAND = ${CMD})")
     install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/safe_execute_install.cmake)

     stamp(${${pkg_name}_SOURCE_DIR}/${SETUP_PY_FILE})


Added C++20 standard as build option

Added C++20 standard as build option

Added:
 - added 'C++20' as possible CMAKE_CXX_STANDARD

Changed:
 - extracted string representations of CPP_STANDARD to variables

--- cmake/common/cpp-standard.cmake
+++ cmake/common/cpp-standard.cmake
@@ -1,25 +1,33 @@
 include_guard()
+
+set(CPP_98_STR "C++98")
+set(CPP_11_STR "C++11")
+set(CPP_14_STR "C++14")
+set(CPP_17_STR "C++17")
+set(CPP_20_STR "C++20")

 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)

-set(CPP_STANDARD "C++14" CACHE STRING
-    "C++ standard, choose from C++98, C++11, C++14 and C++17." FORCE
+set(CPP_STANDARD "${CPP_17_STR}" CACHE STRING
+    "C++ standard, choose from ${CPP_98_STR}, ${CPP_11_STR}, ${CPP_14_STR}, ${CPP_17_STR} and ${CPP_20_STR}" FORCE
 )
 set_property(CACHE CPP_STANDARD PROPERTY STRINGS
-    "C++98" "C++11" "C++14" "C++17"
+    ${CPP_98_STR} ${CPP_11_STR} ${CPP_14_STR} ${CPP_17_STR} ${CPP_20_STR}
 )

-if(CPP_STANDARD STREQUAL "C++98")
+if(CPP_STANDARD STREQUAL ${CPP_98_STR})
     set(CMAKE_CXX_STANDARD 98)
-elseif(CPP_STANDARD STREQUAL "C++11")
+elseif(CPP_STANDARD STREQUAL ${CPP_11_STR})
     set(CMAKE_CXX_STANDARD 11)
-elseif(CPP_STANDARD STREQUAL "C++14")
+elseif(CPP_STANDARD STREQUAL ${CPP_14_STR})
     set(CMAKE_CXX_STANDARD 14)
-elseif(CPP_STANDARD STREQUAL "C++17")
+elseif(CPP_STANDARD STREQUAL ${CPP_17_STR})
     set(CMAKE_CXX_STANDARD 17)
+elseif(CPP_STANDARD STREQUAL ${CPP_20_STR})
+    set(CMAKE_CXX_STANDARD 20)
 else()
-    message(FATAL_ERROR "Wrong C++ Standard. Choose from C++98, C++11, C++14 and C++17")
+    message(FATAL_ERROR "Wrong C++ Standard. Choose from ${CPP_98_STR}, ${CPP_11_STR}, ${CPP_14_STR}, ${CPP_17_STR} and ${CPP_20_STR}")
 endif()

 message(STATUS "C++ standard is set to: ${CPP_STANDARD}")


Added libraries path to search dir.

Added libraries path to search dir.

--- cmake/modules/FindArduino.cmake
+++ cmake/modules/FindArduino.cmake
@@ -317,7 +317,7 @@
                 get_property(LIBRARY_SEARCH_PATH
                              DIRECTORY     # Property Scope
                              PROPERTY LINK_DIRECTORIES)
-                foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
+						 foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
                     if(EXISTS ${LIB_SEARCH_PATH}/${INCLUDE_NAME}/${CMAKE_MATCH_1})
                         list(APPEND ARDUINO_LIBS ${LIB_SEARCH_PATH}/${INCLUDE_NAME})
                         break()


From Pere:
fix for finding Bonjour/Avahi libs, fixes issue 90397.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@42637 27541ba8-7e3a-0410-8455-c3a389f83636

--- cmake/modules/FindBonjour.cmake
+++ cmake/modules/FindBonjour.cmake
@@ -18,7 +18,7 @@
     PATHS /opt/dnssd/include /usr/include  /usr/local/include
   )
   find_library(BONJOUR_LIBRARY
-    NAMES libdns_sd
+    NAMES dns_sd
     PATHS /opt/dnssd/lib /usr/lib /usr/local/lib
   )
   if(NOT BONJOUR_INCLUDE_DIR OR NOT BONJOUR_LIBRARY)
@@ -43,7 +43,7 @@
   # layer, also the other libraries must be in the same location.
   foreach(l client common core)
     find_library(AVAHI_${l}_LIBRARY
-      NAMES libavahi-${l}.so
+      NAMES avahi-${l}.so
       PATHS /opt/lib /usr/lib /usr/local/lib
     )
     if(AVAHI_${l}_LIBRARY)


Implement USE_INCRTCL_VERSION_4 option which allows users to express a
preference for version 4 of itcl and friends of both version 3 and
version 4 are available.  This option is OFF by default (i.e., the
default preference is version 3 of itcl and friends when both version
3 and 4 are available).

svn path=/trunk/; revision=12664

--- cmake/modules/tcl-related.cmake
+++ cmake/modules/tcl-related.cmake
@@ -31,6 +31,8 @@
   option(ENABLE_tk "Enable Tk interface code" ON)
   option(ENABLE_itk "Enable incr TK interface code" ON)
 endif(DEFAULT_NO_BINDINGS)
+
+option(USE_INCRTCL_VERSION_4 "Use [incr Tcl] version 4" OFF)

 # Depending on these above options and system resources may also determine
 # the following variables which are largely self-explanatory unless documented
@@ -94,7 +96,10 @@
           message(STATUS "Looking for itcl.h - found")
           message(STATUS "Looking for itcl library")
           get_filename_component(TCL_LIBRARY_PATH ${TCL_LIBRARY} PATH)
-          set(itcl_library_versions 4.0.0 3.4 3.3 3.2 3.1 3.0 2.1 2.0)
+          set(itcl_library_versions 3.4 3.3 3.2 3.1 3.0 2.1 2.0)
+	  if(USE_INCRTCL_VERSION_4)
+	    set(itcl_library_versions 4.0.0 ${itcl_library_versions})
+	  endif(USE_INCRTCL_VERSION_4)
           foreach(version ${itcl_library_versions})
             find_library(ITCL_LIBRARY itcl${version} PATHS ${TCL_LIBRARY_PATH}
               PATH_SUFFIXES itcl${version})
@@ -161,7 +166,10 @@
       if(ITK_INCLUDE_PATH)
         message(STATUS "Looking for itk.h - found")
         message(STATUS "Looking for itk library")
-        set(itk_library_versions 4.0.0 3.4 3.3 3.2 3.1 3.0 2.1 2.0)
+        set(itk_library_versions 3.4 3.3 3.2 3.1 3.0 2.1 2.0)
+	if(USE_INCRTCL_VERSION_4)
+	  set(itk_library_versions 4.0.0 ${itk_library_versions})
+	endif(USE_INCRTCL_VERSION_4)
         foreach(version ${itk_library_versions})
           find_library(ITK_LIBRARY itk${version} PATHS ${TCL_LIBRARY_PATH}
             PATH_SUFFIXES itk${version})


Simplify access to cython includes

Simplify access to cython includes

--- scripts/PythonModule.cmake
+++ scripts/PythonModule.cmake
@@ -244,10 +244,7 @@
     string(REGEX REPLACE "/" "_" cy "cy.${module}")
     cmake_parse_arguments(${cy} "CPP" "TARGET;STARTLINE" "" ${ARGN})
     # Creates command-line arguments for cython for include directories
-    get_property(included_dirs
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        PROPERTY INCLUDE_DIRECTORIES
-    )
+    get_property(included_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
     set(inclusion)
     foreach(included ${included_dirs})
         set(inclusion ${inclusion} -I${included})


SK:

SK:

-ENH: streamlined my own dashboard submission system

--- src/Testing/Dashboard/elxDashboard_BIGR_linux64_gcc.cmake
+++ src/Testing/Dashboard/elxDashboard_BIGR_linux64_gcc.cmake
@@ -22,7 +22,7 @@
 #set( CTEST_BUILD_FLAGS "-j2" ) # parallel build for makefiles
 set( CTEST_BUILD_CONFIGURATION Release )
 set( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
-set( CTEST_DASHBOARD_ROOT "/home/sklein/tk/elastix/nightlybuild" )
+set( CTEST_DASHBOARD_ROOT "/home/sklein/tk/mydash/${CTEST_SCRIPT_NAME}" )

 # default: automatically determined
 #set(CTEST_UPDATE_COMMAND /path/to/svn)


Match cmake --ldflags output to autotools

--- tools/geos-config.cmake
+++ tools/geos-config.cmake
@@ -59,7 +59,7 @@
       echo -L@CMAKE_INSTALL_PREFIX@/lib -lgeos -lm
       ;;
     --ldflags)
-      echo -L@CMAKE_INSTALL_PREFIX@/lib -lgeos
+      echo -L@CMAKE_INSTALL_PREFIX@/lib
       ;;
     --includes)
       echo @CMAKE_INSTALL_PREFIX@/include


[Build] Generalised the module_python_add CMake macro to any type of scripts (Shell, Python, Perl, Ruby, etc).

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -1483,8 +1483,15 @@
 endmacro (module_binary_add)

 ##
-# Add a Python script to be installed
-macro (module_python_add _script_file)
+# Add a (Shell, Python, Perl, Ruby, etc) script to be installed.
+#
+# The parameter is the relative file path of the (template) script to
+# be installed. That template file must end with the '.in' suffix.
+# Indeed, the project variables (wrapped by @@ signs) of the template file
+# are evaluated and expanded thanks to the configure command.
+# The '.in' extension of the script is dropped once installed.
+#
+macro (module_script_add _script_file)
   #
   set (_full_script_src_path ${CMAKE_CURRENT_SOURCE_DIR}/${_script_file}.in)
   set (_full_script_path ${CMAKE_CURRENT_BINARY_DIR}/${_script_file})
@@ -1492,11 +1499,14 @@
 	#
     configure_file (${_full_script_src_path} ${_full_script_path} @ONLY)

-    # Add the 'scripts_${MODULE_NAME}' target, depending on the
-    # converted (Python) scripts
-    add_custom_target (scripts_${MODULE_NAME} ALL DEPENDS ${_full_script_path})
-
-    # Install the (Python) script file
+	# Extract the file name (only) from the full file path
+	get_filename_component (_script_alone ${_script_file} NAME)
+
+	# Add the 'scripts_${MODULE_NAME}' target, depending on the
+    # converted (Shell, Python, Perl, Ruby, etc) scripts
+    add_custom_target (${_script_alone}_script ALL DEPENDS ${_full_script_path})
+
+    # Install the (Shell, Python, Perl, Ruby, etc) script file
     install (PROGRAMS ${_full_script_path} DESTINATION bin COMPONENT devel)

   else (EXISTS ${_full_script_src_path})
@@ -1505,7 +1515,6 @@
   endif (EXISTS ${_full_script_src_path})

   # Register the binary target in the project (for reporting purpose)
-  get_filename_component (_script_alone ${_script_file} NAME)
   list (APPEND PROJ_ALL_BIN_TARGETS ${_script_alone})
   set (PROJ_ALL_BIN_TARGETS ${PROJ_ALL_BIN_TARGETS} PARENT_SCOPE)

@@ -1514,7 +1523,7 @@
   list (APPEND ${MODULE_NAME}_ALL_EXECS ${_script_alone})
   set (${MODULE_NAME}_ALL_EXECS ${${MODULE_NAME}_ALL_EXECS} PARENT_SCOPE)

-endmacro (module_python_add)
+endmacro (module_script_add)

 ##
 # Installation of the CMake import helper, so that third party projects


Fix $MACOSX_DEPLOYMENT_TARGET (#3337)

Fix $MACOSX_DEPLOYMENT_TARGET (#3337)

--- cmake/Modules/ThirdpartyToolchain.cmake
+++ cmake/Modules/ThirdpartyToolchain.cmake
@@ -125,9 +125,18 @@

     if (APPLE)
       # Since 10.14, the XCode toolchain only accepts libc++ as the
-      # standard library. This should also work on macOS starting from 10.9.
-      set(pyarrow_ENV ${pyarrow_ENV} "CXXFLAGS='-stdlib=libc++'")
-      set(pyarrow_ENV ${pyarrow_ENV} "MACOSX_DEPLOYMENT_TARGET=10.7")
+      # standard library. We set it only on 10.14, because on some
+      # configurations of older macOS, we get the following error
+      # with libc++:
+      # [...]/usr/bin/c++ '-stdlib=libc++'  -isysroot [...] -mmacosx-version-min=10.6 [...]
+      # clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
+
+      exec_program(uname ARGS -v  OUTPUT_VARIABLE DARWIN_VERSION)
+      string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
+      message(STATUS "-- Darwin version = ${DARWIN_VERSION}")
+      if (DARWIN_VERSION GREATER 17)
+        set(pyarrow_ENV ${pyarrow_ENV} "CXXFLAGS='-stdlib=libc++'")
+      endif()
     endif()

     ExternalProject_Add(pyarrow_ext


Remove coverage from default build options

--- cmake_scripts/default_build_setup.cmake
+++ cmake_scripts/default_build_setup.cmake
@@ -26,7 +26,7 @@
 if (UNIX)
     # flags apply for both Linux and OSX!
     set(CMAKE_CXX_FLAGS "-Wall -Wextra")
-    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -pedantic -fprofile-arcs -ftest-coverage")
+    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -pedantic")
     set(CMAKE_CXX_FLAGS_RELEASE "-O3 -pedantic")

     if (BUILD_COVERAGE)


COMP: added zlib dependency to dcmtk

COMP: added zlib dependency to dcmtk

Tihs was probably provided by GDCM before.

--- CMake/PackageDepends/MITK_DCMTK_Config.cmake
+++ CMake/PackageDepends/MITK_DCMTK_Config.cmake
@@ -15,7 +15,7 @@
 ENDIF(NOT DCMTK_FOUND)

 IF( NOT WIN32 )
-  SET(MISSING_LIBS_REQUIRED_BY_DCMTK wrap tiff)
+  SET(MISSING_LIBS_REQUIRED_BY_DCMTK wrap tiff z)
 ENDIF( NOT WIN32 )

 SET(QT_USE_QTSQL 1)


DIRECTORY -> PATH in CMake get_filename_component()

--- scripts/buildBitcode.cmake
+++ scripts/buildBitcode.cmake
@@ -39,7 +39,7 @@
       	   f_temp_object ${f_temp_object})

   # In case that the corresponding directory of binary_dir does not exist.
-  get_filename_component(f_temp_object_dir ${f_temp_object} DIRECTORY)
+  get_filename_component(f_temp_object_dir ${f_temp_object} PATH)
   if(NOT EXISTS ${f_temp_object_dir})
      file(MAKE_DIRECTORY ${f_temp_object_dir})
   endif()


Bugfix: FindDirectX11 would fail to detect old DX SDK June 2010 + MSVC 2008 + Windows 8. Other combinations may also not be working.

--- CMake/Packages/FindDirectX11.cmake
+++ CMake/Packages/FindDirectX11.cmake
@@ -31,7 +31,7 @@
 			set(DirectX11_LIBRARY d3d11.lib dxgi.lib dxguid.lib) # in "C:/Program Files (x86)/Windows Phone Kits/8.0/lib/${MSVC_CXX_ARCHITECTURE_ID}/"

 		endif()
-	else(WINDOWS_PHONE)
+	else()
 		# Windows 10.x SDK
 		if(CMAKE_CL_64)
 			set(DirectX11_LIBPATH_SUFFIX "x64")
@@ -65,82 +65,80 @@
 			find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS "C:/Program Files (x86)/Windows Kits/8.0/include/um" "C:/Program Files/Windows Kits/8.0/include/um")
 			set(DirectX11_LIBRARY d3d11.lib dxgi.lib dxguid.lib) # in "C:/Program Files (x86)/Windows Kits/8.0/lib/win8/um/${MSVC_CXX_ARCHITECTURE_ID}/"
 		endif()
-	endif(WINDOWS_PHONE)
+	endif()

 	# Legacy Direct X SDK
-	if(NOT DirectX11_INCLUDE_DIR)
+	if( NOT DirectX11_INCLUDE_DIR OR NOT DirectX11_LIBRARY )
+		# Get path, convert backslashes as ${ENV_DXSDK_DIR}
+		getenv_path(DXSDK_DIR)
+		getenv_path(DIRECTX_HOME)
+		getenv_path(DIRECTX_ROOT)
+		getenv_path(DIRECTX_BASE)

-	# Get path, convert backslashes as ${ENV_DXSDK_DIR}
-	getenv_path(DXSDK_DIR)
-	getenv_path(DIRECTX_HOME)
-	getenv_path(DIRECTX_ROOT)
-	getenv_path(DIRECTX_BASE)
+		# construct search paths
+		set(DirectX11_PREFIX_PATH
+		"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
+		"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
+		"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
+		"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
+		"C:/apps_x86/Microsoft DirectX SDK*"
+		"C:/Program Files (x86)/Microsoft DirectX SDK*"
+		"C:/apps/Microsoft DirectX SDK*"
+		"C:/Program Files/Microsoft DirectX SDK*"
+		"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
+		)

-	# construct search paths
-	set(DirectX11_PREFIX_PATH
-	"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
-	"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
-	"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
-	"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
-	"C:/apps_x86/Microsoft DirectX SDK*"
-	"C:/Program Files (x86)/Microsoft DirectX SDK*"
-	"C:/apps/Microsoft DirectX SDK*"
-	"C:/Program Files/Microsoft DirectX SDK*"
-	"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
-	)
+		create_search_paths(DirectX11)
+		# redo search if prefix path changed
+		clear_if_changed(DirectX11_PREFIX_PATH
+			DirectX11_LIBRARY
+			DirectX11_INCLUDE_DIR
+		)

-	create_search_paths(DirectX11)
-	# redo search if prefix path changed
-	clear_if_changed(DirectX11_PREFIX_PATH
-		DirectX11_LIBRARY
-		DirectX11_INCLUDE_DIR
-	)
-
-	# dlls are in DirectX11_ROOT_DIR/Developer Runtime/x64|x86
-	# lib files are in DirectX11_ROOT_DIR/Lib/x64|x86
-	if(CMAKE_CL_64)
-		set(DirectX11_LIBPATH_SUFFIX "x64")
-	else(CMAKE_CL_64)
-		set(DirectX11_LIBPATH_SUFFIX "x86")
-	endif(CMAKE_CL_64)
+		# dlls are in DirectX11_ROOT_DIR/Developer Runtime/x64|x86
+		# lib files are in DirectX11_ROOT_DIR/Lib/x64|x86
+		if(CMAKE_CL_64)
+			set(DirectX11_LIBPATH_SUFFIX "x64")
+		else(CMAKE_CL_64)
+			set(DirectX11_LIBPATH_SUFFIX "x86")
+		endif(CMAKE_CL_64)

-	# look for D3D11 components
-    find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS ${DirectX11_INC_SEARCH_PATH})
-    find_library(DirectX11_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
-	find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
-	find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
-	find_library(DirectX11_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
-	find_library(DirectX11_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
-	find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		# look for D3D11 components
+		find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS ${DirectX11_INC_SEARCH_PATH})
+		find_library(DirectX11_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		find_library(DirectX11_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		find_library(DirectX11_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
+		find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})

-	if (DirectX11_INCLUDE_DIR AND DirectX11_D3D11_LIBRARY)
-	  set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES}
-	    ${DirectX11_D3D11_LIBRARY}
-	    ${DirectX11_DXGI_LIBRARY}
-        ${DirectX11_DXGUID_LIBRARY}
-        ${DirectX11_D3DCOMPILER_LIBRARY}
-      )
-    endif ()
-    if (DirectX11_D3DX11_LIBRARY)
-        set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_D3DX11_LIBRARY})
-    endif ()
-    if (DirectX11_DXERR_LIBRARY)
-        set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_DXERR_LIBRARY})
-    endif ()
+		if (DirectX11_INCLUDE_DIR AND DirectX11_D3D11_LIBRARY)
+		  set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES}
+			${DirectX11_D3D11_LIBRARY}
+			${DirectX11_DXGI_LIBRARY}
+			${DirectX11_DXGUID_LIBRARY}
+			${DirectX11_D3DCOMPILER_LIBRARY}
+		  )
+		endif ()
+		if (DirectX11_D3DX11_LIBRARY)
+			set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_D3DX11_LIBRARY})
+		endif ()
+		if (DirectX11_DXERR_LIBRARY)
+			set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_DXERR_LIBRARY})
+		endif ()

-	set(DirectX11_LIBRARY
-		${DirectX11_D3D11_LIBRARIES}
-	)
-
-	mark_as_advanced(DirectX11_D3D11_LIBRARY
-					 DirectX11_D3DX11_LIBRARY
-					 DirectX11_DXERR_LIBRARY
-					 DirectX11_DXGUID_LIBRARY
-					 DirectX11_DXGI_LIBRARY
-					 DirectX11_D3DCOMPILER_LIBRARY)
+		set(DirectX11_LIBRARY
+			${DirectX11_D3D11_LIBRARIES}
+		)

+		mark_as_advanced(DirectX11_D3D11_LIBRARY
+						 DirectX11_D3DX11_LIBRARY
+						 DirectX11_DXERR_LIBRARY
+						 DirectX11_DXGUID_LIBRARY
+						 DirectX11_DXGI_LIBRARY
+						 DirectX11_D3DCOMPILER_LIBRARY)
 	endif () # Legacy Direct X SDK

 	findpkg_finish(DirectX11)

-endif(WIN32)+endif(WIN32)


Use first released Win10 SDK version (10.0.10240.0) as default

--- CMake/Packages/FindDirectX11.cmake
+++ CMake/Packages/FindDirectX11.cmake
@@ -23,7 +23,7 @@
 		if(VS_TARGET_PLATFORM_VERSION)
 			set(W10SDK_VER VS_TARGET_PLATFORM_VERSION)
 		else()
-			set(W10SDK_VER 10.0.10069.0)
+			set(W10SDK_VER 10.0.10240.0)
 		endif()
 		find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS "C:/Program Files (x86)/Windows Kits/10/include/${W10SDK_VER}/um" "C:/Program Files/Windows Kits/10/include/${W10SDK_VER}/um")
 		set(DirectX11_LIBRARY d3d11.lib dxgi.lib dxguid.lib) # in "C:/Program Files (x86)/Windows Kits/10/lib/${W10SDK_VER}/um/${MSVC_CXX_ARCHITECTURE_ID}/"


GCC_ARCH flag sets the -march command line option to gcc

--- CMake/hoomd/HOOMDCFlagsSetup.cmake
+++ CMake/hoomd/HOOMDCFlagsSetup.cmake
@@ -4,6 +4,16 @@
 ## Setup default CXXFLAGS
 if(NOT PASSED_FIRST_CONFIGURE)
     message(STATUS "Overriding CMake's default CFLAGS (this should appear only once)")
+
+    ## Allow GCC_ARCH flag to set the -march field
+    if("$ENV{GCC_ARCH}" STREQUAL "")
+        set(GCC_ARCH "native")
+        message(STATUS "GCC_ARCH env var not set, setting -march to ${GCC_ARCH}")
+    else()
+        set(GCC_ARCH $ENV{GCC_ARCH})
+        message(STATUS "Found GCC_ARCH env var, setting -march to ${GCC_ARCH}")
+    endif()
+

     # default build type is Release when compiling make files
     if(NOT CMAKE_BUILD_TYPE AND NOT HONOR_GENTOO_FLAGS)
@@ -25,10 +35,10 @@
         else (HONOR_GENTOO_FLAGS)

         # default flags for g++
-        set(CMAKE_CXX_FLAGS_DEBUG "-march=native -g -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
-        set(CMAKE_CXX_FLAGS_MINSIZEREL "-march=native -Os -Wall -Wno-unknown-pragmas -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELEASE "-march=native -O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-march=native -g -O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+        set(CMAKE_CXX_FLAGS_DEBUG "-march=${GCC_ARCH} -g -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+        set(CMAKE_CXX_FLAGS_MINSIZEREL "-march=${GCC_ARCH} -Os -Wall -Wno-unknown-pragmas -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELEASE "-march=${GCC_ARCH} -O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-march=${GCC_ARCH} -g -O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)

         endif (HONOR_GENTOO_FLAGS)
     elseif(MSVC80)


COMP: do not use rc files on cygwin

COMP: do not use rc files on cygwin

--- Wrapping/Tcl/vtkDetermineTkResources.cmake
+++ Wrapping/Tcl/vtkDetermineTkResources.cmake
@@ -1,12 +1,13 @@
 IF (WIN32)
   IF (NOT BORLAND)
+   IF(NOT CYGWIN)
     VTK_GET_TCL_TK_VERSION ("TCL_TK_MAJOR_VERSION" "TCL_TK_MINOR_VERSION")
     IF (TCL_TK_MAJOR_VERSION AND TCL_TK_MINOR_VERSION)
       SET (TK_RESOURCE_FILE_TRY
            "${VTK_SOURCE_DIR}/Utilities/TclTk/resources/tk${TCL_TK_MAJOR_VERSION}.${TCL_TK_MINOR_VERSION}/win/rc/tk.rc")
       IF (EXISTS ${TK_RESOURCE_FILE_TRY})
         SET(TK_RESOURCE_FILE ${TK_RESOURCE_FILE_TRY} CACHE INTERNAL
-	        "The tk.rc resource file required to add the proper resources to a Tk command-line interpreter (i.e. vtk.exe)")
+              "The tk.rc resource file required to add the proper resources to a Tk command-line interpreter (i.e. vtk.exe)")
       ENDIF (EXISTS ${TK_RESOURCE_FILE_TRY})
     ENDIF (TCL_TK_MAJOR_VERSION AND TCL_TK_MINOR_VERSION)
     IF (TK_RESOURCE_FILE)
@@ -19,6 +20,7 @@
       SET(VTK_EXE_RESOURCE_FILES
           "${VTK_BINARY_DIR}/Wrapping/Tcl/resources/vtk.rc")
     ENDIF (TK_RESOURCE_FILE)
+   ENDIF(NOT CYGWIN)
   ENDIF (NOT BORLAND)
 ENDIF (WIN32)


windows boost compiling with program_options module

--- extdep/compile/boost.cmake
+++ extdep/compile/boost.cmake
@@ -5,7 +5,7 @@
 # on windows 64:
 # set(boost_address_model address-model=64)

-set(boost_targets --with-filesystem --with-system --with-thread --with-date_time --with-regex --with-test --with-chrono)
+set(boost_targets --with-filesystem --with-system --with-thread --with-date_time --with-regex --with-test --with-chrono --with-program_options)
 ExternalProject_Add(boost
 	URL http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.gz
 	BINARY_DIR boost-prefix/src/boost


Quiet output of clone.

Quiet output of clone.

--- CPM.cmake
+++ CPM.cmake
@@ -681,6 +681,7 @@
         COMMAND "${GIT_EXECUTABLE}" clone "${repo}" "${dir}"
         WORKING_DIRECTORY "${CPM_DIR_OF_CPM}"
         RESULT_VARIABLE error_code
+        OUTPUT_QUIET
         )
       math(EXPR number_of_tries "${number_of_tries} + 1")
     endwhile()


Update ParaView for lights inspector panel

--- versions.cmake
+++ versions.cmake
@@ -80,7 +80,7 @@
   set(_paraview_revision "master")
 else()
   # Test the revision with OpenGL2 rendering before updating, update often!
-  set(_paraview_revision "8bc0d9c3eff9ce21082dad15735124a943c01d32")
+  set(_paraview_revision "f700a4d7f32ccb7e31f1da6e6fd1c6188dac2feb")
 endif()
 add_revision(paraview
   GIT_REPOSITORY "https://gitlab.kitware.com/paraview/paraview.git"


publishing related stuff

publishing related stuff

git-svn-id: 647c2dfdf120d9af8205d960f30c8711574448cd@1324 6778bc44-b910-0410-a7a0-be141de4315d

--- src/libprojectM/cmake/CPack-projectM.cmake
+++ src/libprojectM/cmake/CPack-projectM.cmake
@@ -6,7 +6,7 @@
 #SET(CPACK_IGNORE_FILES
  # "*~;CMakeCache.txt;CMakeFiles/;.svn;.*.bak;*.Z;_*/;.*.gz;.*.tgz;.*.tar;.*.bz2;.*.zip;.*.rpm;.*.deb;.*.o")
 SET(CPACK_SOURCE_IGNORE_FILES
-  "Makefile;CMakeCache.txt;CMakeFiles/;.*.gz;.*.bz2;.*.Z;.*.zip")
+  "Makefile;CMakeCache.txt;CMakeFiles/;.*.gz;.*.bz2;.*.Z;.*.zip;.*svn")

 #SET(CPACK_BINARY_RPM OFF)
 # #SET(CPACK_BINARY_Z OFF)


debug macro

debug macro

--- cmake/FileSystemUtils.cmake
+++ cmake/FileSystemUtils.cmake
@@ -26,5 +26,6 @@
     else()
         get_filename_component(result ${curpath} DIRECTORY)
     endif()
+    MESSAGE(STATUS "result=${result}")
 ENDMACRO()


cmake: fixed issue with CONF_FILE pattern when using build type

This commit fixes an issue where specifying a build type config file
in a subfolder named: `prj_<something>` would cause a wrong match and
fail to find Kconfig fragments, as example:

Working: `-DCONF_FILE=myconfigs/prj_debug.conf` would correctly add
myconfigs/boards/<board>_debug.conf to list of conf files.

Failing: `-DCONF_FILE=prj_configs/prj_debug.conf` would fail to locate
prj_configs/boards/<board>_debug.conf, and thus the board specific
config fragment was not added to the list of config files.

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

--- cmake/app/boilerplate.cmake
+++ cmake/app/boilerplate.cmake
@@ -405,7 +405,7 @@
     # Need path in order to check if it is absolute.
     get_filename_component(CONF_FILE_NAME ${CONF_FILE} NAME)
     get_filename_component(CONF_FILE_DIR ${CONF_FILE} DIRECTORY)
-    if(${CONF_FILE} MATCHES "prj_(.*).conf")
+    if(${CONF_FILE_NAME} MATCHES "prj_(.*).conf")
       if(NOT IS_ABSOLUTE ${CONF_FILE_DIR})
         set(CONF_FILE_DIR ${APPLICATION_SOURCE_DIR}/${CONF_FILE_DIR})
       endif()


added odb-mysql to configs/default

added odb-mysql to configs/default

--- cmake/configs/default.cmake
+++ cmake/configs/default.cmake
@@ -100,6 +100,7 @@
 hunter_config(nlohmann-json VERSION 1.0.0-rc1-hunter-3)
 hunter_config(odb VERSION 2.4.0)
 hunter_config(odb-compiler VERSION 2.4.0)
+hunter_config(odb-mysql VERSION 2.4.0)
 hunter_config(odb-pgsql VERSION 2.4.0)
 hunter_config(odb-sqlite VERSION 2.4.0)
 hunter_config(rabbitmq-c VERSION 0.7.0-p1)


Upgrade nGraph to use mkldnn v1.1 (#22154)

--- cmake/external/ngraph.cmake
+++ cmake/external/ngraph.cmake
@@ -17,7 +17,7 @@
 INCLUDE(ExternalProject)

 SET(NGRAPH_PROJECT         "extern_ngraph")
-SET(NGRAPH_GIT_TAG         "a9a3ae79012c5193ed4e72ec68cf9860e232a8ec")
+SET(NGRAPH_GIT_TAG         "972dd2f5ecfa18e3819b17c47698fae9795b499f")
 SET(NGRAPH_SOURCES_DIR     ${THIRD_PARTY_PATH}/ngraph)
 SET(NGRAPH_INSTALL_DIR     ${THIRD_PARTY_PATH}/install/ngraph)
 SET(NGRAPH_INC_DIR         ${NGRAPH_INSTALL_DIR}/include)
@@ -57,7 +57,6 @@
     CMAKE_ARGS               -DMKLDNN_INCLUDE_DIR=${MKLDNN_INC_DIR}
     CMAKE_ARGS               -DMKLDNN_LIB_DIR=${MKLDNN_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}
     CMAKE_ARGS               -DMKLML_LIB_DIR=${MKLML_INSTALL_DIR}/lib
-    CMAKE_ARGS               -NGRAPH_USE_LEGACY_MKLDNN=FALSE
 )

 add_library(ngraph INTERFACE)


Add --binary flag to patch command. (#9941)

Certain versions of the 'patch' command on Windows have an issue with CRLF line endings.
Adding the --binary flag is a no-op on POSIX systems, but should fix patch.exe crashing on Windows.

--- cmake/external/snappy.cmake
+++ cmake/external/snappy.cmake
@@ -34,7 +34,7 @@
   BUILD_COMMAND     ""
   INSTALL_COMMAND   ""
   TEST_COMMAND      ""
-  PATCH_COMMAND     patch -Np1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.patch
+  PATCH_COMMAND     patch -Np1 --binary -i ${CMAKE_CURRENT_LIST_DIR}/snappy.patch

   HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
 )


[CMake] Add support for NO_INSTALL_RPATH argument in llvm_add_library()

Summary:
Allow clients to suppress setup of default RPATHs in designated library targets. This is used in LLDB when emitting liblldb as a framework bundle, which itself doesn't load further RPATH-dependent libraries.
This follows the approach in add_llvm_executable().

Reviewers: aprantl, JDevlieghere, davide, friss

Reviewed By: aprantl

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

Differential Revision: https://reviews.llvm.org/D55316

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@348573 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -372,12 +372,14 @@
 #     May specify header files for IDE generators.
 #   SONAME
 #     Should set SONAME link flags and create symlinks
+#   NO_INSTALL_RPATH
+#     Suppress default RPATH settings in shared libraries.
 #   PLUGIN_TOOL
 #     The tool (i.e. cmake target) that this plugin will link against
 #   )
 function(llvm_add_library name)
   cmake_parse_arguments(ARG
-    "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME"
+    "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME;NO_INSTALL_RPATH"
     "OUTPUT_NAME;PLUGIN_TOOL"
     "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
     ${ARGN})
@@ -448,15 +450,17 @@

   if(ARG_MODULE)
     add_library(${name} MODULE ${ALL_FILES})
-    llvm_setup_rpath(${name})
   elseif(ARG_SHARED)
     add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
     add_library(${name} SHARED ${ALL_FILES})
-
-    llvm_setup_rpath(${name})
-
   else()
     add_library(${name} STATIC ${ALL_FILES})
+  endif()
+
+  if(NOT ARG_NO_INSTALL_RPATH)
+    if(ARG_MODULE OR ARG_SHARED)
+      llvm_setup_rpath(${name})
+    endif()
   endif()

   setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})


[CMake] Enhance add_llvm_external_project.

  - Substitute hyphen to underscore, s/-/_/g, as the variable name.
  - Additional parameter can be specified as the name of directory.

e.g.) add_llvm_external_project(clang-tools-extra extra)

  - LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/llvm-srcroot/tools/clang/tools/extra, by default.
  - Build directory is in ${CMAKE_CURRENT_BINARY_DIR}/extra

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@165311 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -135,16 +135,22 @@
 # lld, and Polly. This adds two options. One for the source directory of the
 # project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to
 # enable or disable building it with everthing else.
+# Additional parameter can be specified as the name of directory.
 macro(add_llvm_external_project name)
-  string(TOUPPER ${name} nameUPPER)
-  set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}"
+  set(add_llvm_external_dir "${ARGN}")
+  if("${add_llvm_external_dir}" STREQUAL "")
+    set(add_llvm_external_dir ${name})
+  endif()
+  string(REPLACE "-" "_" nameUNDERSCORE ${name})
+  string(TOUPPER ${nameUNDERSCORE} nameUPPER)
+  set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}"
       CACHE PATH "Path to ${name} source directory")
   if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL ""
       AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)
     option(LLVM_EXTERNAL_${nameUPPER}_BUILD
            "Whether to build ${name} as part of LLVM" ON)
     if (LLVM_EXTERNAL_${nameUPPER}_BUILD)
-      add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${name})
+      add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir})
     endif()
   endif()
 endmacro(add_llvm_external_project)


Make ENABLE_DYNDRIVERS=ON the default.

Make ENABLE_DYNDRIVERS=ON the default.

svn path=/trunk/; revision=6846

--- cmake/modules/drivers.cmake
+++ cmake/modules/drivers.cmake
@@ -34,7 +34,7 @@
 # DRIVERS_LIST: list of device drivers (e.g., gd for the png and jpeg devices)
 #   where at least one of the associated devices is enabled.

-option(ENABLE_DYNDRIVERS "enable dynamic loading of device drivers" OFF)
+option(ENABLE_DYNDRIVERS "enable dynamic loading of device drivers" ON)
 if(ENABLE_DYNDRIVERS AND NOT BUILD_SHARED_LIBS)
   message(STATUS
   "WARNING: Shared libraries not built. Setting ENABLE_DYNDRIVERS OFF."


Check for fortran compiler before enabling fortran language. This way
we can disable the bindings if no compiler is found.

svn path=/trunk/; revision=6782

--- cmake/modules/fortran.cmake
+++ cmake/modules/fortran.cmake
@@ -28,6 +28,20 @@
 IF (ENABLE_f77 OR ENABLE_f95)

 # Check for fortran compiler
+INCLUDE(CMakeDetermineFortranCompiler)
+
+IF (CMAKE_Fortran_COMPILER MATCHES "NOTFOUND$")
+  MESSAGE(STATUS "WARNING: "
+  "fortran compiler not found. Disabling f77/f95 bindings")
+  SET(ENABLE_f77 OFF CACHE BOOL "Enable f77 bindings" FORCE)
+  SET(ENABLE_f95 OFF CACHE BOOL "Enable f95 bindings" FORCE)
+ENDIF (CMAKE_Fortran_COMPILER MATCHES "NOTFOUND$")
+
+ENDIF (ENABLE_f77 OR ENABLE_f95)
+
+IF (ENABLE_f77 OR ENABLE_f95)
+
+# Enable fortran language
 ENABLE_LANGUAGE(Fortran)

 # Don't compile Fortran 95 binding if compiler doesn't support it


add_catch_test: automatic detection of .cpp files

--- scripts/AddCatchTest.cmake
+++ scripts/AddCatchTest.cmake
@@ -87,6 +87,8 @@
   unset(source)
   if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.cc")
     set(source ${testname}.cc)
+  elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.cpp")
+    set(source ${testname}.cpp)
   elseif("${catch_UNPARSED_ARGUMENTS}" STREQUAL "")
     message(FATAL_ERROR "No source given or found for ${testname}")
   endif()


Refactor: Write revision information to a pseudo Update.xml file

git-svn-id: 59f82343654cec32357d3b049d399063e4e4cfc7@30948 0785d39b-7218-0410-832d-ea1e28bc413d

--- tests/run_testsuite.cmake
+++ tests/run_testsuite.cmake
@@ -186,17 +186,6 @@
 ENDIF()

 #
-# CTEST_UPDATE_COMMAND:
-#
-
-FIND_PACKAGE(Subversion QUIET)
-IF(SUBVERSION_FOUND)
-  SET(CTEST_UPDATE_COMMAND ${Subversion_SVN_EXECUTABLE})
-ENDIF()
-
-MESSAGE("-- CTEST_UPDATE_COMMAND:   ${CTEST_UPDATE_COMMAND}")
-
-#
 # CTEST_SITE:
 #

@@ -270,7 +259,7 @@
 #
 # Append subversion branch to CTEST_BUILD_NAME:
 #
-
+FIND_PACKAGE(Subversion QUIET)
 EXECUTE_PROCESS(
   COMMAND ${Subversion_SVN_EXECUTABLE} info ${CTEST_SOURCE_DIRECTORY}
   OUTPUT_QUIET ERROR_QUIET
@@ -281,7 +270,7 @@
   STRING(REGEX REPLACE "^${_svn_WC_ROOT}/" "" _branch ${_svn_WC_URL})
   STRING(REGEX REPLACE "^branches/" "" _branch ${_branch})
   STRING(REGEX REPLACE "/deal.II$" "" _branch ${_branch})
-  SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}-r${_svn_WC_REVISION}")
+  SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}")
 ENDIF()

 #
@@ -368,7 +357,7 @@
     # Only run tests if the build was successful:

     EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND}
-     --build ${CTEST_BINARY_DIRECTORY} --target setup_test
+      --build ${CTEST_BINARY_DIRECTORY} --target setup_test
       OUTPUT_QUIET RESULT_VARIABLE _res
       )
     IF(NOT "${_res}" STREQUAL "0")
@@ -390,7 +379,7 @@
 ENDIF()
 FILE(GLOB _xml_files ${_path}/*.xml)
 EXECUTE_PROCESS(COMMAND sed -i -e
-  s/CompilerName=\"\"/CompilerName=\"${_compiler_name}\"\\n\\tCompilerVersion=\"${_compiler_version}\"\\n\\tSVNBranch=\"${_branch}\"\\n\\tSVNRevision=\"${_svn_WC_REVISION}\"/g
+  s/CompilerName=\"\"/CompilerName=\"${_compiler_name}\"\\n\\tCompilerVersion=\"${_compiler_version}\"/g
   ${_xml_files}
   OUTPUT_QUIET RESULT_VARIABLE  _res
   )
@@ -398,6 +387,20 @@
   MESSAGE(FATAL_ERROR "\"sed\" failed. Bailing out.")
 ENDIF()

+IF(NOT "${_svn_WC_REVISION}" STREQUAL "")
+  FILE(WRITE ${_path}/Update.xml
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<Update mode=\"Client\" Generator=\"${CTEST_GENERATOR}\">
+    <Site>${CTEST_SITE}</Site>
+      <BuildName>${CTEST_BUILD_NAME}</BuildName>
+        <BuildStamp>${_tag}-Experimental</BuildStamp>
+	<UpdateType>SVN</UpdateType>
+	<Revision>${_svn_WC_REVISION}</Revision>
+        <SVNPath>${_branch}</SVNPath>
+</Update>"
+    )
+ENDIF()
+
 #
 # And finally submit:
 #


FIX: parallel builds should work now

FIX: parallel builds should work now

--- CMake/FunctionalityHelpers.cmake
+++ CMake/FunctionalityHelpers.cmake
@@ -75,7 +75,7 @@
   #   CLEANUP_FUNCTIONALITY_LIST()
     ADD_LIBRARY(${FUNC_NAME} ${FUNC_CPP_LIST} "${CMAKE_CURRENT_BINARY_DIR}/Register${FUNC_NAME}.cpp" )
     TARGET_LINK_LIBRARIES(${FUNC_NAME} ${LIBS_FOR_QFUNCTIONALITY})
-    # MESSAGE(status "added ${FUNC_NAME}")
+    ADD_DEPENDENCIES(${FUNC_NAME} ${LIBS_FOR_QFUNCTIONALITY})
   ENDIF(BUILD_${FUNC_NAME} OR BUILD_ALL_FUNCTIONALITIES)
   SET(${KITNAME}FUNCTIONALITY_NAMES_KNOWN ${${KITNAME}FUNCTIONALITY_NAMES_KNOWN};${FUNC_NAME} CACHE INTERNAL "Names of all known functionalities.")
 # MESSAGE("after MACRO: ${${KITNAME}FUNCTIONALITY_NAMES}")


Minor err message fix

Minor err message fix

--- CMake/hoomd/HOOMDCUDASetup.cmake
+++ CMake/hoomd/HOOMDCUDASetup.cmake
@@ -15,7 +15,7 @@
     find_package(Thrust)

     if (${THRUST_VERSION} VERSION_LESS 1.6.0)
-        message(SEND_ERROR "Thrust version ${THRUST_VERSION} found, >= 1.7.0 is required")
+        message(SEND_ERROR "Thrust version ${THRUST_VERSION} found, >= 1.6.0 is required")
     endif (${THRUST_VERSION} VERSION_LESS 1.6.0)

     # first thrust, then CUDA (to allow for local thrust installation


add numa detection check to tests.sh

add numa detection check to tests.sh

--- tests/system_tests/run_system_tests.sh.cmake
+++ tests/system_tests/run_system_tests.sh.cmake
@@ -325,6 +325,10 @@
 	    src_file="$src_file_base".c
       LIBRARY=physis_rt_mpi_openmp
       if [ $target = mpi-openmp-numa ] ; then
+	      if [ "${NUMA_ENABLED}" != "TRUE" ]; then
+		      echo "[COMPILE] Skipping MPI-OPENMP-NUMA compilation (not supported)"
+		      return 0
+	      fi
         LIBRARY=physis_rt_mpi_openmp_numa
         LDFLAGS+=" -lnuma"
       fi


Dump stdout/stderr in runtest.cmake when matching fails.

This allows us to get more information from logs of failing tests,
because the raw stdout/stderr is not recorded anywhere else.

I also fixed the matching code that was intended to remove up to and
including the matching line to remove the line that matched.  We rely on
this behavior in the nudge test on Linux to count the number of error
reports.

git-svn-id: fe3cd4388a6e5a968b09397a3d721fe124e8117a@594 5b54908e-ead4-fc18-b48a-0285e6dbc711

--- tests/runtest.cmake
+++ tests/runtest.cmake
@@ -333,6 +333,32 @@
   string(REGEX REPLACE "(^|\n)%(if|endif)[^\n]*\n" "\\1" ${str} "${${str}}")
 endforeach (str)

+# Remove up to and including the line matched by 'needle'.  Used to ensure that
+# each pattern line matches in order.  Regex matching is greedy, so we can't
+# just replace up to ${needle} because there may be later matches.  Instead, we
+# remove one line at a time.
+function(remove_up_to_and_including_line haystack_out haystack needle)
+  # paranoid so have an escape from loop here w/ prev_haystack.
+  set(prev_haystack "")
+  while (NOT "${haystack}" STREQUAL "${prev_haystack}" AND
+         NOT "${haystack}" MATCHES "^[^\n]*${needle}")
+    set(prev_haystack "${haystack}")
+    string(REGEX REPLACE "^[^\n]+" "" haystack "${haystack}")
+    string(REGEX REPLACE "^\r?\n" "" haystack "${haystack}")
+  endwhile ()
+  # Remove the line that was matched.
+  string(REGEX REPLACE "^[^\n]+" "" haystack "${haystack}")
+  string(REGEX REPLACE "^\r?\n" "" haystack "${haystack}")
+  set(${haystack_out} "${haystack}" PARENT_SCOPE)
+endfunction(remove_up_to_and_including_line)
+
+# Removes the regex we use for matching newlines.
+function(strip_trailing_newline_regex str_out str)
+  # Use [?] to match raw ? because CMake doesn't like \?.
+  string(REGEX REPLACE "(\r[?])?\n$" "" str "${str}")
+  set(${str_out} "${str}" PARENT_SCOPE)
+endfunction(strip_trailing_newline_regex)
+
 ##################################################
 # check stderr

@@ -352,7 +378,7 @@
     # FIXME PR 470723: add Dr. Heapstat-specific tests
     if (NOT TOOL_DR_HEAPSTAT OR
         NOT "${line}" MATCHES "^~~Dr\\\\.M~~")
-      string(REGEX REPLACE "\r?\n$" "" line "${line}")
+      strip_trailing_newline_regex(line "${line}")
       set(msg "stderr failed to match \"${line}\"")
       # try to find what was meant to match
       string(REGEX REPLACE "[0-9]" "." rline "${line}")
@@ -361,22 +387,11 @@
       if (NOT "${real_out}" STREQUAL "")
         set(msg "${msg}, found \"${real_out}\" instead")
       endif ()
+      set(msg "${msg}\nstderr:\n${cmd_err}")
       message(FATAL_ERROR "${msg}")
     endif ()
   endif ()
-  # remove up to and including the line matched, to enforce
-  # matching in order, and for better error message.
-  # regex matching is greedy so we can't just replace up to
-  # ${line} b/c there may be later matches, so we remove one
-  # line at a time.
-  # paranoid so have an escape from loop here w/ prev_cmd_tomatch.
-  set(prev_cmd_tomatch "")
-  while (NOT "${cmd_tomatch}" STREQUAL "${prev_cmd_tomatch}" AND
-      NOT "${cmd_tomatch}" MATCHES "^[^\n]*${line}")
-    set(prev_cmd_tomatch "${cmd_tomatch}")
-    string(REGEX REPLACE "^[^\n]+" "" cmd_tomatch "${cmd_tomatch}")
-    string(REGEX REPLACE "^\r?\n" "" cmd_tomatch "${cmd_tomatch}")
-  endwhile ()
+  remove_up_to_and_including_line(cmd_tomatch "${cmd_tomatch}" "${line}")
 endforeach (line)

 ##################################################
@@ -456,7 +471,7 @@
       set(require_in_order 1)
     else ()
       # we do NOT include the newline, to support matching intra-line substrings
-      string(REGEX REPLACE "\r?\n" "" line "${line}")
+      strip_trailing_newline_regex(line "${line}")
       if (NOT "${results}" MATCHES "${line}")
         set(msg "${resfile_using} failed to match \"${line}\"")
         # try to find what was meant to match
@@ -469,19 +484,7 @@
         message(FATAL_ERROR "${msg}")
       endif ()
       if (require_in_order)
-        # remove up to and including the line matched, to enforce
-        # matching in order, and for better error message.
-        # regex matching is greedy so we can't just replace up to
-        # ${line} b/c there may be later matches, so we remove one
-        # line at a time.
-        # paranoid so have an escape from loop here w/ prev_results.
-        set(prev_results "")
-        while (NOT "${results}" STREQUAL "${prev_results}" AND
-            NOT "${results}" MATCHES "^[^\n]*${line}")
-          set(prev_results "${results}")
-          string(REGEX REPLACE "^[^\n]+" "" results "${results}")
-          string(REGEX REPLACE "^\r?\n" "" results "${results}")
-        endwhile ()
+        remove_up_to_and_including_line(results "${results}" "${line}")
       endif (require_in_order)
     endif ()
   endforeach (line)


Fix cmake Dockerfile issue on Linux (#17416)

* Fix cmake Dockerfile issue on Linux

When running cmake on Linux with (clean build with no cached docker images):
```
tensorflow/tools/ci_build/ci_build.sh CMAKE tensorflow/tools/ci_build/builds/cmake.sh
```

The following isse was encountered:
```
Step 11/13 : RUN pip install --upgrade termcolor
 ---> Running in 838167596eb6
Collecting termcolor
  Downloading termcolor-1.1.0.tar.gz
  ......
  ......
  ......
  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for termcolor
```

This fix adds the missing `pip install wheel`

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

* Update golang installation in cmake Dockerfile

This fix updates the golang installation in cmake Dockerfile.
Previously, `ppa:ubuntu-lxc/lxd-stable` was used but it has been
deprecated, see:
http://lxc-users.linuxcontainers.narkive.com/IlHLLHqN/lxd-official-ppa-deprecation

That caused the following error:
```
Step 13/14 : RUN add-apt-repository -y ppa:ubuntu-lxc/lxd-stable
 ---> Running in 09301ba43a33
Cannot add PPA: 'ppa:~ubuntu-lxc/ubuntu/lxd-stable'.
The team named '~ubuntu-lxc' has no PPA named 'ubuntu/lxd-stable'
Please choose from the following available PPAs:
 * 'buildd-backports':  linuxcontainers.org: buildd backports
 * 'daily':  linuxcontainers.org: development builds
 ......
 ......
```

This fix updates the golang installation and use backported xenial (16.04),
as was suggested in the link:
http://lxc-users.linuxcontainers.narkive.com/IlHLLHqN/lxd-official-ppa-deprecation

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

--- tensorflow/tools/ci_build/Dockerfile.cmake
+++ tensorflow/tools/ci_build/Dockerfile.cmake
@@ -23,11 +23,12 @@

 RUN apt-get update
 RUN apt-get install -y --no-install-recommends python-pip
+RUN pip install --upgrade wheel
 RUN pip install --upgrade astor
 RUN pip install --upgrade gast
 RUN pip install --upgrade numpy
 RUN pip install --upgrade termcolor

 # Install golang
-RUN add-apt-repository -y ppa:ubuntu-lxc/lxd-stable
-RUN apt-get install -y golang
+RUN apt-get install -t xenial-backports -y golang-1.9
+ENV PATH=${PATH}:/usr/lib/go-1.9/bin


Remove '_' in ubuntu package revision

Remove '_' in ubuntu package revision

--- CMake/Packages.cmake
+++ CMake/Packages.cmake
@@ -17,14 +17,14 @@
       "libreadline6"
     )
     if(OSQUERY_BUILD_DISTRO STREQUAL "PRECISE")
-      set(PACKAGE_ITERATION "1.ubuntu12_12.04")
+      set(PACKAGE_ITERATION "1.ubuntu12.04")
       set(PACKAGE_DEPENDENCIES
         "${PACKAGE_DEPENDENCIES}"
         "libstdc++6"
         "libudev0"
       )
     elseif(OSQUERY_BUILD_DISTRO STREQUAL "TRUSTY")
-      set(PACKAGE_ITERATION "1.ubuntu14_14.04")
+      set(PACKAGE_ITERATION "1.ubuntu14.04")
       set(PACKAGE_DEPENDENCIES
         "${PACKAGE_DEPENDENCIES}"
         "libstdc++6 (>= 4.8)"


Android: restored logic to load .abi configuration files if available.

--- toolchains/android-studio.toolchain.cmake
+++ toolchains/android-studio.toolchain.cmake
@@ -1,10 +1,10 @@
 ################################################################################
 #
-# T:N.U.N. Android Studio CMake tool chain file. This is to be used together with
-# native android CMake toolchain bundled with Android studio 2.2 and newer.
-# For uses without Android Studio, please use android.toolchain.cmake file.
+# T:N.U.N. Android Studio CMake tool chain file. This is to be used together
+# with the native android CMake toolchain bundled with Android studio 2.2+.
+# For uses without Android Studio, please use the android.toolchain.cmake file.
 #
-# Copyright (c) 2016. Nenad Miksa. All rights reserved.
+# Copyright (c) 2016. Nenad Miksa.
 #
 ################################################################################

@@ -54,25 +54,38 @@
 endif()

 set( TNUN_arch_include_dir "${CMAKE_CURRENT_LIST_DIR}/android" )
-
+set( TNUN_ABI  ${ANDROID_ABI} )
+set( TNUN_ARCH ${ANDROID_ABI} )
 if( ANDROID_ABI STREQUAL "armeabi-v7a" )
+    set( TNUN_ABI arm-linux-androideabi )
     if ( ANDROID_ARM_NEON )
-        include ( "${TNUN_arch_include_dir}/armv7-neon.arch.cmake" )
+        set( TNUN_ARCH armv7-neon )
     else()
-        include ( "${TNUN_arch_include_dir}/armv7-vfp3d16.arch.cmake" )
+        set( TNUN_ARCH armv7-vfp3d16 )
     endif()
 elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
-    include( "${TNUN_arch_include_dir}/aarch64.arch.cmake" )
-elseif( ANDROID_ABI STREQUAL "x86" )
-    include( "${TNUN_arch_include_dir}/x86.arch.cmake" )
-elseif( ANDROID_ABI STREQUAL "x86_64" )
-    include( "${TNUN_arch_include_dir}/x86_64.arch.cmake" )
+    set( TNUN_ABI  aarch64-linux-android )
+    set( TNUN_ARCH aarch64 )
+elseif( ANDROID_ABI STREQUAL "armeabi" ) # psiha/build does not support armeabi
+    unset( TNUN_ABI  )
+    unset( TNUN_ARCH )
+elseif( ANDROID_ABI STREQUAL "mips" ) # psiha/build has incomplete mips support
+    set( TNUN_ABI mipsel-linux-android )
+    unset( TNUN_ARCH )
+elseif( ANDROID_ABI STREQUAL "mips64" )
+    set( TNUN_ABI mips64el-linux-android )
+    unset( TNUN_ARCH )
 endif()

-set( TNUN_ABI ${ANDROID_ABI} )
+if ( TNUN_ARCH )
+    include( "${TNUN_arch_include_dir}/${TNUN_ARCH}.arch.cmake" )
+endif()
+if ( TNUN_ABI )
+    include( "${TNUN_arch_include_dir}/${TNUN_ABI}.abi.cmake" )
+endif()

-# Some settings from android.toolchain.cmake which are better than in default toolchain shipped with
-# Android Studio.
+# Some settings from android.toolchain.cmake which are better than in the
+# default toolchain shipped with Android Studio.

 # apparently gold is not supported on mips
 if( NOT ( ANDROID_ABI STREQUAL "mips" OR ANDROID_ABI STREQUAL "mips64" ) )
@@ -82,7 +95,7 @@
         set( gold_suffix ".exe" )
     endif()
     link_libraries( -fuse-ld=gold${gold_suffix} )
-    link_libraries( $<$<CONFIG:RELEASE>:-Wl,--icf=all>     ) # http://research.google.com/pubs/pub36912.html Safe ICF: Pointer Safe and Unwinding Aware Identical Code Folding in Gold
+    link_libraries( $<$<CONFIG:RELEASE>:-Wl,--icf=all> ) # http://research.google.com/pubs/pub36912.html Safe ICF: Pointer Safe and Unwinding Aware Identical Code Folding in Gold
 endif()

 link_libraries( $<$<CONFIG:RELEASE>:-Wl,--gc-sections> )


Make Coverage.cmake reusable within other projects.

--- cmake/Coverage.cmake
+++ cmake/Coverage.cmake
@@ -17,13 +17,13 @@
 ##
 ## Add target for coverage
 ##
-function (add_coverage_target)
-    if (NOT TARGET shard-coverage)
+function (add_coverage_target NAME)
+    if (NOT TARGET coverage)
         # Required program
         find_program(LCOV lcov)

         # Add custom target for gcov
-        add_custom_target(shard-coverage
+        add_custom_target(coverage
             # Cleanup lcov
             COMMAND ${LCOV} --directory . --zerocounters

@@ -34,10 +34,13 @@
             COMMAND ${LCOV} --directory . --capture --output-file coverage0.info
             COMMAND ${LCOV} -r coverage0.info 'vendor/*' 'test/*' '/usr/*' 'Token.def' --output-file coverage.info

-            DEPENDS core_test
+            DEPENDS ${NAME}
             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
             COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters."
         )
+    else ()
+        # Add target as dependency
+        add_dependencies(coverage ${NAME})
     endif ()
 endfunction ()

@@ -45,17 +48,17 @@
 ## Add target for HTML coverage output.
 ##
 function (add_coverage_html_target)
-    if (NOT TARGET shard-coverage-html)
+    if (NOT TARGET coverage-html)
         # Find genhtml program
         find_program(GENHTML genhtml)

         # Add custom target for gcov html report
-        add_custom_target(shard-coverage-html
+        add_custom_target(coverage-html
             # Capturing lcov counters and generating report
             COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info
             COMMAND ${CMAKE_COMMAND} -E remove coverage.info

-            DEPENDS shard-coverage
+            DEPENDS coverage
             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
             COMMENT "Generate coverage report."
         )
@@ -73,7 +76,7 @@
         target_compile_options(${NAME} PRIVATE --coverage)
         target_link_libraries(${NAME} PRIVATE --coverage)

-        add_coverage_target()
+        add_coverage_target(${NAME})
         add_coverage_html_target()
     endif ()
 endfunction ()


Update FindCUDA script to latest.

Update FindCUDA script to latest.

--- cmake/FindCUDA.cmake
+++ cmake/FindCUDA.cmake
@@ -31,6 +31,10 @@
 # This script locates the Nvidia Compute Unified Driver Architecture (CUDA)
 # tools. It should work on linux, windows, and mac and should be reasonably
 # up to date with cuda releases.
+#
+# This script makes use of the standard find_package arguments of <VERSION>,
+# REQUIRED and QUIET.  CUDA_FOUND will report if an acceptable version of CUDA
+# was found.
 #
 # The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the
 # prefix cannot be determined by the location of nvcc in the system path. To
@@ -94,7 +98,8 @@
 #    All of the specified source files and generated .cpp files are compiled
 #    using the standard CMake compiler, so the normal INCLUDE_DIRECTORIES,
 #    LINK_DIRECTORIES, and TARGET_LINK_LIBRARIES can be used to affect their
-#    build and link.
+#    build and link.  In addition CUDA_INCLUDE_DIRS is added automatically added
+#    to include_directories().
 #
 # CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ... [OPTIONS ...] )
 # -- Same as CUDA_ADD_LIBRARY except that an exectuable is created.
@@ -175,7 +180,8 @@
 # CUDA_VERSION
 # CUDA_VERSION_STRING   -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
 #
-# CUDA_INCLUDE_DIRS     -- Include directory for cuda headers.
+# CUDA_INCLUDE_DIRS     -- Include directory for cuda headers.  Added automatically
+#                          for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY.
 # CUDA_LIBRARIES        -- Cuda RT library.
 # CUDA_CUT_INCLUDE_DIR  -- Include directory for cuda SDK headers (cutil.h).
 # CUDA_CUT_LIBRARIES    -- SDK libraries.
@@ -424,8 +430,6 @@
 find_program(CUDA_NVCC_EXECUTABLE nvcc)
 mark_as_advanced(CUDA_NVCC_EXECUTABLE)

-message("CUDA_VERSION = ${CUDA_VERSION}")
-
 if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
   # Compute the version.
   exec_program(${CUDA_NVCC_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE NVCC_OUT)
@@ -434,8 +438,6 @@
   set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
   mark_as_advanced(CUDA_VERSION)
 endif()
-
-message("CUDA_VERSION = ${CUDA_VERSION}")

 # Always set this convenience variable
 set(CUDA_VERSION_STRING "${CUDA_VERSION}")
@@ -671,6 +673,23 @@
 endmacro()

 ##############################################################################
+# Helper to add the include directory for CUDA only once
+function(CUDA_ADD_CUDA_INCLUDE_ONCE)
+  get_directory_property(_include_directories INCLUDE_DIRECTORIES)
+  set(_add TRUE)
+  if(_include_directories)
+    foreach(dir ${_include_directories})
+      if("${dir}" STREQUAL "${CUDA_INCLUDE_DIRS}")
+        set(_add FALSE)
+      endif()
+    endforeach()
+  endif()
+  if(_add)
+    include_directories(${CUDA_INCLUDE_DIRS})
+  endif()
+endfunction()
+
+##############################################################################
 # This helper macro populates the following variables and setups up custom
 # commands and targets to invoke the nvcc compiler to generate C or PTX source
 # dependant upon the format parameter.  The compiler is invoked once with -M
@@ -896,6 +915,14 @@
         set(verbose_output OFF)
       endif()

+      # Create up the comment string
+      file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}")
+      if(compile_to_ptx)
+        set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}")
+      else()
+        set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
+      endif()
+
       # Build the generated file and dependency file ##########################
       add_custom_command(
         OUTPUT ${generated_file}
@@ -910,7 +937,7 @@
           -D "generated_file:STRING=${generated_file}"
           -D "generated_cubin_file:STRING=${generated_cubin_file}"
           -P "${custom_target_script}"
-        COMMENT "Building (${cuda_build_type}) NVCC ${source_file}: ${generated_file}"
+        COMMENT "${cuda_build_comment_string}"
         )

       # Make sure the build system knows the file is generated.
@@ -952,6 +979,8 @@
 ###############################################################################
 macro(CUDA_ADD_LIBRARY cuda_target)

+  CUDA_ADD_CUDA_INCLUDE_ONCE()
+
   # Separate the sources from the options
   CUDA_GET_SOURCES_AND_OPTIONS(_sources _options ${ARGN})
   # Create custom commands and targets for each file.
@@ -984,6 +1013,8 @@
 ###############################################################################
 macro(CUDA_ADD_EXECUTABLE cuda_target)

+  CUDA_ADD_CUDA_INCLUDE_ONCE()
+
   # Separate the sources from the options
   CUDA_GET_SOURCES_AND_OPTIONS(_sources _options ${ARGN})
   # Create custom commands and targets for each file.
@@ -1077,7 +1108,12 @@
   # Call this after you add all your CUDA targets, and you will get a convience
   # target.  You should also make clean after running this target to get the
   # build system to generate all the code again.
-  add_custom_target(CleanCudaDepends
+
+  set(cuda_clean_target_name clean_cuda_depends)
+  if (CMAKE_GENERATOR MATCHES "Visual Studio")
+    string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name)
+  endif()
+  add_custom_target(${cuda_clean_target_name}
     COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES})

   # Clear out the variable, so the next time we configure it will be empty.


[FIXED] Load wrong libutil library in redhat machine

--- cmake/FindCudd.cmake
+++ cmake/FindCudd.cmake
@@ -15,15 +15,14 @@
 find_library(CUDD_CUDD_LIBRARY   NAMES cudd   PATHS  ${CUDD_ROOT}/lib)
 find_library(CUDD_EPD_LIBRARY   NAMES epd   PATHS  ${CUDD_ROOT}/lib)
 find_library(CUDD_ST_LIBRARY   NAMES st   PATHS  ${CUDD_ROOT}/lib)
-find_library(CUDD_UTIL_LIBRARY   NAMES util   PATHS  ${CUDD_ROOT}/lib NO_DEFAULT_PATH)
-find_library(CUDD_MTR_LIBRARY   NAMES mtr   PATHS  ${CUDD_ROOT}/lib)
-
-# find_library(CUDD_CUDD_LIBRARY   NAMES cudd   PATHS  ${CUDD_ROOT}/cudd)
-# find_library(CUDD_DDDMP_LIBRARY   NAMES dddmp   PATHS  ${CUDD_ROOT}/dddmp)
-# find_library(CUDD_EPD_LIBRARY   NAMES epd   PATHS  ${CUDD_ROOT}/epd)
-# find_library(CUDD_ST_LIBRARY   NAMES st   PATHS  ${CUDD_ROOT}/st)
-# find_library(CUDD_UTIL_LIBRARY   NAMES util   PATHS  ${CUDD_ROOT}/util NO_DEFAULT_PATH)
-# find_library(CUDD_MTR_LIBRARY   NAMES mtr   PATHS  ${CUDD_ROOT}/mtr)
+## Hack: In some linux systems, the library /lib64/libutil.so exists
+## but it has nothing to do with cudd. Even if we use NO_DEFAULT_PATH
+## when CUDD_ROOT is not defined CUDD_UTIL_LIBRARY can be set to the
+## wrong library.
+if (CUDD_CUDD_LIBRARY)
+   find_library(CUDD_UTIL_LIBRARY util PATHS ${CUDD_ROOT}/lib NO_DEFAULT_PATH)
+endif()
+find_library(CUDD_MTR_LIBRARY NAMES mtr PATHS ${CUDD_ROOT}/lib)

 mark_as_advanced (CUDD_CUDD_LIBRARY CUDD_DDDMP_LIBRARY CUDD_EPD_LIBRARY
   CUDD_ST_LIBRARY CUDD_UTIL_LIBRARY CUDD_MTR_LIBRARY)


CMake fixes for FFTW under SnowLeopard

CMake fixes for FFTW under SnowLeopard

Original commit by Oliver Kohlbacher

--- cmake/FindFFTW.cmake
+++ cmake/FindFFTW.cmake
@@ -43,6 +43,8 @@
     ${FFTW_INSTALL_BASE_PATH}/lib
     /usr/lib/fftw
     /usr/local/lib/fftw
+		/opt/lib/fftw
+		/opt/local/lib/fftw
   )

   IF(USE_FFTWD)


Adjust glfw find script

Adjust glfw find script

--- cmake/FindGLFW.cmake
+++ cmake/FindGLFW.cmake
@@ -51,5 +51,5 @@

 # GLFW is required to link statically for now (no deploy specified)

-find_package_handle_standard_args(GLFW REQUIRED_VARS GLFW_INCLUDE_DIR GLFW_LIBRARY)
-mark_as_advanced(GLFW_INCLUDE_DIR GLFW_LIBRARY)
+find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_LIBRARY GLFW_INCLUDE_DIR)
+mark_as_advanced(GLFW_FOUND GLFW_INCLUDE_DIR GLFW_LIBRARY)


Fix for AliEn warnings

Fix for AliEn warnings

--- cmake/FindROOT.cmake
+++ cmake/FindROOT.cmake
@@ -148,12 +148,25 @@
     	    if(ALIEN)
         	add_definitions(-DWITHALIEN)

-        	# AliEn might bring some system libraries, we need to follow them
-        	link_directories(${ALIEN}/lib)
-        	link_directories(${ALIEN}/api/lib)
+        	# AliEn might bring some system libraries, we need to use them
+        	if(EXISTS "${ALIEN}/lib")
+        	    link_directories(${ALIEN}/lib)
+        	endif()
+
+        	# api/lib should always exists
+        	if(EXISTS "${ALIEN}/api/lib")
+        	    link_directories(${ALIEN}/api/lib)
+        	endif()

         	# include for AliEn
-        	include_directories(${ALIEN}/include)
+        	if(EXISTS "${ALIEN}/include")
+        	    include_directories(${ALIEN}/include)
+        	endif()
+
+        	# api/include always exists
+        	if(EXISTS "${ALIEN}/api/include")
+        	    include_directories(${ALIEN}/api/include)
+        	endif()

         	set(ROOT_HASALIEN TRUE)
     	    else(ALIEN)