hector_timing: disable hector_timing unless explicitly switched on with cmake option -DUSE_HECTOR_TIMING=ON

--- hector_timing/cmake/hector_timing-extras.cmake
+++ hector_timing/cmake/hector_timing-extras.cmake
@@ -1,4 +1,4 @@
-option(USE_HECTOR_TIMING "Compile with hector_timing support. This will add the USE_HECTOR_TIMING define flag and link to hector_timing." ON)
+option(USE_HECTOR_TIMING "Compile with hector_timing support. This will add the USE_HECTOR_TIMING define flag and link to hector_timing." OFF)
 if(USE_HECTOR_TIMING)
   message(STATUS "Building with hector_timing support.")
   add_definitions(-DUSE_HECTOR_TIMING)


use setup.py in installation (#575)

use setup.py in installation (#575)

[travis skip]

--- SuperBuild/External_CIL-ASTRA.cmake
+++ SuperBuild/External_CIL-ASTRA.cmake
@@ -57,7 +57,7 @@

       CONFIGURE_COMMAND ""
       BUILD_COMMAND ""
-      INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${${proj}_SOURCE_DIR}/Wrappers/Python/cil/plugins/astra ${PYTHON_DEST}/cil/plugins/astra
+      INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir ${${proj}_SOURCE_DIR}/Wrappers/Python/ ${PYTHON_EXECUTABLE} setup.py install --install-lib ${PYTHON_DEST}
       CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${${proj}_INSTALL_DIR}
       DEPENDS ${${proj}_DEPENDENCIES}
     )


CMake: Add a check to ensure a working MPI interface

--- cmake/configure/configure_1_mpi.cmake
+++ cmake/configure/configure_1_mpi.cmake
@@ -1,6 +1,6 @@
 ## ---------------------------------------------------------------------
 ##
-## Copyright (C) 2012 - 2015 by the deal.II authors
+## Copyright (C) 2012 - 2016 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -28,7 +28,25 @@
         "Could not find a sufficient MPI version: "
         "Your MPI implementation must define MPI_SEEK_SET.")
       SET(MPI_ADDITIONAL_ERROR_STRING
-        "Your MPI implementation must define MPI_SEEK_SET.")
+        "Your MPI implementation must define MPI_SEEK_SET.\n")
+      SET(${var} FALSE)
+    ENDIF()
+
+    CHECK_COMPILER_SETUP(
+      "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_SAVED} ${MPI_CXX_FLAGS}"
+      "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_SAVED} ${MPI_LINKER_FLAGS}"
+      MPI_WORKING_COMPILER
+      ${DEAL_II_LIBRARIES} ${MPI_LIBRARIES}
+      )
+
+    IF(NOT MPI_WORKING_COMPILER)
+      MESSAGE(STATUS "Could not find a sufficient MPI installation: "
+        "Unable to compile a simple test program."
+        )
+      SET(MPI_ADDITIONAL_ERROR_STRING
+        ${MPI_ADDITIONAL_ERROR_STRING}
+        "Unable to compile and link a simple test program with your MPI installation. \n"
+        )
       SET(${var} FALSE)
     ENDIF()
   ENDIF()


Fix march flag in unittest

Fix march flag in unittest

--- cmake/modules/AddSwiftUnittests.cmake
+++ cmake/modules/AddSwiftUnittests.cmake
@@ -49,7 +49,7 @@
     set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES "log")
   elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
     set_property(TARGET "${test_dirname}" APPEND PROPERTY COMPILE_FLAGS
-      "-march=core2")
+      "-Xcc -march=core2")
   endif()

   find_program(LDLLD_PATH "ld.lld")


cmake: Fix FindTelepathyGlib.cmake by letting it fail correctly if the version is < than the specified one.

--- cmake/modules/FindTelepathyGlib.cmake
+++ cmake/modules/FindTelepathyGlib.cmake
@@ -29,21 +29,26 @@
     set(TELEPATHY_GLIB_DEFINITIONS ${PC_TELEPATHY_GLIB_CFLAGS_OTHER})
 endif (NOT WIN32)

-find_path(TELEPATHY_GLIB_INCLUDE_DIR telepathy-glib/client.h
-   PATHS
-   ${PC_TELEPATHY_GLIB_INCLUDEDIR}
-   ${PC_TELEPATHY_GLIB_INCLUDE_DIRS}
-   PATH_SUFFIXES telepathy-1.0
-   )
+if (TELEPATHY_GLIB_MIN_VERSION AND PKG_CONFIG_FOUND AND NOT PC_TELEPATHY_GLIB_FOUND)
+    message(STATUS "Telepathy-glib not found or its version is < ${TELEPATHY_GLIB_MIN_VERSION}")
+else (TELEPATHY_GLIB_MIN_VERSION AND PKG_CONFIG_FOUND AND NOT PC_TELEPATHY_GLIB_FOUND)
+    find_path(TELEPATHY_GLIB_INCLUDE_DIR telepathy-glib/client.h
+       PATHS
+       ${PC_TELEPATHY_GLIB_INCLUDEDIR}
+       ${PC_TELEPATHY_GLIB_INCLUDE_DIRS}
+       PATH_SUFFIXES telepathy-1.0
+    )

-find_library(TELEPATHY_GLIB_LIBRARIES NAMES telepathy-glib
-   PATHS
-   ${PC_TELEPATHY_GLIB_LIBDIR}
-   ${PC_TELEPATHY_GLIB_LIBRARY_DIRS}
-   )
+    find_library(TELEPATHY_GLIB_LIBRARIES NAMES telepathy-glib
+       PATHS
+       ${PC_TELEPATHY_GLIB_LIBDIR}
+       ${PC_TELEPATHY_GLIB_LIBRARY_DIRS}
+    )

-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(TelepathyGlib DEFAULT_MSG TELEPATHY_GLIB_LIBRARIES
-                                                            TELEPATHY_GLIB_INCLUDE_DIR)
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(TelepathyGlib DEFAULT_MSG TELEPATHY_GLIB_LIBRARIES
+                                                                TELEPATHY_GLIB_INCLUDE_DIR)

-mark_as_advanced(TELEPATHY_GLIB_INCLUDE_DIR TELEPATHY_GLIB_LIBRARIES)
+    mark_as_advanced(TELEPATHY_GLIB_INCLUDE_DIR TELEPATHY_GLIB_LIBRARIES)
+
+endif (TELEPATHY_GLIB_MIN_VERSION AND PKG_CONFIG_FOUND AND NOT PC_TELEPATHY_GLIB_FOUND)


removed empty commit from previous PR

removed empty commit from previous PR

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -117,7 +117,6 @@
     )
 endif ()

-##
 option (PROFILING "Allow profiling and debug" OFF)
 if (PROFILING)
   set_cflags_if_supported(


PATH-192 WIP adjusting cmake build for physics extensions

--- indra/cmake/LLPhysicsExtensions.cmake
+++ indra/cmake/LLPhysicsExtensions.cmake
@@ -1,14 +1,14 @@
 # -*- cmake -*-
 include(Prebuilt)

-use_prebuilt_binary(llpysicsextensions)
+use_prebuilt_binary(llphysicsextensions)
 set(LLPHYSICS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/lib/include)

 set(LLPHYSICS_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug)
 set(LLPHYSICS_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release)

-find_library(LL_PHYSICS_DEBUG_LIB llpathinglib PATHS ${LLPHYSICS_DEBUG_LIBRARY_PATH})
-find_library(LL_PHYSICS_RELEASE_LIB llpathinglib PATHS ${LLPHYSICS_RELEASE_LIBRARY_PATH})
+find_library(LL_PHYSICS_DEBUG_LIB llphysicsextensions PATHS ${LLPHYSICS_DEBUG_LIBRARY_PATH})
+find_library(LL_PHYSICS_RELEASE_LIB llphysicsextensions PATHS ${LLPHYSICS_RELEASE_LIBRARY_PATH})

 set(LLPHYSICS_LIBRARIES


Bump required ISPC version to 1.9.1 (for SKX target)

--- components/ospcommon/cmake/ispc.cmake
+++ components/ospcommon/cmake/ispc.cmake
@@ -15,7 +15,7 @@
 ## ======================================================================== ##

 # ISPC versions to look for, in decending order (newest first)
-SET(ISPC_VERSION_WORKING "1.9.1" "1.9.0")
+SET(ISPC_VERSION_WORKING "1.9.1")
 LIST(GET ISPC_VERSION_WORKING -1 ISPC_VERSION_REQUIRED)

 IF (NOT ISPC_EXECUTABLE)
@@ -155,12 +155,7 @@
       LIST(APPEND ISPC_TARGETS sse2)
     ENDIF()
     FOREACH(target ${ISPC_TARGETS})
-      # in v1.9.0 ISPC changed the ISA suffix of avx512knl-i32x16 to just 'avx512knl'
-      IF (${target} STREQUAL "avx512knl-i32x16" AND NOT ISPC_VERSION VERSION_LESS "1.9.0")
-        SET(target "avx512knl")
-      ELSEIF (${target} STREQUAL "avx512skx-i32x16")
-        SET(target "avx512skx")
-      ENDIF()
+      STRING(REPLACE "-i32x16" "" target ${target}) # strip avx512(knl|skx)-i32x16
       SET(results ${results} "${outdir}/${fname}.dev_${target}${ISPC_TARGET_EXT}")
     ENDFOREACH()


Enable static libraries

Enable static libraries

The new ENABLE_SHARED, ENABLE_SHARED_EXECUTABLES, and ENABLE_STATIC
cmake flags give you full control over whether to build shared and/or
static libraries, and whether to link any executables against shared
libraries or static.

--- cmake/FindCTargets.cmake
+++ cmake/FindCTargets.cmake
@@ -8,7 +8,16 @@

 #-----------------------------------------------------------------------
-# Library
+# Configuration options that control all of the below
+
+set(ENABLE_SHARED YES CACHE BOOL "Whether to build a shared library")
+set(ENABLE_SHARED_EXECUTABLES YES CACHE BOOL
+    "Whether to link executables using shared libraries")
+set(ENABLE_STATIC YES CACHE BOOL "Whether to build a static library")
+
+
+#-----------------------------------------------------------------------
+# Library, with options to build both shared and static versions

 function(target_add_shared_libraries TARGET_NAME LIBRARIES LOCAL_LIBRARIES)
     foreach(lib ${LIBRARIES})
@@ -23,6 +32,20 @@
         target_link_libraries(${TARGET_NAME} ${lib}-shared)
     endforeach(lib)
 endfunction(target_add_shared_libraries)
+
+function(target_add_static_libraries TARGET_NAME LIBRARIES LOCAL_LIBRARIES)
+    foreach(lib ${LIBRARIES})
+        string(REPLACE "-" "_" lib ${lib})
+        string(TOUPPER ${lib} upperlib)
+        target_link_libraries(
+            ${TARGET_NAME}
+            ${${upperlib}_STATIC_LIBRARIES}
+        )
+    endforeach(lib)
+    foreach(lib ${LOCAL_LIBRARIES})
+        target_link_libraries(${TARGET_NAME} ${lib}-static)
+    endforeach(lib)
+endfunction(target_add_static_libraries)

 set_property(GLOBAL PROPERTY ALL_LOCAL_LIBRARIES "")

@@ -46,29 +69,61 @@
     list(APPEND ALL_LOCAL_LIBRARIES ${__TARGET_NAME})
     set_property(GLOBAL PROPERTY ALL_LOCAL_LIBRARIES "${ALL_LOCAL_LIBRARIES}")

-    add_library(${__TARGET_NAME}-shared SHARED "${__SOURCES}")
-    set_target_properties(
-        ${__TARGET_NAME}-shared PROPERTIES
-        OUTPUT_NAME ${__OUTPUT_NAME}
-        CLEAN_DIRECT_OUTPUT 1
-        VERSION ${__VERSION}
-        SOVERSION ${__SOVERSION}
-    )
+    if (ENABLE_SHARED OR ENABLE_SHARED_EXECUTABLES)
+        add_library(${__TARGET_NAME}-shared SHARED "${__SOURCES}")
+        set_target_properties(
+            ${__TARGET_NAME}-shared PROPERTIES
+            OUTPUT_NAME ${__OUTPUT_NAME}
+            CLEAN_DIRECT_OUTPUT 1
+            VERSION ${__VERSION}
+            SOVERSION ${__SOVERSION}
+        )

-    target_include_directories(
-        ${__TARGET_NAME}-shared PUBLIC
-        ${CMAKE_SOURCE_DIR}/include
-        ${CMAKE_BINARY_DIR}/include
-    )
+        target_include_directories(
+            ${__TARGET_NAME}-shared PUBLIC
+            ${CMAKE_SOURCE_DIR}/include
+            ${CMAKE_BINARY_DIR}/include
+        )

-    target_add_shared_libraries(
-        ${__TARGET_NAME}-shared
-        "${__LIBRARIES}"
-        "${__LOCAL_LIBRARIES}"
-    )
+        target_add_shared_libraries(
+            ${__TARGET_NAME}-shared
+            "${__LIBRARIES}"
+            "${__LOCAL_LIBRARIES}"
+        )

-    install(TARGETS ${__TARGET_NAME}-shared
-            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+        # We have to install the shared library if the user asked us to, or if
+        # the user asked us to link our programs with the shared library.
+        install(TARGETS ${__TARGET_NAME}-shared
+                LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif (ENABLE_SHARED OR ENABLE_SHARED_EXECUTABLES)
+
+    if (ENABLE_STATIC OR NOT ENABLE_SHARED_EXECUTABLES)
+        add_library(${__TARGET_NAME}-static STATIC "${__SOURCES}")
+        set_target_properties(
+            ${__TARGET_NAME}-static PROPERTIES
+            OUTPUT_NAME ${__OUTPUT_NAME}
+            CLEAN_DIRECT_OUTPUT 1
+        )
+
+        target_include_directories(
+            ${__TARGET_NAME}-static PUBLIC
+            ${CMAKE_SOURCE_DIR}/include
+            ${CMAKE_BINARY_DIR}/include
+        )
+
+        target_add_static_libraries(
+            ${__TARGET_NAME}-static
+            "${__LIBRARIES}"
+            "${__LOCAL_LIBRARIES}"
+        )
+    endif (ENABLE_STATIC OR NOT ENABLE_SHARED_EXECUTABLES)
+
+    if (ENABLE_STATIC)
+        # We DON'T have to install the static library if the user asked us to
+        # link our programs statically.
+        install(TARGETS ${__TARGET_NAME}-static
+                ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif (ENABLE_STATIC)

     set(prefix ${CMAKE_INSTALL_PREFIX})
     configure_file(
@@ -100,11 +155,19 @@
         ${CMAKE_BINARY_DIR}/include
     )

-    target_add_shared_libraries(
-        ${__TARGET_NAME}
-        "${__LIBRARIES}"
-        "${__LOCAL_LIBRARIES}"
-    )
+    if (ENABLE_SHARED_EXECUTABLES)
+        target_add_shared_libraries(
+            ${__TARGET_NAME}
+            "${__LIBRARIES}"
+            "${__LOCAL_LIBRARIES}"
+        )
+    else (ENABLE_SHARED_EXECUTABLES)
+        target_add_static_libraries(
+            ${__TARGET_NAME}
+            "${__LIBRARIES}"
+            "${__LOCAL_LIBRARIES}"
+        )
+    endif (ENABLE_SHARED_EXECUTABLES)

     if (NOT __SKIP_INSTALL)
         install(TARGETS ${__TARGET_NAME} RUNTIME DESTINATION bin)


Update cmake/FindFreeRTOS.cmake

Update cmake/FindFreeRTOS.cmake

Done

Co-authored-by: Julien Staub <0e44a740070fae557fd5ae1ae9f383381457fcd0@yahoo.fr>

--- cmake/FindFreeRTOS.cmake
+++ cmake/FindFreeRTOS.cmake
@@ -19,7 +19,7 @@
     NO_DEFAULT_PATH
 )

-if(FreeRTOS_COMMON_INCLUDE MATCHES "FreeRTOS_COMMON_INCLUDE-NOTFOUND")
+if(NOT FreeRTOS_COMMON_INCLUDE)
     message(WARNING "FreeRTOS common include path not found, build might fail")
 endif()


Fixed regices in FindFreeRTOS.cmake

Fixed regices in FindFreeRTOS.cmake

--- cmake/FindFreeRTOS.cmake
+++ cmake/FindFreeRTOS.cmake
@@ -44,7 +44,7 @@
 # This section fills the family and ports components list
 foreach(COMP ${FreeRTOS_FIND_COMPONENTS})
     string(TOUPPER ${COMP} COMP)
-    string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP})
+    string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP})
     # Valid family component, so add it (e.g. STM32H7)
     if(CMAKE_MATCH_1)
         list(APPEND FreeRTOS_FIND_COMPONENTS_FAMILIES ${FAMILY_COMP})
@@ -207,7 +207,7 @@
         string(TOLOWER ${COMP} COMP_L)
         string(TOUPPER ${COMP} COMP)

-        string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP})
+        string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP})

         if((NOT CMAKE_MATCH_1) AND (NOT CMAKE_MATCH_2))
             message(FATAL_ERROR "Unknown FreeRTOS component: ${COMP}")


Fixed samples install permissions for Debian packaging.

--- cmake/OpenCVModule.cmake
+++ cmake/OpenCVModule.cmake
@@ -893,7 +893,7 @@
     file(GLOB sample_files "${samples_path}/*")
     install(FILES ${sample_files}
             DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/${module_id}
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
+            PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
   endif()
 endfunction()


cmake: increased the /Zm parameter (pch file size in MSVC)

--- cmake/globalconfig.cmake
+++ cmake/globalconfig.cmake
@@ -262,7 +262,7 @@
     add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
     string(REGEX REPLACE "[/\\-]Zm[0-9]+" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ym0x20000000")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm512")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm1000")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")


added functions

added functions

--- cmake/stm32/common.cmake
+++ cmake/stm32/common.cmake
@@ -47,6 +47,24 @@
         ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C}
         COMMENT "Target Sizes: "
         DEPENDS ${TARGET}
+    )
+endfunction()
+
+function(stm32_generate_binary_file TARGET)
+    add_custom_command(
+        TARGET ${TARGET}
+        POST_BUILD
+        COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.bin
+        COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin"
+    )
+endfunction()
+
+function(stm32_generate_hex_file TARGET)
+    add_custom_command(
+        TARGET ${TARGET}
+        POST_BUILD
+        COMMAND ${CMAKE_OBJCOPY} -O ihex ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.hex
+        COMMENT "Generating hex file ${CMAKE_PROJECT_NAME}.hex"
     )
 endfunction()


Switched to -emit-ast parameter

Switched to -emit-ast parameter

--- data/src/ClangOdrCheckToolchain.cmake
+++ data/src/ClangOdrCheckToolchain.cmake
@@ -10,8 +10,7 @@
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/autogenerated.cpp "//this file is autogenerated\n")
 set(link_wrapper_dir d:/pixel/projects/odr-check/odr-check-test/src/data/src)

-
-set(CMAKE_C_COMPILE_OBJECT  "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -x c-header <SOURCE> -o <OBJECT>")
+set(CMAKE_C_COMPILE_OBJECT  "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -emit-ast <SOURCE> -o <OBJECT>")

 set(CMAKE_C_LINK_EXECUTABLE "python ${link_wrapper_dir}/linker-wrapper.py <CMAKE_C_COMPILER> <TARGET> ${CMAKE_CURRENT_BINARY_DIR}/autogenerated.cpp <OBJECTS> <LINK_LIBRARIES>")
@@ -22,7 +21,7 @@
 # C++
 ################################################################################

-set(CMAKE_CXX_COMPILE_OBJECT  "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -x c++-header <SOURCE> -o <OBJECT>")
+set(CMAKE_CXX_COMPILE_OBJECT  "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -emit-ast <SOURCE> -o <OBJECT>")

 set(CMAKE_CXX_LINK_EXECUTABLE "python ${link_wrapper_dir}/linker-wrapper.py <CMAKE_CXX_COMPILER> <TARGET> ${CMAKE_CURRENT_BINARY_DIR}/autogenerated.cpp <OBJECTS> <LINK_LIBRARIES>")
 set(CMAKE_CXX_CREATE_STATIC_LIBRARY "python ${link_wrapper_dir}/linker-wrapper.py <CMAKE_CXX_COMPILER> <TARGET> ${CMAKE_CURRENT_BINARY_DIR}/autogenerated.cpp <OBJECTS>")


Bumped the ParaView SHA for QVTKOpenGLWidget

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


Fixed build options to allow compilation on linux using clang

--- Build.cmake
+++ Build.cmake
@@ -23,7 +23,12 @@
 IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang")
    MESSAGE("")
    MESSAGE("cmake for Clang ")
-   SET(CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++ -Wunused -D_GLIBCXX_USE_NANOSLEEP")
+   SET(CMAKE_CXX_FLAGS "-Wall -std=c++11 -Wunused -D_GLIBCXX_USE_NANOSLEEP")
+   IF (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -pthread")
+   ELSE()
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+   ENDIF()
    IF (${CMAKE_SYSTEM} MATCHES "FreeBSD-([0-9]*)\\.(.*)")
        IF (${CMAKE_MATCH_1} GREATER 9)
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
@@ -31,8 +36,10 @@
        ENDIF()
    ELSEIF (APPLE)
        set(PLATFORM_LINK_LIBRIES c++abi)
+   ELSEIF (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
+       set(PLATFORM_LINK_LIBRIES rt c++abi)
    ELSE()
-       set(PLATFORM_LINK_LIBRIES rt c++abi)
+       set(PLATFORM_LINK_LIBRIES rt)
    ENDIF()


Bumped fallback version number for tomviz

--- cmake/DetermineTomvizVersion.cmake
+++ cmake/DetermineTomvizVersion.cmake
@@ -7,7 +7,7 @@
 #   tomviz_version
 #   tomviz_version_long

-set(hardcoded_tomviz_version "0.7.1")
+set(hardcoded_tomviz_version "0.7.2")

 function(_set_version_vars versiontext)
   string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)" version_matches "${versiontext}")


- Fix for Raspberry Pi binaries, use generator expression when installing

--- cmake/Modules/BuildFunctions.cmake
+++ cmake/Modules/BuildFunctions.cmake
@@ -208,8 +208,8 @@

         # We still install a basic binary executable
         install(
-            TARGETS
-            ${TARGET}
+            FILES
+            "$<TARGET_FILE:${TARGET}>"

             DESTINATION
             bin


Fix value of AMX_PATH being set incorrectly

--- cmake/Modules/SampPluginTest.cmake
+++ cmake/Modules/SampPluginTest.cmake
@@ -50,7 +50,7 @@

 	add_test(${name} "samp-server-cli" ${arguments})
 	set_tests_properties(${name} PROPERTIES
-		ENVIRONMENT "AMX_PATH=${CMAKE_CURRENT_SOURCE_DIR}"
+		ENVIRONMENT "AMX_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${name}"
 		PASS_REGULAR_EXPRESSION "${out}"
 	)
 endfunction()


[cmake] Fix add_version_info_from_vcs git svn version bug.

Summary:
add_version_info_from_vcs was setting SVN_REVISION to the last fetched
svn revision when using git svn instead of the svn revision
corresponding to HEAD.  This leads to conflicts with the definition of
SVN_REVISION in SVNVersion.inc generated by GetSVN.cmake when HEAD is
not the most recently fetched svn revision.

Use 'git svn info' to determine SVN_REVISION when git svn is being used
instead (as is done in GetSVN.cmake).

Reviewers: beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16299

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@258148 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 73c7b058de8838fcecbbda12dabc87edcaec5678)

--- cmake/modules/VersionFromVCS.cmake
+++ cmake/modules/VersionFromVCS.cmake
@@ -27,16 +27,20 @@
       find_program(git_executable NAMES git git.exe git.cmd)
       if( git_executable )
         set(is_git_svn_rev_exact false)
-        execute_process(COMMAND ${git_executable} svn log --limit=1 --oneline
+        execute_process(COMMAND
+          ${git_executable} svn info
           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
           TIMEOUT 5
           RESULT_VARIABLE git_result
           OUTPUT_VARIABLE git_output)
         if( git_result EQUAL 0 )
-          string(REGEX MATCH r[0-9]+ git_svn_rev ${git_output})
-          string(LENGTH "${git_svn_rev}" rev_length)
-          math(EXPR rev_length "${rev_length}-1")
-          string(SUBSTRING "${git_svn_rev}" 1 ${rev_length} git_svn_rev_number)
+          string(REGEX MATCH "URL: ([^ \n]*)" svn_url ${git_output})
+          if(svn_url)
+            set(LLVM_REPOSITORY ${CMAKE_MATCH_1} PARENT_SCOPE)
+          endif()
+
+          string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
+            "\\2" git_svn_rev_number "${git_output}")
           set(SVN_REVISION ${git_svn_rev_number} PARENT_SCOPE)
           set(git_svn_rev "-svn-${git_svn_rev}")

@@ -69,18 +73,6 @@
           set(result "${result}${git_svn_rev}")
         endif()

-        execute_process(COMMAND
-          ${git_executable} svn info
-          WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-          TIMEOUT 5
-          RESULT_VARIABLE git_result
-          OUTPUT_VARIABLE git_output)
-        if( git_result EQUAL 0)
-          string(REGEX MATCH "URL: ([^ \n]*)" svn_url ${git_output})
-          if(svn_url)
-            set(LLVM_REPOSITORY ${CMAKE_MATCH_1} PARENT_SCOPE)
-          endif()
-        endif()
       endif()
     endif()
   endif()


Make sure find_package(qibuild) works when not using `qibuild configure`

This should fix #6872

Change-Id: Ia77bc9a2ee539d3867ebd1b5d0b518cfdab590c3
Reviewed-on: http://gerrit.aldebaran.lan:8080/91
Reviewed-by: Cedric GESTES <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>
Tested-by: Cedric GESTES <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>

--- cmake/qibuild/qibuild-config.cmake
+++ cmake/qibuild/qibuild-config.cmake
@@ -17,5 +17,7 @@
 endif()
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CACHE INTERNAL ""  FORCE)

+# So that find_package(qibuild) works:
+set(qibuild_DIR ${_this_dir} CACHE INTERNAL "" FORCE)
 include(${_this_dir}/general.cmake)


Add missing Qt internal plugin on MacOs (Qt Platform Abstraction, MacStyle)

--- cmake/radium_setup_functions.cmake
+++ cmake/radium_setup_functions.cmake
@@ -105,11 +105,24 @@
     endif ()
 endfunction()

-
-# NOTE that only MacosX is supported for now to handle bundled applications
-# But the script could be generalized to all systems by integrating the bundle structure
-# (MACOSX_BUNDLE* and BundleName.app are explicitly used here)
-#
+# internal Utility function to install Qt internal plugins into a macosX bundle
+macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var _destination)
+    get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
+    if(EXISTS "${_qt_plugin_path}")
+        get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
+        get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH)
+        get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
+        set(_qt_plugin_dest "${_destination}/PlugIns/${_qt_plugin_type}")
+        install(FILES "${_qt_plugin_path}"
+            DESTINATION "${_qt_plugin_dest}")
+        set(${_qt_plugins_var}
+            "${${_qt_plugins_var}};${_qt_plugin_dest}/${_qt_plugin_file}")
+    else()
+        message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found")
+    endif()
+endmacro()
+
+
 # Configuration of the build and installation procedure for bundled Radium application
 # Allows to install application with dependent resources
 # usage :
@@ -156,6 +169,16 @@
             list(APPEND depsRsc ${rscLocation})
         endif ()
     endforeach()
+    # install qtPlugins (QPA plugin name found here https://doc.qt.io/qt-5/qpa.html)
+    get_target_property(IsUsingQt ${ARGS_NAME} LINK_LIBRARIES)
+    list(FIND IsUsingQt "Qt5::Core" QTCOREIDX)
+    if(NOT QTCOREIDX EQUAL -1)
+        message( STATUS " [configure_bundled_Radium_app] installing Qt plugins for ${ARGS_NAME}." )
+        # Find the list of plugins needed for a macos Qt app and add them here
+        install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" INSTALLED_QT_PLUGINS "${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/")
+        install_qt5_plugin("Qt5::QMacStylePlugin" INSTALLED_QT_PLUGINS "${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/")
+    endif()
+    #install Radium plugins
     if (ARGS_USE_PLUGINS)
         install(CODE "
         message(STATUS \"Installing ${ARGS_NAME} with plugins\")
@@ -179,7 +202,7 @@
         foreach (plugin \${RadiumAvailablePlugins})
             list( APPEND InstalledPlugins ${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/Plugins/lib/\${plugin} )
         endforeach ()
-        fixup_bundle(${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app \"\${InstalledPlugins}\" \"${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/Plugins/lib/\")
+        fixup_bundle(${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app \"\${InstalledPlugins};${INSTALLED_QT_PLUGINS}\" \"${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/Plugins/lib/\")
         # fix rpath for plugins that use helper libs (can't load helper.dylib)
         foreach(helper \${InstalledPlugins} )
             # get the name (.dylib) of the helper
@@ -203,7 +226,7 @@
             foreach( rsc \${instRsc})
                 file(COPY \${rsc} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app/Contents/Resources)
             endforeach()
-            fixup_bundle(${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app \"\" \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR};${CMAKE_INSTALL_PREFIX}/lib\")
+            fixup_bundle(${CMAKE_INSTALL_PREFIX}/bin/${ARGS_NAME}.app \"${INSTALLED_QT_PLUGINS}\" \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")
             "
             )
     endif ()


ENH: Fix nightly start time to 9PM EDT as per tcon

--- DartConfig.cmake
+++ DartConfig.cmake
@@ -1,6 +1,6 @@
 # Dashboard is opened for submissions for a 24 hour period starting at
 # the specified NIGHLY_START_TIME. Time is specified in 24 hour format.
-SET (NIGHTLY_START_TIME "1:00:00 EDT")
+SET (NIGHTLY_START_TIME "21:00:00 EDT")

 # Dart server to submit results (used by client)
 IF(NOT DROP_METHOD)
@@ -17,14 +17,14 @@
 ENDIF(DROP_METHOD MATCHES http)

 SET (TRIGGER_SITE
-  "http://${DROP_SITE}/cgi-bin/Submit-Insight-TestingResults.pl")
+  "http://${DROP_SITE}/cgi-bin/Submit-Insight-TestingResults.cgi")

 # Project Home Page
 SET (PROJECT_URL "http://www.itk.org/")

 # Dart server configuration
 SET (ROLLUP_URL "http://${DROP_SITE}/cgi-bin/insight-rollup-dashboard.sh")
-SET (CVS_WEB_URL "http://${DROP_SITE}/cgi-bin/cvsweb.cgi/Insight/")
+SET (CVS_WEB_URL "http://${DROP_SITE}/cgi-bin/viewcvs.cgi/")
 SET (CVS_WEB_CVSROOT "Insight")

 OPTION(BUILD_DOXYGEN "Build source documentation using doxygen" "Off")


remove debug stuff

remove debug stuff

--- cmake/ArangoDBInstall.cmake
+++ cmake/ArangoDBInstall.cmake
@@ -171,30 +171,3 @@
   "${CMAKE_CURRENT_BINARY_DIR}/lib/Basics/directories.h"
   NEWLINE_STYLE UNIX
 )
-
-# sub directories --------------------------------------------------------------
-
-#if(BUILD_STATIC_EXECUTABLES)
-#  set(CMAKE_EXE_LINKER_FLAGS -static)
-#  set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
-#  set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)       # remove -Wl,-Bdynamic
-#  set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
-#  set(CMAKE_SHARED_LIBRARY_C_FLAGS)         # remove -fPIC
-#  set(CMAKE_SHARED_LIBRARY_CXX_FLAGS)
-#  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)    # remove -rdynamic
-#  set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
-#  # Maybe this works as well, haven't tried yet.
-#  # set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
-#else(BUILD_STATIC_EXECUTABLES)
-#  # Set RPATH to use for installed targets; append linker search path
-#  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LOFAR_LIBDIR}")
-#  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-#endif(BUILD_STATIC_EXECUTABLES)
-
-
-#--------------------------------------------------------------------------------
-#get_cmake_property(_variableNames VARIABLES)
-#foreach (_variableName ${_variableNames})
-#    message(STATUS "${_variableName}=${${_variableName}}")
-#endforeach()
-#--------------------------------------------------------------------------------


cmake: Fix undefined reference to gss_* symbols when libkrb5-dev package not installed

This commit is a follow-up of f929319a9 (cmake: Fix undefined reference to
gss_* symbols when WITH_STATIC_DEPENDENCIES is ON).

If the shared library "libgssapi_krb5.so" can't be found, the build-system
is updated to assume the static libraries are required.

Indeed, without installing the "libkrb5-dev" package, the shared library
"libgssapi_krb5.so" can't be found and the test checking if the tirpc
library was build with or without the gssapi feature can not be performed.

See #227 and #285

--- cmake/ConfigureChecks.cmake
+++ cmake/ConfigureChecks.cmake
@@ -2480,7 +2480,10 @@
       set(_tirpc_library_static_dependencies_required 1)
       set(_tirpc_static_libraries ${GSSAPI_KRB5_STATIC_LIBRARY})
     endif()
-
+  else()
+    # If shared library can't be found, we assume the static library is required.
+    set(_tirpc_library_static_dependencies_required 1)
+    set(_tirpc_static_libraries ${GSSAPI_KRB5_STATIC_LIBRARY})
   endif()

 endif()


Modifying FindMKL to respect i386 and allow ILP64 (#3762)

These changes should not impact the default behavior of the FindMKL
module on 64-bit Linux platforms.

 * Add MKL_USE_ILP64 to allow the ILP64 data model in MKL
 * Add the MKL_USE_CLUSTER option, disabled on 32-bit platforms
 * Limit the gf interface to instances where gfortran is used

--- cmake/Modules/FindMKL.cmake
+++ cmake/Modules/FindMKL.cmake
@@ -5,6 +5,8 @@
 #   MKL_USE_SINGLE_DYNAMIC_LIBRARY  : use single dynamic library interface
 #   MKL_USE_STATIC_LIBS             : use static libraries
 #   MKL_MULTI_THREADED              : use multi-threading
+#   MKL_USE_ILP64                   : use ilp64 data model
+#   MKL_USE_CLUSTER                 : use cluster libraries
 #
 # This module defines the following variables:
 #
@@ -17,6 +19,8 @@
 mxnet_option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library interface" ON)
 mxnet_option(MKL_USE_STATIC_LIBS "Use static libraries" OFF IF NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY)
 mxnet_option(MKL_MULTI_THREADED  "Use multi-threading"   ON IF NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY)
+mxnet_option(MKL_USE_ILP64  "Use ilp64 data model" OFF)
+mxnet_option(MKL_USE_CLUSTER "Use cluster functions" OFF IF CMAKE_SIZEOF_VOID_P EQUAL 4)

 # ---[ Root folders
 set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains intel libs")
@@ -42,10 +46,21 @@
     if(WIN32)
       list(APPEND __mkl_libs intel_c)
     else()
-      list(APPEND __mkl_libs intel gf)
+      list(APPEND __mkl_libs intel)
+      if(CMAKE_COMPILER_IS_GNUFORTRAN)
+        list(APPEND __mkl_libs gf)
+      endif()
     endif()
   else()
-    list(APPEND __mkl_libs intel_lp64 gf_lp64)
+    set(__mkl_lib64_suffix "lp64")
+    if(MKL_USE_ILP64)
+      set(__mkl_lib64_suffix "ilp64")
+      add_definitions(-DMKL_ILP64)
+    endif()
+    list(APPEND __mkl_libs "intel_${__mkl_lib64_suffix}")
+    if(CMAKE_COMPILER_IS_GNUFORTRAN)
+    	list(APPEND __mkl_libs "gf_${__mkl_lib64_suffix}")
+    endif()
   endif()

   if(MKL_MULTI_THREADED)
@@ -54,7 +69,10 @@
      list(APPEND __mkl_libs sequential)
   endif()

-  list(APPEND __mkl_libs core cdft_core)
+  list(APPEND __mkl_libs core)
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MKL_USE_CLUSTER)
+    list(APPEND __mkl_libs cdft_core)
+  endif()
 endif()


suppress lintian warning in opencv.pc

suppress lintian warning in opencv.pc

--- cmake/OpenCVPackaging.cmake
+++ cmake/OpenCVPackaging.cmake
@@ -227,6 +227,32 @@
     endif()
 endfunction()

+function(ocv_get_lintian_version version)
+    find_program(LINTIAN_EXECUTABLE lintian)
+
+    if(NOT LINTIAN_EXECUTABLE)
+        return()
+    endif()
+
+    execute_process(COMMAND ${LINTIAN_EXECUTABLE} --version
+              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+              RESULT_VARIABLE LINTIAN_EXITCODE
+              OUTPUT_VARIABLE LINTIAN_VERSION
+              ERROR_QUIET)
+
+    if(NOT LINTIAN_EXITCODE EQUAL 0)
+        return()
+    endif()
+
+    if(LINTIAN_VERSION MATCHES "([0-9]+\\.[0-9]+\\.[0-9]+)")
+        set(LINTIAN_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "Lintian version")
+    endif()
+
+    set("${version}" "${LINTIAN_VERSION}" PARENT_SCOPE)
+endfunction()
+
+ocv_get_lintian_version(LINTIAN_VERSION)
+
 set(LIBS_LINTIAN_OVERRIDES "binary-or-shlib-defines-rpath" # usr/lib/libopencv_core.so.2.4.12
                            "package-name-doesnt-match-sonames") # libopencv-calib3d2.4 libopencv-contrib2.4

@@ -245,6 +271,11 @@

 set(DEV_LINTIAN_OVERRIDES "binary-or-shlib-defines-rpath" # usr/bin/opencv_traincascade
                           "binary-without-manpage") # usr/bin/opencv_traincascade
+
+if(LINTIAN_VERSION VERSION_GREATER "2.5.30" OR
+    LINTIAN_VERSION VERSION_EQUAL "2.5.30")
+    list(APPEND DEV_LINTIAN_OVERRIDES "pkg-config-bad-directive") # usr/lib/pkgconfig/opencv.pc -L/usr/local/cuda-7.0/lib64
+endif()

 if(NOT INSTALL_C_EXAMPLES)
     set(SAMPLES_LINTIAN_OVERRIDES "empty-binary-package") # samples are not installed


Tweak message when onsgmls is not found.

svn path=/trunk/; revision=11360

--- cmake/modules/docbook.cmake
+++ cmake/modules/docbook.cmake
@@ -56,7 +56,7 @@
 if(ONSGMLS )
   message(STATUS "validate target will be available to check for syntax issues in the PLplot DocBook documentation using ${ONSGMLS}.")
 else(ONSGMLS )
-  message(STATUS "WARNING: validate target will not be available to check for syntax errors in the PLplot DocBook documentation because onsgmls was not found.")
+  message(STATUS "WARNING: validate target will not be available to check for syntax issues in the PLplot DocBook documentation because onsgmls was not found.")
 endif(ONSGMLS )

 # Check for required programs and perl libraries.


Avoid variable expansion and stripping leading spaces in 'read_line' on Windows.

--- cmake/shell/read_line.cmake
+++ cmake/shell/read_line.cmake
@@ -5,7 +5,7 @@
   ans(value_file)

   if(WIN32)
-    file_tmp("bat" "@echo off\nset val=\nset /p val=\necho | set /p dummyName=\"%val%\"> ${value_file}")
+    file_tmp("bat" "@echo off\nsetlocal EnableDelayedExpansion\nset val=\nset /p val=\necho !val!> \"${value_file}\"")
     ans(shell_script)
   else()
     file_tmp("sh" "#!/bin/bash\nread text\necho -n $text>${value_file}")
@@ -15,9 +15,14 @@
   endif()

   # execute shell script which write the keyboard input to the ${value_file}
-  execute_process(COMMAND  "${shell_script}")
+  execute_process(COMMAND "${shell_script}")
+
   # read value file
   file(READ "${value_file}" line)
+
+  # strip trailing '\n'
+  string(REGEX REPLACE "(.*)\n$" "\\1" line "${line}")
+
   # remove temp files
   file(REMOVE "${shell_script}")
   file(REMOVE "${value_file}")


Added mention of ICU_VERSION.

Added mention of ICU_VERSION.

--- cmake_modules/FindICU.cmake
+++ cmake_modules/FindICU.cmake
@@ -27,6 +27,8 @@
 #  ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
 #                       (note: in addition to ICU_LIBRARIES)
 #  ICU_DATA_LIBRARIES - Libraries to link against for ICU data
+#
+#  ICU_VERSION        - ICU's version number.
 #

 # Look for the header file.


Adding libdl to OSMesa16 link line

Adding libdl to OSMesa16 link line

--- indra/cmake/OpenGL.cmake
+++ indra/cmake/OpenGL.cmake
@@ -6,7 +6,7 @@
 if (BUILD_HEADLESS)
   use_prebuilt_binary(mesa)
   SET(OPENGL_glu_LIBRARY GLU)
-  SET(OPENGL_HEADLESS_LIBRARIES OSMesa16 GLU)
+  SET(OPENGL_HEADLESS_LIBRARIES OSMesa16 dl GLU)
 endif (BUILD_HEADLESS)

 include(FindOpenGL)


It is safe to use Python 2.7 on Windows, if present

--- indra/cmake/Python.cmake
+++ indra/cmake/Python.cmake
@@ -9,10 +9,12 @@
     NAMES python25.exe python23.exe python.exe
     NO_DEFAULT_PATH # added so that cmake does not find cygwin python
     PATHS
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]


qt4.cmake: Don't build accessibility module, since causes build issues on Ubuntu.

--- qt4.cmake
+++ qt4.cmake
@@ -82,7 +82,7 @@
         -no-dbus
         -no-cups
         -no-nis
-        #-no-accessibility # Must include accessibility because PySide tries to build wrappers for it.
+        -no-accessibility # accessibility causes PyQt build issues on Ubuntu and Mavericks, but PySide can't build without it.
         -release
         -shared
         -fontconfig


Removed incorrect use of unset

Removed incorrect use of unset

--- scripts/CallPython.cmake
+++ scripts/CallPython.cmake
@@ -9,7 +9,5 @@
    if(result EQUAL 0)
        string(STRIP "${output}" output)
        set(${OUTPUT} "${output}" PARENT_SCOPE)
-   else()
-       unset(${OUTPUT} PARENT_SCOPE)
    endif()
 endfunction()


Working on detecting hdf5 from modules

Working on detecting hdf5 from modules

Former-commit-id: c10d391f1cf2010b1c3e101f1d04e2afb9953e07

--- cmake-modules/FindPackageHDF5.cmake
+++ cmake-modules/FindPackageHDF5.cmake
@@ -67,9 +67,15 @@
         if(HDF5_ENABLE_Z_LIB_SUPPORT)
             target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
         endif()
-        target_include_directories(hdf5
+        target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
+    elseif(HDF5_INCLUDE_DIR MATCHES "conda3")
+
+        target_link_libraries(hdf5
                 INTERFACE
-                ${HDF5_INCLUDE_DIR}
+                ${HDF5_hdf5_hl_LIBRARY}
+                ${HDF5_hdf5_LIBRARY}
+                $<LINK_ONLY:-ldl -lm -lz>
+                ${PTHREAD_LIBRARY}
                 )

     else()
@@ -91,10 +97,6 @@
         if(HDF5_C_LIBRARY_z)
             target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
         endif()
-        target_include_directories(
-                hdf5
-                INTERFACE
-                ${HDF5_INCLUDE_DIR}
-        )
+        target_include_directories(hdf5 INTERFACE ${HDF5_INCLUDE_DIR})
     endif()
 endif()


Fix NVCC deprecation warnings from tex_ref_input_iterator

Add `-Wno-deprecated-declarations` flag to nvcc. We already
do this for GCC/Clang, this just adds the flag for nvcc itself.

--- cmake/CubBuildCompilerTargets.cmake
+++ cmake/CubBuildCompilerTargets.cmake
@@ -115,5 +115,10 @@
     $<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CUDA_COMPILER_ID:NVIDIA>>:-Xcudafe=--promote_warnings>
     # Don't complain about deprecated GPU targets.
     $<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CUDA_COMPILER_ID:NVIDIA>>:-Wno-deprecated-gpu-targets>
+    # Suppress deprecation warnings in nvcc < 11.5.
+    # TexRefInputIterator uses deprecated CUDART APIs, see NVIDIA/cub#191.
+    # After 11.5, we will suppress these in-code via pragma, but for older nvcc
+    # we have to use the big hammer:
+    $<$<AND:$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>,$<VERSION_LESS:$<CUDA_COMPILER_VERSION>,11.5>>:-Wno-deprecated-declarations>
   )
 endfunction()


Reverted matthias kretz's OptimizeForArchitecture

--- cmake/OptimizeForArchitecture.cmake
+++ cmake/OptimizeForArchitecture.cmake
@@ -1,23 +1,5 @@
-# Determine the host CPU feature set and determine the best set of compiler
-# flags to enable all supported SIMD relevant features. Alternatively, the
-# target CPU can be explicitly selected (for generating more generic binaries
-# or for targeting a different system).
-# Compilers provide e.g. the -march=native flag to achieve a similar result.
-# This fails to address the need for building for a different microarchitecture
-# than the current host.
-# The script tries to deduce all settings from the model and family numbers of
-# the CPU instead of reading the CPUID flags from e.g. /proc/cpuinfo. This makes
-# the detection more independent from the CPUID code in the kernel (e.g. avx2 is
-# not listed on older kernels).
-#
-# Usage:
-# OptimizeForArchitecture()
-# If either of Vc_SSE_INTRINSICS_BROKEN, Vc_AVX_INTRINSICS_BROKEN,
-# Vc_AVX2_INTRINSICS_BROKEN is defined and set, the OptimizeForArchitecture
-# macro will consequently disable the relevant features via compiler flags.
-
 #=============================================================================
-# Copyright 2010-2015 Matthias Kretz <kretz@kde.org>
+# Copyright 2010-2013 Matthias Kretz <kretz@kde.org>
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -25,12 +7,15 @@
 #
 #  * Redistributions of source code must retain the above copyright notice,
 #    this list of conditions and the following disclaimer.
+#
 #  * Redistributions in binary form must reproduce the above copyright notice,
 #    this list of conditions and the following disclaimer in the documentation
 #    and/or other materials provided with the distribution.
-#  * Neither the names of contributing organizations nor the
-#    names of its contributors may be used to endorse or promote products
-#    derived from this software without specific prior written permission.
+#
+#  * The names of Kitware, Inc., the Insight Consortium, or the names of
+#    any consortium members, or of any contributors, may not be used to
+#    endorse or promote products derived from this software without
+#    specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -46,7 +31,7 @@

 get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
 include("${_currentDir}/AddCompilerFlag.cmake")
-include(CheckIncludeFileCXX)
+include(CheckIncludeFile)

 macro(_my_find _list _value _ret)
    list(FIND ${_list} "${_value}" _found)
@@ -85,58 +70,47 @@
    endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    if(_vendor_id STREQUAL "GenuineIntel")
       if(_cpu_family EQUAL 6)
-         # taken from the Intel ORM
-         # http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
-         # CPUID Signature Values of Of Recent Intel Microarchitectures
-         # 4E 5E       | Skylake microarchitecture
-         # 3D 47 56    | Broadwell microarchitecture
-         # 3C 45 46 3F | Haswell microarchitecture
-         # 3A 3E       | Ivy Bridge microarchitecture
-         # 2A 2D       | Sandy Bridge microarchitecture
-         # 25 2C 2F    | Intel microarchitecture Westmere
-         # 1A 1E 1F 2E | Intel microarchitecture Nehalem
-         # 17 1D       | Enhanced Intel Core microarchitecture
-         # 0F          | Intel Core microarchitecture
-         #
-         # Values from the Intel SDE:
-         # 5C | Goldmont
-         # 5A | Silvermont
-         # 57 | Knights Landing
-         # 66 | Cannonlake
-         # 55 | Skylake Server
-         # 4E | Skylake Client
-         # 3C | Broadwell (likely a bug in the SDE)
-         # 3C | Haswell
-         if(_cpu_model EQUAL 87)
-            set(TARGET_ARCHITECTURE "knl")  # Knights Landing
-         elseif(_cpu_model EQUAL 92)
-            set(TARGET_ARCHITECTURE "goldmont")
-         elseif(_cpu_model EQUAL 90)
-            set(TARGET_ARCHITECTURE "silvermont")
-         elseif(_cpu_model EQUAL 102)
-            set(TARGET_ARCHITECTURE "cannonlake")
-         elseif(_cpu_model EQUAL 85) # 55
-            set(TARGET_ARCHITECTURE "skylake-avx512")
-         elseif(_cpu_model EQUAL 78 OR _cpu_model EQUAL 94) # 4E, 5E
-            set(TARGET_ARCHITECTURE "skylake")
-         elseif(_cpu_model EQUAL 61 OR _cpu_model EQUAL 71 OR _cpu_model EQUAL 86)
+         # Any recent Intel CPU except NetBurst
+         if(_cpu_model EQUAL 70)
+            set(TARGET_ARCHITECTURE "haswell")
+         elseif(_cpu_model EQUAL 63)
+            set(TARGET_ARCHITECTURE "haswell")
+         elseif(_cpu_model EQUAL 62)
+            set(TARGET_ARCHITECTURE "ivy-bridge")
+         elseif(_cpu_model EQUAL 61)
             set(TARGET_ARCHITECTURE "broadwell")
-         elseif(_cpu_model EQUAL 60 OR _cpu_model EQUAL 69 OR _cpu_model EQUAL 70 OR _cpu_model EQUAL 63)
+         elseif(_cpu_model EQUAL 60)
             set(TARGET_ARCHITECTURE "haswell")
-         elseif(_cpu_model EQUAL 58 OR _cpu_model EQUAL 62)
+         elseif(_cpu_model EQUAL 60)
+            set(TARGET_ARCHITECTURE "haswell")
+         elseif(_cpu_model EQUAL 58)
             set(TARGET_ARCHITECTURE "ivy-bridge")
-         elseif(_cpu_model EQUAL 42 OR _cpu_model EQUAL 45)
+         elseif(_cpu_model EQUAL 47) # Xeon E7 4860
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 46) # Xeon 7500 series
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 45) # Xeon TNG
             set(TARGET_ARCHITECTURE "sandy-bridge")
-         elseif(_cpu_model EQUAL 37 OR _cpu_model EQUAL 44 OR _cpu_model EQUAL 47)
+         elseif(_cpu_model EQUAL 44) # Xeon 5600 series
             set(TARGET_ARCHITECTURE "westmere")
-         elseif(_cpu_model EQUAL 26 OR _cpu_model EQUAL 30 OR _cpu_model EQUAL 31 OR _cpu_model EQUAL 46)
+         elseif(_cpu_model EQUAL 42) # Core TNG
+            set(TARGET_ARCHITECTURE "sandy-bridge")
+         elseif(_cpu_model EQUAL 37) # Core i7/i5/i3
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 31) # Core i7/i5
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 30) # Core i7/i5
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 29)
+            set(TARGET_ARCHITECTURE "penryn")
+         elseif(_cpu_model EQUAL 28)
+            set(TARGET_ARCHITECTURE "atom")
+         elseif(_cpu_model EQUAL 26)
             set(TARGET_ARCHITECTURE "nehalem")
-         elseif(_cpu_model EQUAL 23 OR _cpu_model EQUAL 29)
+         elseif(_cpu_model EQUAL 23)
             set(TARGET_ARCHITECTURE "penryn")
          elseif(_cpu_model EQUAL 15)
             set(TARGET_ARCHITECTURE "merom")
-         elseif(_cpu_model EQUAL 28)
-            set(TARGET_ARCHITECTURE "atom")
          elseif(_cpu_model EQUAL 14)
             set(TARGET_ARCHITECTURE "core")
          elseif(_cpu_model LESS 14)
@@ -178,15 +152,7 @@
 endmacro()

 macro(OptimizeForArchitecture)
-   set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. \
-Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used. \
-Setting the value to \"auto\" will try to optimize for the architecture where cmake is called. \
-Other supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \
-\"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \
-\"haswell\", \"broadwell\", \"skylake\", \"skylake-avx512\", \"cannonlake\", \"silvermont\", \
-\"goldmont\", \"knl\" (Knights Landing), \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \
-\"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \
-\"AMD 14h\", \"AMD 16h\".")
+   set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \"haswell\", \"broadwell\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \"AMD 14h\", \"AMD 16h\".")
    set(_force)
    if(NOT _last_target_arch STREQUAL "${TARGET_ARCHITECTURE}")
       message(STATUS "target changed from \"${_last_target_arch}\" to \"${TARGET_ARCHITECTURE}\"")
@@ -204,58 +170,6 @@
       message(STATUS "Detected CPU: ${TARGET_ARCHITECTURE}")
    endif(TARGET_ARCHITECTURE STREQUAL "auto")

-   macro(_nehalem)
-      list(APPEND _march_flag_list "nehalem")
-      list(APPEND _march_flag_list "corei7")
-      list(APPEND _march_flag_list "core2")
-      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2")
-   endmacro()
-   macro(_westmere)
-      list(APPEND _march_flag_list "westmere")
-      _nehalem()
-   endmacro()
-   macro(_sandybridge)
-      list(APPEND _march_flag_list "sandybridge")
-      list(APPEND _march_flag_list "corei7-avx")
-      _westmere()
-      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx")
-   endmacro()
-   macro(_ivybridge)
-      list(APPEND _march_flag_list "ivybridge")
-      list(APPEND _march_flag_list "core-avx-i")
-      _sandybridge()
-      list(APPEND _available_vector_units_list "rdrnd" "f16c")
-   endmacro()
-   macro(_haswell)
-      list(APPEND _march_flag_list "haswell")
-      list(APPEND _march_flag_list "core-avx2")
-      _ivybridge()
-      list(APPEND _available_vector_units_list "avx2" "fma" "bmi" "bmi2")
-   endmacro()
-   macro(_broadwell)
-      list(APPEND _march_flag_list "broadwell")
-      _haswell()
-   endmacro()
-   macro(_skylake)
-      list(APPEND _march_flag_list "skylake")
-      _broadwell()
-   endmacro()
-   macro(_skylake_avx512)
-      list(APPEND _march_flag_list "skylake-avx512")
-      _skylake()
-      list(APPEND _available_vector_units_list "avx512f" "avx512cd" "avx512dq" "avx512bw" "avx512vl")
-   endmacro()
-   macro(_cannonlake)
-      list(APPEND _march_flag_list "cannonlake")
-      _skylake_avx512()
-      list(APPEND _available_vector_units_list "avx512ifma" "avx512vbmi")
-   endmacro()
-   macro(_knightslanding)
-      list(APPEND _march_flag_list "knl")
-      _broadwell()
-      list(APPEND _available_vector_units_list "avx512f" "avx512pf" "avx512er" "avx512cd")
-   endmacro()
-
    if(TARGET_ARCHITECTURE STREQUAL "core")
       list(APPEND _march_flag_list "core2")
       list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
@@ -274,26 +188,38 @@
       else()
          message(STATUS "SSE4.1: disabled (auto-detected from this computer's CPU flags)")
       endif()
-   elseif(TARGET_ARCHITECTURE STREQUAL "knl")
-      _knightslanding()
-   elseif(TARGET_ARCHITECTURE STREQUAL "cannonlake")
-      _cannonlake()
-   elseif(TARGET_ARCHITECTURE STREQUAL "skylake-xeon" OR TARGET_ARCHITECTURE STREQUAL "skylake-avx512")
-      _skylake_avx512()
-   elseif(TARGET_ARCHITECTURE STREQUAL "skylake")
-      _skylake()
+   elseif(TARGET_ARCHITECTURE STREQUAL "nehalem")
+      list(APPEND _march_flag_list "nehalem")
+      list(APPEND _march_flag_list "corei7")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2")
+   elseif(TARGET_ARCHITECTURE STREQUAL "westmere")
+      list(APPEND _march_flag_list "westmere")
+      list(APPEND _march_flag_list "corei7")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2")
+   elseif(TARGET_ARCHITECTURE STREQUAL "haswell")
+      list(APPEND _march_flag_list "core-avx2")
+      list(APPEND _march_flag_list "core-avx-i")
+      list(APPEND _march_flag_list "corei7-avx")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx" "avx2" "rdrnd" "f16c" "fma")
    elseif(TARGET_ARCHITECTURE STREQUAL "broadwell")
-      _broadwell()
-   elseif(TARGET_ARCHITECTURE STREQUAL "haswell")
-      _haswell()
+      list(APPEND _march_flag_list "core-avx2")
+      list(APPEND _march_flag_list "core-avx-i")
+      list(APPEND _march_flag_list "corei7-avx")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx" "avx2" "rdrnd" "f16c" "fma")
    elseif(TARGET_ARCHITECTURE STREQUAL "ivy-bridge")
-      _ivybridge()
+      list(APPEND _march_flag_list "core-avx-i")
+      list(APPEND _march_flag_list "corei7-avx")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx" "rdrnd" "f16c")
    elseif(TARGET_ARCHITECTURE STREQUAL "sandy-bridge")
-      _sandybridge()
-   elseif(TARGET_ARCHITECTURE STREQUAL "westmere")
-      _westmere()
-   elseif(TARGET_ARCHITECTURE STREQUAL "nehalem")
-      _nehalem()
+      list(APPEND _march_flag_list "sandybridge")
+      list(APPEND _march_flag_list "corei7-avx")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx")
    elseif(TARGET_ARCHITECTURE STREQUAL "atom")
       list(APPEND _march_flag_list "atom")
       list(APPEND _march_flag_list "core2")
@@ -354,84 +280,113 @@
    if(NOT TARGET_ARCHITECTURE STREQUAL "none")
       set(_disable_vector_unit_list)
       set(_enable_vector_unit_list)
+      _my_find(_available_vector_units_list "sse2" SSE2_FOUND)
+      _my_find(_available_vector_units_list "sse3" SSE3_FOUND)
+      _my_find(_available_vector_units_list "ssse3" SSSE3_FOUND)
+      _my_find(_available_vector_units_list "sse4.1" SSE4_1_FOUND)
+      _my_find(_available_vector_units_list "sse4.2" SSE4_2_FOUND)
+      _my_find(_available_vector_units_list "sse4a" SSE4a_FOUND)
       if(DEFINED Vc_AVX_INTRINSICS_BROKEN AND Vc_AVX_INTRINSICS_BROKEN)
-         UserWarning("AVX disabled per default because of old/broken toolchain")
-         set(_avx_broken true)
-         set(_avx2_broken true)
-         set(_fma4_broken true)
-         set(_xop_broken true)
+         UserWarning("AVX disabled per default because of old/broken compiler")
+         set(AVX_FOUND false)
+         set(XOP_FOUND false)
+         set(FMA4_FOUND false)
+         set(AVX2_FOUND false)
       else()
-         set(_avx_broken false)
+         _my_find(_available_vector_units_list "avx" AVX_FOUND)
          if(DEFINED Vc_FMA4_INTRINSICS_BROKEN AND Vc_FMA4_INTRINSICS_BROKEN)
-            UserWarning("FMA4 disabled per default because of old/broken toolchain")
-            set(_fma4_broken true)
+            UserWarning("FMA4 disabled per default because of old/broken compiler")
+            set(FMA4_FOUND false)
          else()
-            set(_fma4_broken false)
+            _my_find(_available_vector_units_list "fma4" FMA4_FOUND)
          endif()
          if(DEFINED Vc_XOP_INTRINSICS_BROKEN AND Vc_XOP_INTRINSICS_BROKEN)
-            UserWarning("XOP disabled per default because of old/broken toolchain")
-            set(_xop_broken true)
+            UserWarning("XOP disabled per default because of old/broken compiler")
+            set(XOP_FOUND false)
          else()
-            set(_xop_broken false)
+            _my_find(_available_vector_units_list "xop" XOP_FOUND)
          endif()
          if(DEFINED Vc_AVX2_INTRINSICS_BROKEN AND Vc_AVX2_INTRINSICS_BROKEN)
-            UserWarning("AVX2 disabled per default because of old/broken toolchain")
-            set(_avx2_broken true)
+            UserWarning("AVX2 disabled per default because of old/broken compiler")
+            set(AVX2_FOUND false)
          else()
-            set(_avx2_broken false)
-         endif()
-      endif()
-
-      macro(_enable_or_disable _name _flag _documentation _broken)
-         if(_broken)
-            set(_found false)
-         else()
-            _my_find(_available_vector_units_list "${_flag}" _found)
-         endif()
-         set(USE_${_name} ${_found} CACHE BOOL "${documentation}" ${_force})
-         mark_as_advanced(USE_${_name})
-         if(USE_${_name})
-            list(APPEND _enable_vector_unit_list "${_flag}")
-         else()
-            list(APPEND _disable_vector_unit_list "${_flag}")
-         endif()
-      endmacro()
-      _enable_or_disable(SSE2 "sse2" "Use SSE2. If SSE2 instructions are not enabled the SSE implementation will be disabled." false)
-      _enable_or_disable(SSE3 "sse3" "Use SSE3. If SSE3 instructions are not enabled they will be emulated." false)
-      _enable_or_disable(SSSE3 "ssse3" "Use SSSE3. If SSSE3 instructions are not enabled they will be emulated." false)
-      _enable_or_disable(SSE4_1 "sse4.1" "Use SSE4.1. If SSE4.1 instructions are not enabled they will be emulated." false)
-      _enable_or_disable(SSE4_2 "sse4.2" "Use SSE4.2. If SSE4.2 instructions are not enabled they will be emulated." false)
-      _enable_or_disable(SSE4a "sse4a" "Use SSE4a. If SSE4a instructions are not enabled they will be emulated." false)
-      _enable_or_disable(AVX "avx" "Use AVX. This will all floating-point vector sizes relative to SSE." _avx_broken)
-      _enable_or_disable(FMA "fma" "Use FMA." _avx_broken)
-      _enable_or_disable(BMI2 "bmi2" "Use BMI2." _avx_broken)
-      _enable_or_disable(AVX2 "avx2" "Use AVX2. This will double all of the vector sizes relative to SSE." _avx2_broken)
-      _enable_or_disable(XOP "xop" "Use XOP." _xop_broken)
-      _enable_or_disable(FMA4 "fma4" "Use FMA4." _fma4_broken)
-      _enable_or_disable(AVX512F "avx512f" "Use AVX512F. This will double all floating-point vector sizes relative to AVX2." false)
-      _enable_or_disable(AVX512VL "avx512vl" "Use AVX512VL. This enables 128- and 256-bit vector length instructions with EVEX coding (improved write-masking & more vector registers)." _avx2_broken)
-      _enable_or_disable(AVX512PF "avx512pf" "Use AVX512PF. This enables prefetch instructions for gathers and scatters." false)
-      _enable_or_disable(AVX512ER "avx512er" "Use AVX512ER. This enables exponential and reciprocal instructions." false)
-      _enable_or_disable(AVX512CD "avx512cd" "Use AVX512CD." false)
-      _enable_or_disable(AVX512DQ "avx512dq" "Use AVX512DQ." false)
-      _enable_or_disable(AVX512BW "avx512bw" "Use AVX512BW." false)
-      _enable_or_disable(AVX512IFMA "avx512ifma" "Use AVX512IFMA." false)
-      _enable_or_disable(AVX512VBMI "avx512vbmi" "Use AVX512VBMI." false)
-
+            _my_find(_available_vector_units_list "avx2" AVX2_FOUND)
+         endif()
+      endif()
+      set(USE_SSE2   ${SSE2_FOUND}   CACHE BOOL "Use SSE2. If SSE2 instructions are not enabled the SSE implementation will be disabled." ${_force})
+      set(USE_SSE3   ${SSE3_FOUND}   CACHE BOOL "Use SSE3. If SSE3 instructions are not enabled they will be emulated." ${_force})
+      set(USE_SSSE3  ${SSSE3_FOUND}  CACHE BOOL "Use SSSE3. If SSSE3 instructions are not enabled they will be emulated." ${_force})
+      set(USE_SSE4_1 ${SSE4_1_FOUND} CACHE BOOL "Use SSE4.1. If SSE4.1 instructions are not enabled they will be emulated." ${_force})
+      set(USE_SSE4_2 ${SSE4_2_FOUND} CACHE BOOL "Use SSE4.2. If SSE4.2 instructions are not enabled they will be emulated." ${_force})
+      set(USE_SSE4a  ${SSE4a_FOUND}  CACHE BOOL "Use SSE4a. If SSE4a instructions are not enabled they will be emulated." ${_force})
+      set(USE_AVX    ${AVX_FOUND}    CACHE BOOL "Use AVX. This will double some of the vector sizes relative to SSE." ${_force})
+      set(USE_AVX2   ${AVX2_FOUND}   CACHE BOOL "Use AVX2. This will double all of the vector sizes relative to SSE." ${_force})
+      set(USE_XOP    ${XOP_FOUND}    CACHE BOOL "Use XOP." ${_force})
+      set(USE_FMA4   ${FMA4_FOUND}   CACHE BOOL "Use FMA4." ${_force})
+      mark_as_advanced(USE_SSE2 USE_SSE3 USE_SSSE3 USE_SSE4_1 USE_SSE4_2 USE_SSE4a USE_AVX USE_AVX2 USE_XOP USE_FMA4)
+      if(USE_SSE2)
+         list(APPEND _enable_vector_unit_list "sse2")
+      else(USE_SSE2)
+         list(APPEND _disable_vector_unit_list "sse2")
+      endif(USE_SSE2)
+      if(USE_SSE3)
+         list(APPEND _enable_vector_unit_list "sse3")
+      else(USE_SSE3)
+         list(APPEND _disable_vector_unit_list "sse3")
+      endif(USE_SSE3)
+      if(USE_SSSE3)
+         list(APPEND _enable_vector_unit_list "ssse3")
+      else(USE_SSSE3)
+         list(APPEND _disable_vector_unit_list "ssse3")
+      endif(USE_SSSE3)
+      if(USE_SSE4_1)
+         list(APPEND _enable_vector_unit_list "sse4.1")
+      else(USE_SSE4_1)
+         list(APPEND _disable_vector_unit_list "sse4.1")
+      endif(USE_SSE4_1)
+      if(USE_SSE4_2)
+         list(APPEND _enable_vector_unit_list "sse4.2")
+      else(USE_SSE4_2)
+         list(APPEND _disable_vector_unit_list "sse4.2")
+      endif(USE_SSE4_2)
+      if(USE_SSE4a)
+         list(APPEND _enable_vector_unit_list "sse4a")
+      else(USE_SSE4a)
+         list(APPEND _disable_vector_unit_list "sse4a")
+      endif(USE_SSE4a)
+      if(USE_AVX)
+         list(APPEND _enable_vector_unit_list "avx")
+         # we want SSE intrinsics to result in instructions using the VEX prefix.
+         # Otherwise integer ops (which require the older SSE intrinsics) would
+         # always have a large penalty.
+         list(APPEND _enable_vector_unit_list "sse2avx")
+      else(USE_AVX)
+         list(APPEND _disable_vector_unit_list "avx")
+      endif(USE_AVX)
+      if(USE_XOP)
+         list(APPEND _enable_vector_unit_list "xop")
+      else()
+         list(APPEND _disable_vector_unit_list "xop")
+      endif()
+      if(USE_FMA4)
+         list(APPEND _enable_vector_unit_list "fma4")
+      else()
+         list(APPEND _disable_vector_unit_list "fma4")
+      endif()
+      if(USE_AVX2)
+         list(APPEND _enable_vector_unit_list "avx2")
+      else()
+         list(APPEND _disable_vector_unit_list "avx2")
+      endif()
       if(MSVC)
          # MSVC on 32 bit can select /arch:SSE2 (since 2010 also /arch:AVX)
          # MSVC on 64 bit cannot select anything (should have changed with MSVC 2010)
-         _my_find(_enable_vector_unit_list "avx2" _found)
-         if(_found)
-            AddCompilerFlag("/arch:AVX2" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)
-         endif()
-         if(NOT _found)
-            _my_find(_enable_vector_unit_list "avx" _found)
-            if(_found)
-               AddCompilerFlag("/arch:AVX" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)
-            endif()
-         endif()
-         if(NOT _found)
+         _my_find(_enable_vector_unit_list "avx" _avx)
+         set(_avx_flag FALSE)
+         if(_avx)
+            AddCompilerFlag("/arch:AVX" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _avx_flag)
+         endif()
+         if(NOT _avx_flag)
             _my_find(_enable_vector_unit_list "sse2" _found)
             if(_found)
                AddCompilerFlag("/arch:SSE2" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
@@ -449,7 +404,7 @@
          else(_found)
             _my_find(_available_vector_units_list "f16c"    _found)
             if(_found)
-               AddCompilerFlag("-xCORE-AVX-I" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
+               AddCompilerFlag("-march=native" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
             else(_found)
                _my_find(_available_vector_units_list "avx"    _found)
                if(_found)
@@ -499,7 +454,7 @@
             endif(_good)
          endforeach(_flag)
          foreach(_flag ${_enable_vector_unit_list})
-            AddCompilerFlag("-m${_flag}" CXX_RESULT _result)
+            AddCompilerFlag("-m${_flag}" CXX_RESULT _result CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
             if(_result)
                set(_header FALSE)
                if(_flag STREQUAL "sse3")
@@ -524,7 +479,7 @@
                set(_resultVar "HAVE_${_header}")
                string(REPLACE "." "_" _resultVar "${_resultVar}")
                if(_header)
-                  CHECK_INCLUDE_FILE_CXX("${_header}" ${_resultVar} "-m${_flag}")
+                  CHECK_INCLUDE_FILE("${_header}" ${_resultVar} "-m${_flag}")
                   if(NOT ${_resultVar})
                      set(_useVar "USE_${_flag}")
                      string(TOUPPER "${_useVar}" _useVar)
@@ -535,7 +490,7 @@
                   endif()
                endif()
                if(NOT _header OR ${_resultVar})
-                  list(APPEND Vc_ARCHITECTURE_FLAGS "-m${_flag}")
+                  set(Vc_ARCHITECTURE_FLAGS "${Vc_ARCHITECTURE_FLAGS} -m${_flag}")
                endif()
             endif()
          endforeach(_flag)