Cleanup code.

Cleanup code.

--- cmake/Modules/UploadPPA.cmake
+++ cmake/Modules/UploadPPA.cmake
@@ -7,246 +7,161 @@
 endif(NOT DEBUILD_EXECUTABLE OR NOT DPUT_EXECUTABLE)

 if(NOT AFF3CT_PPA_DISTRIB)
-execute_process(
-    COMMAND lsb_release -cs
-    OUTPUT_VARIABLE DISTRI
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-    set(AFF3CT_PPA_DISTRIB ${DISTRI})
+execute_process(COMMAND lsb_release -cs
+                OUTPUT_VARIABLE DISTRI
+                OUTPUT_STRIP_TRAILING_WHITESPACE)
+                set(AFF3CT_PPA_DISTRIB ${DISTRI})
 endif()

 foreach(DISTRI ${AFF3CT_PPA_DISTRIB})
+    string(REPLACE "\n" "\n " DEBIAN_LONG_DESCRIPTION " ${CPACK_PACKAGE_DESCRIPTION}")
+    set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
+    set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+    set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+    set(DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}~${DISTRI}1")
+    set(DEBIAN_SOURCE_DIR ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${CPACK_DEBIAN_PACKAGE_NAME}_${DEBIAN_PACKAGE_VERSION})
+    set(DEBIAN_CONTROL ${DEBIAN_SOURCE_DIR}/debian/control)
+    set(DEBIAN_COPYRIGHT ${DEBIAN_SOURCE_DIR}/debian/copyright)
+    set(DEBIAN_RULES ${DEBIAN_SOURCE_DIR}/debian/rules)
+    set(DEBIAN_CHANGELOG ${DEBIAN_SOURCE_DIR}/debian/changelog)
+    set(DEBIAN_SOURCE_CHANGES ${CPACK_DEBIAN_PACKAGE_NAME}_${DEBIAN_PACKAGE_VERSION}_source.changes)
+    set(PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}")
+    set(ORIG_FILE "${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${PACKAGE_FILE_NAME}.orig.tar.gz")
+    set(DPUT_HOST "ppa:aff3ct/aff3ct")
+    if(CHANGELOG_MESSAGE) # TODO get it from git
+        set(output_changelog_msg ${CHANGELOG_MESSAGE})
+    else()
+        set(output_changelog_msg "* Package created with CMake")
+    endif(CHANGELOG_MESSAGE)
+    if(NOT CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG)
+        set(CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG ${CMAKE_SOURCE_DIR}/debian/changelog)
+    endif()

-set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
-set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
-set(DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}~${DISTRI}1")
-set(DEBIAN_SOURCE_DIR ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${CPACK_DEBIAN_PACKAGE_NAME}_${DEBIAN_PACKAGE_VERSION})
+    # ##############################################################################
+    # # debian/control
+    list(APPEND CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS "cmake" "debhelper (>= 7.0.50)")
+    list(REMOVE_DUPLICATES CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS)
+    list(SORT CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS)
+    string(REPLACE ";" ", " build_depends "${CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS}")
+    string(REPLACE ";" ", " bin_depends "${CPACK_DEBIAN_PACKAGE_DEPENDS}")
+    file(WRITE ${DEBIAN_CONTROL}
+         "Source: ${CPACK_DEBIAN_PACKAGE_NAME}\n"
+         "Section: ${CPACK_DEBIAN_PACKAGE_SECTION}\n"
+         "Priority: ${CPACK_DEBIAN_PACKAGE_PRIORITY}\n"
+         "Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}\n"
+         "Build-Depends: ${build_depends}\n"
+         "Standards-Version: 3.9.7\n"
+         "Homepage: ${CPACK_DEBIAN_PACKAGE_HOMEPAGE}\n"
+         "\n"
+         "Package: ${CPACK_DEBIAN_PACKAGE_NAME}\n"
+         "Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\n"
+         "Depends: ${bin_depends}, \${shlibs:Depends}, \${misc:Depends}\n"
+         "Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n"
+         "${DEBIAN_LONG_DESCRIPTION}\n")

-# ##############################################################################
-# # debian/control
+    foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
+        string(TOUPPER ${COMPONENT} UPPER_COMPONENT)
+        set(DEPENDS "${CPACK_DEBIAN_PACKAGE_NAME}")
+        foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS})
+            set(DEPENDS "${DEPENDS}, ${CPACK_DEBIAN_PACKAGE_NAME}-${DEP}")
+        endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS})
+        set(DEPENDS "${DEPENDS}, \${misc:Depends}")
+        file(APPEND ${DEBIAN_CONTROL} "\n"
+             "Package: ${CPACK_DEBIAN_PACKAGE_NAME}-${COMPONENT}\n"
+             "Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\n"
+             "Depends: ${DEPENDS}\n"
+             "Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}"
+             ": ${CPACK_COMPONENT_${UPPER_COMPONENT}_DISPLAY_NAME}\n"
+             "${DEBIAN_LONG_DESCRIPTION}"
+             "\n .\n"
+             " ${CPACK_COMPONENT_${UPPER_COMPONENT}_DESCRIPTION}\n")
+    endforeach(COMPONENT ${CPACK_COMPONENTS_ALL})

-set(debian_control ${DEBIAN_SOURCE_DIR}/debian/control)
-list(APPEND CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS "cmake" "debhelper (>= 7.0.50)")
-list(REMOVE_DUPLICATES CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS)
-list(SORT CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS)
-string(REPLACE ";" ", " build_depends "${CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS}")
-string(REPLACE ";" ", " bin_depends "${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-file(WRITE ${debian_control}
-  "Source: ${CPACK_DEBIAN_PACKAGE_NAME}\n"
-  "Section: ${CPACK_DEBIAN_PACKAGE_SECTION}\n"
-  "Priority: ${CPACK_DEBIAN_PACKAGE_PRIORITY}\n"
-  "Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}\n"
-  "Build-Depends: ${build_depends}\n"
-  "Standards-Version: 3.9.7\n"
-  "Homepage: ${CPACK_DEBIAN_PACKAGE_HOMEPAGE}\n"
-  "\n"
-  "Package: ${CPACK_DEBIAN_PACKAGE_NAME}\n"
-  # "Version: ${CPACK_DEBIAN_PACKAGE_VERSION}\n"
-  "Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\n"
-  "Depends: ${bin_depends}, \${shlibs:Depends}, \${misc:Depends}\n"
-  "Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n"
-  "${deb_long_description}\n"
-  )
+    ##############################################################################
+    # debian/copyright
+    configure_file(${CPACK_RESOURCE_FILE_LICENSE} ${DEBIAN_COPYRIGHT} COPYONLY)

-# file(APPEND ${debian_control}
-#   "\n\n"
-#   "Package: ${CPACK_DEBIAN_PACKAGE_NAME}-dbg\n"
-#   "Priority: extra\n"
-#   "Section: debug\n"
-#   "Architecture: any\n"
-#   "Depends: ${CPACK_DEBIAN_PACKAGE_NAME} (= \${binary:Version}), \${shlibs:Depends}, \${misc:Depends}\n"
-#   "Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n"
-#   "${deb_long_description}"
-#   "\n .\n"
-#   " This is the debugging symbols for the ${CPACK_DEBIAN_PACKAGE_NAME} library\n"
-#  )
+    ##############################################################################
+    # debian/rules
+    file(WRITE ${DEBIAN_RULES}
+         "#!/usr/bin/make -f\n"
+         "\nexport DH_VERBOSE=1"
+         "\n\n%:\n"
+         "\tdh  $@ --buildsystem=cmake\n"
+         "\noverride_dh_auto_configure:\n"
+         "\tDESTDIR=\"$(CURDIR)/debian/${CPACK_DEBIAN_PACKAGE_NAME}\" dh_auto_configure"
+         " -- -DCMAKE_BUILD_TYPE=Release -DAFF3CT_COMPILE_SHARED_LIB=ON -DPACKAGE_TGZ=OFF "
+         "-DAFF3CT_OVERRIDE_VERSION=${GIT_VERSION} -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
+         "\n\noverride_dh_auto_install:\n"
+         "\tdh_auto_install --destdir=\"$(CURDIR)/debian/${CPACK_DEBIAN_PACKAGE_NAME}\" --buildsystem=cmake"
+         "\n\noverride_dh_strip:\n")

-foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
-  string(TOUPPER ${COMPONENT} UPPER_COMPONENT)
-  set(DEPENDS "${CPACK_DEBIAN_PACKAGE_NAME}")
-  foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS})
-    set(DEPENDS "${DEPENDS}, ${CPACK_DEBIAN_PACKAGE_NAME}-${DEP}")
-  endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS})
-  set(DEPENDS "${DEPENDS}, \${misc:Depends}")
-  file(APPEND ${debian_control} "\n"
-    "Package: ${CPACK_DEBIAN_PACKAGE_NAME}-${COMPONENT}\n"
-    "Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\n"
-    "Depends: ${DEPENDS}\n"
-    "Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}"
-    ": ${CPACK_COMPONENT_${UPPER_COMPONENT}_DISPLAY_NAME}\n"
-    "${deb_long_description}"
-    "\n .\n"
-    " ${CPACK_COMPONENT_${UPPER_COMPONENT}_DESCRIPTION}\n"
-	)
-endforeach(COMPONENT ${CPACK_COMPONENTS_ALL})
+    execute_process(COMMAND chmod +x ${DEBIAN_RULES})
+
+    ##############################################################################
+    # debian/compat
+    file(WRITE ${DEBIAN_SOURCE_DIR}/debian/compat "7")
+
+    ##############################################################################
+    # debian/source/format
+    file(WRITE ${DEBIAN_SOURCE_DIR}/debian/source/format "3.0 (native)")
+
+    ##############################################################################
+
+    if(EXISTS ${CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG})
+        configure_file(${CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG} ${DEBIAN_CHANGELOG} COPYONLY)
+
+        if(CPACK_DEBIAN_UPDATE_CHANGELOG)
+            file(READ ${DEBIAN_CHANGELOG} DEBIAN_CHANGELOG_content)
+            execute_process(COMMAND date -R
+                            OUTPUT_VARIABLE DATE_TIME
+                            OUTPUT_STRIP_TRAILING_WHITESPACE)
+            file(WRITE ${DEBIAN_CHANGELOG}
+                 "${CPACK_DEBIAN_PACKAGE_NAME} (${DEBIAN_PACKAGE_VERSION}) ${DISTRI}; urgency=low\n\n"
+                 "  ${output_changelog_msg}\n\n"
+                 " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER}  ${DATE_TIME}\n\n")
+            file(APPEND ${DEBIAN_CHANGELOG} ${DEBIAN_CHANGELOG_content})
+    endif()
+
+    else()
+      execute_process(COMMAND date -R
+                      OUTPUT_VARIABLE DATE_TIME
+                      OUTPUT_STRIP_TRAILING_WHITESPACE)
+      file(WRITE ${DEBIAN_CHANGELOG}
+           "${CPACK_DEBIAN_PACKAGE_NAME} (${DEBIAN_PACKAGE_VERSION}) ${DISTRI}; urgency=low\n\n"
+           "  ${output_changelog_msg}\n\n"
+           " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER}  ${DATE_TIME}\n")
+    endif()
+
+    ##########################################################################
+    # .orig.tar.gz
+    add_custom_command(OUTPUT ${ORIG_FILE}
+                       COMMAND cpack -G TGZ --config ${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake
+                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI})

+    add_custom_command(OUTPUT ${DEBIAN_SOURCE_DIR}/CMakeLists.txt
+                       COMMAND tar zxf ${ORIG_FILE}
+                       WORKING_DIRECTORY ${DEBIAN_SOURCE_DIR}
+                       DEPENDS ${ORIG_FILE})

-##############################################################################
-# debian/copyright
-set(debian_copyright ${DEBIAN_SOURCE_DIR}/debian/copyright)
-configure_file(${CPACK_RESOURCE_FILE_LICENSE} ${debian_copyright} COPYONLY)
+    ##############################################################################
+    # debuild -S (build log in )
+    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${DEBIAN_SOURCE_CHANGES}
+                       COMMAND ${DEBUILD_EXECUTABLE} --no-tgz-check -S > /dev/null
+                       DEPENDS ${DEBIAN_SOURCE_DIR}/CMakeLists.txt
+                       WORKING_DIRECTORY ${DEBIAN_SOURCE_DIR})

-##############################################################################
-# debian/rules
-set(debian_rules ${DEBIAN_SOURCE_DIR}/debian/rules)
+    add_custom_target(debuild_${DISTRI} ALL
+                      DEPENDS ${DEBIAN_SOURCE_DIR}/CMakeLists.txt aff3ct-bin
+                      ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${DEBIAN_SOURCE_CHANGES}
+                      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI})

-file(WRITE ${debian_rules}
-	"#!/usr/bin/make -f\n"
-	"\nexport DH_VERBOSE=1"
-	"\n\n%:\n"
-	"\tdh  $@ --buildsystem=cmake\n"
-	"\noverride_dh_auto_configure:\n"
-	"\tDESTDIR=\"$(CURDIR)/debian/${CPACK_DEBIAN_PACKAGE_NAME}\" dh_auto_configure"
-  " -- -DCMAKE_BUILD_TYPE=Release -DAFF3CT_COMPILE_SHARED_LIB=ON -DPACKAGE_TGZ=OFF "
-  "-DAFF3CT_OVERRIDE_VERSION=${GIT_VERSION} -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
-	"\n\noverride_dh_auto_install:\n"
-	"\tdh_auto_install --destdir=\"$(CURDIR)/debian/${CPACK_DEBIAN_PACKAGE_NAME}\" --buildsystem=cmake"
-	"\n\noverride_dh_strip:\n"
-	# "\tdh_strip --dbg-package=${CPACK_DEBIAN_PACKAGE_NAME}-dbg"
-)
-
-execute_process(COMMAND chmod +x ${debian_rules})
-
-##############################################################################
-# debian/compat
-file(WRITE ${DEBIAN_SOURCE_DIR}/debian/compat "7")
-
-##############################################################################
-# debian/source/format
-file(WRITE ${DEBIAN_SOURCE_DIR}/debian/source/format "3.0 (native)")
-
-##############################################################################
-
-# debian/changelog
-set(debian_changelog ${DEBIAN_SOURCE_DIR}/debian/changelog)
-if(NOT CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG)
-  set(CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG ${CMAKE_SOURCE_DIR}/debian/changelog)
-endif()
-
-# TODO add support for git dch (git-buildpackage)
-if(CHANGELOG_MESSAGE)
-	set(output_changelog_msg ${CHANGELOG_MESSAGE})
-else()
-	set(output_changelog_msg "* Package created with CMake")
-endif(CHANGELOG_MESSAGE)
-
-if(EXISTS ${CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG})
-  configure_file(${CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG} ${debian_changelog} COPYONLY)
-
-  if(CPACK_DEBIAN_UPDATE_CHANGELOG)
-    file(READ ${debian_changelog} debian_changelog_content)
-    execute_process(
-      COMMAND date -R
-      OUTPUT_VARIABLE DATE_TIME
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    file(WRITE ${debian_changelog}
-      "${CPACK_DEBIAN_PACKAGE_NAME} (${DEBIAN_PACKAGE_VERSION}) ${DISTRI}; urgency=low\n\n"
-      "  ${output_changelog_msg}\n\n"
-      " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER}  ${DATE_TIME}\n\n"
-      )
-    file(APPEND ${debian_changelog} ${debian_changelog_content})
-  endif()
-
-else()
-  execute_process(
-    COMMAND date -R
-    OUTPUT_VARIABLE DATE_TIME
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-  file(WRITE ${debian_changelog}
-    "${CPACK_DEBIAN_PACKAGE_NAME} (${DEBIAN_PACKAGE_VERSION}) ${DISTRI}; urgency=low\n\n"
-    "  ${output_changelog_msg}\n\n"
-    " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER}  ${DATE_TIME}\n"
-    )
-   #configure_file(${debian_changelog} ${CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG}  COPYONLY)
-endif()
-
-
-##########################################################################
-# Templates
-
-if (CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
-	foreach(CF ${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA})
-	get_filename_component(CF_NAME ${CF} NAME)
-	message("Writing debian/${CF_NAME}")
-	configure_file(${CF} ${DEBIAN_SOURCE_DIR}/debian/${CF_NAME} @ONLY)
-	endforeach()
-endif(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
-
-
-##########################################################################
-# .orig.tar.gz
-#execute_process(COMMAND date +%y%m%d
-#  OUTPUT_VARIABLE day_suffix
-#  OUTPUT_STRIP_TRAILING_WHITESPACE
-#  )
-
-#set(package_file_name "${CPACK_DEBIAN_PACKAGE_NAMEde}_${DEBIAN_PACKAGE_VERSION}")
-set(package_file_name "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}")
-
-set(orig_file "${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${package_file_name}.orig.tar.gz")
-
-add_custom_command(OUTPUT ${orig_file}
-  COMMAND cpack -G TGZ --config ${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI}
-  )
-
-
-add_custom_command(OUTPUT ${DEBIAN_SOURCE_DIR}/CMakeLists.txt
-  COMMAND tar zxf ${orig_file}
-  WORKING_DIRECTORY ${DEBIAN_SOURCE_DIR}
-  DEPENDS ${orig_file}
-  )
-
-##############################################################################
-# debuild -S
-set(DEB_SOURCE_CHANGES
-  ${CPACK_DEBIAN_PACKAGE_NAME}_${DEBIAN_PACKAGE_VERSION}_source.changes
-  )
-
-add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${DEB_SOURCE_CHANGES}
-  COMMAND ${DEBUILD_EXECUTABLE} --no-tgz-check -S
-  DEPENDS ${DEBIAN_SOURCE_DIR}/CMakeLists.txt
-  WORKING_DIRECTORY ${DEBIAN_SOURCE_DIR}
-  )
-
-add_custom_target(debuild_${DISTRI} ALL
-				DEPENDS ${DEBIAN_SOURCE_DIR}/CMakeLists.txt
-        aff3ct-bin
-				${CMAKE_BINARY_DIR}/Debian/${DISTRI}/${DEB_SOURCE_CHANGES}
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI}
-		)
-# ##############################################################################
-# # dput ppa:your-lp-id/ppa <source.changes>
-
-set(DPUT_HOST "ppa:aff3ct/aff3ct")
-
-add_custom_target(dput_${DISTRI} ALL
-        COMMAND ${DPUT_EXECUTABLE} ${DPUT_HOST} ${DEB_SOURCE_CHANGES}
-        DEPENDS  debuild_${DISTRI}
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI}
-    )
+    # ##############################################################################
+    # dput ppa:your-lp-id/ppa <source.changes>
+    # TODO : Add possibility to use .dc file
+    add_custom_target(dput_${DISTRI} ALL
+                      COMMAND ${DPUT_EXECUTABLE} ${DPUT_HOST} ${DEBIAN_SOURCE_CHANGES}
+                      DEPENDS  debuild_${DISTRI}
+                      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI})
 endforeach(DISTRI)
-
-
-
-# if(UPLOAD_PPA)
-#     if (EXISTS ${DPUT_CONFIG_IN})
-#         set(DPUT_DIST ${DISTRI})
-#         configure_file(
-#             ${DPUT_CONFIG_IN}
-#             ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/dput.cf
-#             @ONLY
-#         )
-#         add_custom_target(dput_${DISTRI} ALL
-#             COMMAND ${DPUT_EXECUTABLE} -c ${CMAKE_BINARY_DIR}/Debian/${DISTRI}/dput.cf ${DPUT_HOST} ${DEB_SOURCE_CHANGES}
-#             DEPENDS debuild_${DISTRI}, aff3ct-bin
-#             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI}
-#         )
-#     else()
-        # add_custom_target(dput_${DISTRI} ALL
-        #     COMMAND ${DPUT_EXECUTABLE} ${DPUT_HOST} ${DEB_SOURCE_CHANGES}
-        #     DEPENDS debuild_${DISTRI}, aff3ct-bin
-        #     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian/${DISTRI}
-        # )
-#     endif()
-# endif()


build: switch to nana 1.7.4

build: switch to nana 1.7.4

--- cmake/SetupDependencies.cmake
+++ cmake/SetupDependencies.cmake
@@ -24,8 +24,8 @@

 CPMAddPackage(
     NAME nana
-    GITHUB_REPOSITORY khrynczenko/nana
-    GIT_TAG 7d7b3840cbe6d19fa1bda486bbf5e49d31f752b5
+    GITHUB_REPOSITORY cnjinhao/nana
+    GIT_TAG v1.7.4
     OPTIONS
         "MSVC_USE_STATIC_RUNTIME OFF"
         "NANA_CMAKE_ENABLE_PNG ${NANA_PNG}"
@@ -105,4 +105,4 @@
     set(SSL_LIB_FILE "")
     set(FONTCONFIG_LIB "-lfontconfig")
     set(PTHREAD_LIB "-lpthread")
-endif()+endif()


fix FindCPLEX for version 128

fix FindCPLEX for version 128

CPLEX 128 dll name: cplex1280.dll (not cplex128.dll !)

--- cmake/modules/FindCPLEX.cmake
+++ cmake/modules/FindCPLEX.cmake
@@ -63,7 +63,7 @@

   set(CPLEX_WIN_BITNESS ${CPLEX_WIN_BITNESS} CACHE STRING "On Windows: x86 or x64 (32bit resp. 64bit)")

-  MESSAGE(STATUS "CPLEX: using Visual Studio ${CPLEX_WIN_VS_VERSION} ${CPLEX_WIN_BITNESS} at '${VISUAL_STUDIO_PATH}'")
+  MESSAGE(STATUS "FindCPLEX: using Visual Studio ${CPLEX_WIN_VS_VERSION} ${CPLEX_WIN_BITNESS} at '${VISUAL_STUDIO_PATH}'")

   if(NOT CPLEX_WIN_LINKAGE)
     set(CPLEX_WIN_LINKAGE mda CACHE STRING "CPLEX linkage variant on Windows. One of these: mda (dll, release), mdd (dll, debug), mta (static, release), mtd (static, debug)")
@@ -71,6 +71,7 @@

   # now, generate platform string
   set(CPLEX_WIN_PLATFORM "${CPLEX_WIN_BITNESS}_windows_vs${CPLEX_WIN_VS_VERSION}/stat_${CPLEX_WIN_LINKAGE}")
+  MESSAGE(STATUS "FindCPLEX: using platform string ${CPLEX_WIN_PLATFORM}")

 else()

@@ -135,10 +136,7 @@
 message(STATUS "CONCERT Library: ${CPLEX_CONCERT_LIBRARY}")

 if(WIN32)
-    FIND_PATH(CPLEX_BIN_DIR
-      cplex${CPLEX_WIN_VERSION}.dll
-          HINTS ${CPLEX_ROOT_DIR}/cplex/bin/${CPLEX_WIN_PLATFORM} #windows
-      )
+  set(CPLEX_BIN_DIR CPLEX_STUIDO_BINARIES${CPLEX_WIN_VERSION})
 else()
     FIND_PATH(CPLEX_BIN_DIR
       cplex
@@ -165,6 +163,3 @@
 ENDIF(CPLEX_FOUND)

 MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_ILOCPLEX_LIBRARY CPLEX_CONCERT_INCLUDE_DIR CPLEX_CONCERT_LIBRARY)
-
-
-


Let cmake find cplex from `cplex_studio128.linux-x86-64.bin`

--- cmake/modules/FindCPLEX.cmake
+++ cmake/modules/FindCPLEX.cmake
@@ -88,6 +88,7 @@
   HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
+        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic #unix
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
   PATHS ENV LIBRARY_PATH #unix
         ENV LD_LIBRARY_PATH #unix
@@ -99,6 +100,7 @@
   HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
+        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic #unix
         ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
   PATHS ENV LIBRARY_PATH
         ENV LD_LIBRARY_PATH
@@ -110,6 +112,7 @@
   HINTS ${CPLEX_ROOT_DIR}/concert/lib/${CPLEX_WIN_PLATFORM} #windows
         ${CPLEX_ROOT_DIR}/concert/lib/x86-64_debian4.0_4.1/static_pic #unix
         ${CPLEX_ROOT_DIR}/concert/lib/x86-64_sles10_4.1/static_pic #unix
+        ${CPLEX_ROOT_DIR}/concert/lib/x86-64_linux/static_pic #unix
         ${CPLEX_ROOT_DIR}/concert/lib/x86-64_osx/static_pic #osx
   PATHS ENV LIBRARY_PATH
         ENV LD_LIBRARY_PATH
@@ -126,6 +129,7 @@
 	  cplex
           HINTS ${CPLEX_ROOT_DIR}/cplex/bin/x86-64_sles10_4.1 #unix
                 ${CPLEX_ROOT_DIR}/cplex/bin/x86-64_debian4.0_4.1 #unix
+                ${CPLEX_ROOT_DIR}/cplex/bin/x86-64_linux #unix
                 ${CPLEX_ROOT_DIR}/cplex/bin/x86-64_osx #osx
 	  ENV LIBRARY_PATH
           ENV LD_LIBRARY_PATH


Work around android-arm NDK bug exposed by rL269992

In the android-arm ndk there is a duplicated typedef in link.h
and in unwind.h causing build erros. This CL introduces a HACK
to prevent LLVM from finding unwind.h to fix the issue.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@270201 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -165,6 +165,15 @@
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

 ################# BEGIN EVIL HACK ##################
+# In the android-arm NDK unwind.h and link.h contains 2 conflicting
+# typedef for _Unwind_Ptr. Force HAVE_UNWIND_BACKTRACE to 0 to prevent
+# LLVM from finding unwind.h what would break the build.
+if ( ANDROID_ABI STREQUAL "armeabi" )
+ set( HAVE_UNWIND_BACKTRACE 0 CACHE INTERNAL "Hack to disable the finding of unwind.h on Android arm" )
+endif()
+################# END EVIL HACK ####################
+
+################# BEGIN EVIL HACK ##################
 # lldb-server links against libdl even though it's not being used and
 # libdl.a is currently missing from the toolchain (b.android.com/178517).
 # Therefore, in order to statically link lldb-server, we need a temporary
@@ -178,7 +187,8 @@
 void *       dlopen  (const char *filename, int flag)   { return 0; }
 const char * dlerror (void)                             { return 0; }
 void *       dlsym   (void *handle, const char *symbol) { return 0; }
-int          dlclose (void *handle)                     { return 0; }")
+int          dlclose (void *handle)                     { return 0; }
+int          dladdr  (const void *addr, Dl_info *info)  { return 0; }")
  set( flags "${CMAKE_C_FLAGS}" )
  separate_arguments( flags )
  execute_process( COMMAND ${CMAKE_C_COMPILER} ${flags} -c ${libdl}/libdl.c -o ${libdl}/libdl.o )


Fix javascript coverage reporting on travis

--- cmake/travis_continuous.cmake
+++ cmake/travis_continuous.cmake
@@ -35,7 +35,13 @@
   )
 endif()

-ctest_coverage()
+if(test_group STREQUAL "server")
+  ctest_coverage()
+elseif(test_group STREQUAL "client")
+  file(RENAME "${CTEST_BINARY_DIRECTORY}/js_coverage.xml" "${CTEST_BINARY_DIRECTORY}/coverage.xml")
+  ctest_coverage()
+endif()
+
 file(REMOVE "${CTEST_BINARY_DIRECTORY}/coverage.xml")
 ctest_submit()


Enable tcmalloc

Enable tcmalloc

--- indra/cmake/GooglePerfTools.cmake
+++ indra/cmake/GooglePerfTools.cmake
@@ -3,7 +3,7 @@

 # If you want to enable or disable TCMALLOC in viewer builds, this is the place.
 # set ON or OFF as desired.
-set (USE_TCMALLOC OFF)
+set (USE_TCMALLOC ON)

 if (STANDALONE)
   include(FindGooglePerfTools)


WIP: ManageUpload.cmake

WIP: ManageUpload.cmake

--- Modules/ManageUpload.cmake
+++ Modules/ManageUpload.cmake
@@ -1,13 +1,19 @@
-# - Manage upload source archive to hosting site.
-# You can either use sftp, scp or supply custom command for upload.
-#
-# This module defines following macros:
-#   MANAGE_UPLOAD_TARGET(targetName
-#     [COMMAND program ...] [ADD_CUSTOM_TARGET_ARGUMENTS])
-#   - Make an upload target using arbitrary command.
-#     This macro check whether the program after COMMAND exist,
-#     if program exists, then add the make target,
-#     if not, produce M_OFF warning.
+# - Manage upload source archive to hosting site
+# cmake-fedora can upload source archive to hosting site by
+# scp, sftp or any other command
+#
+# Included Modules:
+#   - ManageMessage
+#   - ManageVariable
+#
+# This module defines following functions:
+#   MANAGE_UPLOAD_TARGET(<targetName>
+#       [COMMAND <program> ... ]
+#       [<add custom target options ...>]
+#     )
+#     - Make an upload target using arbitrary command.
+#       If COMMAND program exists the target <targetName> will be created;
+#       if not, a M_OFF message is shown and target will not be created.
 #     Parameters:
 #     + targetName: target name in make.
 #     + program: Program that does upload.


CMake should only pass GCC options to GCC.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@82607 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/Modules/DefineCompilerFlags.cmake
+++ cmake/Modules/DefineCompilerFlags.cmake
@@ -1,4 +1,6 @@
 # Define compiler flags

-#ADD_DEFINITIONS( -Wall -W -Werror -pedantic )
-ADD_DEFINITIONS( -std=c99 -Wall -Wextra -W -pedantic -Wno-unused-parameter )
+if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
+  #ADD_DEFINITIONS( -Wall -W -Werror -pedantic )
+  ADD_DEFINITIONS( -std=c99 -Wall -Wextra -W -pedantic -Wno-unused-parameter )
+endif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )


cmake: reset __content variable if file doesn't exist

Resolves CMake error after relaunch with updated source code:
Cannot find source file:
    modules/dnn/layers/layers_common.avx512_skx.cpp

--- cmake/OpenCVCompilerOptimizations.cmake
+++ cmake/OpenCVCompilerOptimizations.cmake
@@ -760,6 +760,8 @@
       set(__file "${CMAKE_CURRENT_BINARY_DIR}/${filename}.${OPT_LOWER}.cpp")
       if(EXISTS "${__file}")
         file(READ "${__file}" __content)
+      else()
+        set(__content "")
       endif()
       if(__content STREQUAL __codestr)
         #message(STATUS "${__file} contains up-to-date content")


Bugfix: Run related MPI tests sequentally to avoid a racecondition when creating the executable

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

--- tests/cmake/macros/macro_add_test.cmake
+++ tests/cmake/macros/macro_add_test.cmake
@@ -189,6 +189,25 @@
         LABEL "${_category}"
         TIMEOUT ${TEST_TIME_LIMIT}
         )
+
+      #
+      # We have to be careful not to run different mpirun settings for the
+      # same executable in parallel because this triggers a race condition
+      # when compiling the not yet existent executable that is shared
+      # between the different tests.
+      #
+      # Luckily CMake has a mechanism to force a test to be run when
+      # another has finished (and both are scheduled):
+      #
+      IF(NOT "${_n_cpu}" STREQUAL "0")
+        IF(DEFINED TEST_DEPENDENCIES_${_target})
+          SET_TESTS_PROPERTIES(${_test_full} PROPERTIES
+            DEPENDS ${TEST_DEPENDENCIES_${_target}}
+            )
+        ENDIF()
+        SET(TEST_DEPENDENCIES_${_target} ${_test_full})
+      ENDIF()
+
     ENDIF()
   ENDFOREACH()
 ENDMACRO()


Bugfix

Bugfix

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

--- tests/cmake/macros/macro_add_test.cmake
+++ tests/cmake/macros/macro_add_test.cmake
@@ -128,6 +128,7 @@
       #

       ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/output
+        COMMAND touch ${_test_directory}/output
         COMMAND
           ${_run_command}
           || (mv ${_test_directory}/output
@@ -146,6 +147,7 @@
           ${TEST_DIR}/cmake/scripts/normalize.pl
         )
       ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff
+        COMMAND touch ${_test_directory}/diff
         COMMAND
           ${TEST_DIFF}
             ${_test_directory}/output


BUG: Must pass JsonCpp_LIBRARIES and INCLUDE_PATHS back to TubeTK

--- CMake/Superbuild/External_JsonCpp.cmake
+++ CMake/Superbuild/External_JsonCpp.cmake
@@ -80,3 +80,7 @@
 endif( NOT DEFINED ${proj}_DIR AND NOT ${USE_SYSTEM_JSONCPP} )

 list( APPEND TubeTK_EXTERNAL_PROJECTS_ARGS -D${proj}_DIR:PATH=${${proj}_DIR} )
+list( APPEND TubeTK_EXTERNAL_PROJECTS_ARGS
+  -D${proj}_LIBRARIES:PATH=${${proj}_LIBRARIES} )
+list( APPEND TubeTK_EXTERNAL_PROJECTS_ARGS
+  -D${proj}_INCLUDE_DIRS:PATH=${${proj}_INCLUDE_DIRS} )


Add upstream fix for MSVC AVX flags

Add upstream fix for MSVC AVX flags

--- CMake/ITKSetStandardCompilerFlags.cmake
+++ CMake/ITKSetStandardCompilerFlags.cmake
@@ -137,19 +137,83 @@
   set(${cxx_warning_flags_var} "${CMAKE_CXX_WARNING_FLAGS}" PARENT_SCOPE)
 endfunction()

+# Check for the presence of AVX and figure out the flags to use for it.
+# Adapted from https://gist.github.com/UnaNancyOwen/263c243ae1e05a2f9d0e
+function(check_avx_flags avx_flags_var)
+  set(avx_flags_var)
+
+  include(CheckCXXSourceRuns)
+  set(_safe_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}")
+  set(CMAKE_REQUIRED_FLAGS)
+
+  # Check AVX
+  if(MSVC_VERSION GREATER_EQUAL 1600)
+    set(CMAKE_REQUIRED_FLAGS "/arch:AVX") # set flags to be used in check_cxx_source_runs below
+  endif()
+  check_cxx_source_runs("
+    #include <immintrin.h>
+    int main()
+    {
+      __m256 a, b, c;
+      const float src[8] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
+      float dst[8];
+      a = _mm256_loadu_ps( src );
+      b = _mm256_loadu_ps( src );
+      c = _mm256_add_ps( a, b );
+      _mm256_storeu_ps( dst, c );
+
+      for( int i = 0; i < 8; i++ ){
+        if( ( src[i] + src[i] ) != dst[i] ){
+          return -1;
+        }
+      }
+
+      return 0;
+    }"
+    have_avx_extensions_var)
+
+  # Check AVX2
+  if(MSVC_VERSION GREATER_EQUAL 1800)
+    set(CMAKE_REQUIRED_FLAGS "/arch:AVX2") # set flags to be used in check_cxx_source_runs below
+  endif()
+  check_cxx_source_runs("
+    #include <immintrin.h>
+    int main()
+    {
+      __m256i a, b, c;
+      const int src[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+      int dst[8];
+      a =  _mm256_loadu_si256( (__m256i*)src );
+      b =  _mm256_loadu_si256( (__m256i*)src );
+      c = _mm256_add_epi32( a, b );
+      _mm256_storeu_si256( (__m256i*)dst, c );
+
+      for( int i = 0; i < 8; i++ ){
+        if( ( src[i] + src[i] ) != dst[i] ){
+          return -1;
+        }
+      }
+
+      return 0;
+    }"
+    have_avx2_extensions_var)
+
+  set(CMAKE_REQUIRED_FLAGS "${_safe_cmake_required_flags}")
+
+  # Set Flags
+  if(have_avx2_extensions_var AND MSVC_VERSION GREATER_EQUAL 1800)
+    set(avx_flags_var "${avx_flags_var} /arch:AVX2")
+  elseif(have_avx_extensions_var AND MSVC_VERSION GREATER_EQUAL 1600)
+    set(avx_flags_var "${avx_flags_var} /arch:AVX")
+  endif()
+endfunction()

 function(check_compiler_optimization_flags c_optimization_flags_var cxx_optimization_flags_var)
   set(${c_optimization_flags_var} "" PARENT_SCOPE)
   set(${cxx_optimization_flags_var} "" PARENT_SCOPE)

   if(MSVC)
-      set(InstructionSetOptimizationFlags
-         # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=vs-2015
-         /arch:AVX ) # AVX support circa 2013 hardware
-      if(MSVC_VERSION GREATER_EQUAL 1800)
-         list(APPEND InstructionSetOptimizationFlags
-              /arch:AVX2) # AVX support circa 2013 hardware
-      endif()
+    check_avx_flags(InstructionSetOptimizationFlags)
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
          list(APPEND InstructionSetOptimizationFlags
               /arch:SSE /arch:SSE2)


Configure MinGW to use -O2 instead of -O3 for Release build config. For some reason CMake/MinGW generator uses -O3 for newer MinGW versions. Explicitly set it to -O2 to prevent crashes on 32-bit mode. Fix #1765.

--- CMake/Modules/Urho3D-CMake-common.cmake
+++ CMake/Modules/Urho3D-CMake-common.cmake
@@ -701,7 +701,9 @@
             set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -fno-keep-inline-dllexport")
             set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -fno-keep-inline-dllexport")
             if (NOT URHO3D_64BIT)
-                # Prevent auto-vectorize optimization when using -O3, unless stack realign is being enforced globally
+                set (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+                set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+                # Prevent auto-vectorize optimization when using -O2, unless stack realign is being enforced globally
                 if (URHO3D_SSE)
                     set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
                     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")


Allow finding pre-built capnp.

Allow finding pre-built capnp.

--- external/CapnProto.cmake
+++ external/CapnProto.cmake
@@ -21,17 +21,16 @@

 option(SOURCE_CAPNP "Build Cap'n Proto from source even if it is found." OFF)

-# TODO: Enable discovery of capnp/kj locally.
-#if (NOT ${SOURCE_CAPNP})
-#  find_package(CapnProto)
-#  # Most CAPNP* variables are set correctly but make sure we have the
-#  # static libraries.
-#  find_library(LIB_KJ ${STATIC_PRE}kj${STATIC_SUF})
-#  find_library(LIB_CAPNP ${STATIC_PRE}capnp${STATIC_SUF})
-#  find_library(LIB_CAPNPC ${STATIC_PRE}capnpc${STATIC_SUF})
-#  set(CAPNP_LIBRARIES ${LIB_KJ} ${LIB_CAPNP} ${LIB_CAPNPC})
-#  set(CAPNP_LIBRARIES_LITE ${LIB_KJ} ${LIB_CAPNP})
-#endif ()
+if (NOT ${SOURCE_CAPNP})
+  find_package(CapnProto)
+  # Most CAPNP* variables are set correctly but make sure we have the
+  # static libraries.
+  find_library(LIB_KJ ${STATIC_PRE}kj${STATIC_SUF})
+  find_library(LIB_CAPNP ${STATIC_PRE}capnp${STATIC_SUF})
+  find_library(LIB_CAPNPC ${STATIC_PRE}capnpc${STATIC_SUF})
+  set(CAPNP_LIBRARIES ${LIB_KJ} ${LIB_CAPNP} ${LIB_CAPNPC})
+  set(CAPNP_LIBRARIES_LITE ${LIB_KJ} ${LIB_CAPNP})
+endif ()

 if (NOT CAPNP_FOUND)
   # Build Cap'n Proto from source.


Fix capnp/kj library order.

Fix capnp/kj library order.

--- external/CapnProto.cmake
+++ external/CapnProto.cmake
@@ -28,8 +28,8 @@
   find_library(LIB_KJ ${STATIC_PRE}kj${STATIC_SUF})
   find_library(LIB_CAPNP ${STATIC_PRE}capnp${STATIC_SUF})
   find_library(LIB_CAPNPC ${STATIC_PRE}capnpc${STATIC_SUF})
-  set(CAPNP_LIBRARIES ${LIB_KJ} ${LIB_CAPNP} ${LIB_CAPNPC})
-  set(CAPNP_LIBRARIES_LITE ${LIB_KJ} ${LIB_CAPNP})
+  set(CAPNP_LIBRARIES ${LIB_CAPNPC} ${LIB_CAPNP} ${LIB_KJ})
+  set(CAPNP_LIBRARIES_LITE ${LIB_CAPNP} ${LIB_KJ})
 endif ()

 if (NOT CAPNP_FOUND)
@@ -60,8 +60,8 @@
   set(LIB_KJ ${LIB_PRE}/${STATIC_PRE}kj${STATIC_SUF})
   set(LIB_CAPNP ${LIB_PRE}/${STATIC_PRE}capnp${STATIC_SUF})
   set(LIB_CAPNPC ${LIB_PRE}/${STATIC_PRE}capnpc${STATIC_SUF})
-  set(CAPNP_LIBRARIES ${LIB_KJ} ${LIB_CAPNP} ${LIB_CAPNPC})
-  set(CAPNP_LIBRARIES_LITE ${LIB_KJ} ${LIB_CAPNP})
+  set(CAPNP_LIBRARIES ${LIB_CAPNPC} ${LIB_CAPNP} ${LIB_KJ})
+  set(CAPNP_LIBRARIES_LITE ${LIB_CAPNP} ${LIB_KJ})
   set(CAPNP_INCLUDE_DIRS ${INCLUDE_PRE})
   set(CAPNP_EXECUTABLE ${BIN_PRE}/capnp${CMAKE_EXECUTABLE_SUFFIX})
   set(CAPNPC_CXX_EXECUTABLE ${BIN_PRE}/capnpc-c++${CMAKE_EXECUTABLE_SUFFIX})


Trying my own Eigen fork to fix SVD segfault

Former-commit-id: ece3ff385b39df4ab7f172c0e08ea9ac66f9b9bc

--- cmake-modules/Fetch_Ceres.cmake
+++ cmake-modules/Fetch_Ceres.cmake
@@ -21,12 +21,13 @@
 #    set(FLAGS "-DEIGEN_MAX_STATIC_ALIGN_BYTES=0 -DNDEBUG -O3 -fstack-protector  -g -fno-omit-frame-pointer -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_DEBUG -D_FORTIFY_SOURCE=2")
 #    set(FLAGS "-DEIGEN_MAX_STATIC_ALIGN_BYTES=0 -DNDEBUG -O3 -fstack-protector  -g -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2")
     unset(FLAGS CACHE)
+    set(FLAGS "${COMMON_OPTIONS}")
     if(CMAKE_BUILD_TYPE MATCHES Debug)
-        set(FLAGS "${COMMON_OPTIONS} ${DEBUG_OPTIONS}")
+        set(FLAGS "${FLAGS} ${DEBUG_OPTIONS}")
     elseif(CMAKE_BUILD_TYPE MATCHES Release)
-        set(FLAGS "${COMMON_OPTIONS} ${RELEASE_OPTIONS}")
+        set(FLAGS "${FLAGS} ${RELEASE_OPTIONS}")
     elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
-        set(FLAGS "${COMMON_OPTIONS} ${RELWITHDEBINFO_OPTIONS}")
+        set(FLAGS "${FLAGS} ${RELWITHDEBINFO_OPTIONS}")
     endif()

@@ -34,9 +35,9 @@
     ### Compiler-dependent flags ###
     ################################

-#    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-#        set(FLAGS "${FLAGS} -static --gcc-toolchain=${GCC_TOOLCHAIN} -stdlib=libstdc++")
-#    endif()
+    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+        set(FLAGS "${FLAGS}  -Wno-unused-local-typedef -Wno-unused-parameter -Wno-ignored-qualifiers")
+    endif()
     set(FLAGS "${FLAGS} -I${GLOG_INCLUDE_DIR} -L${GLOG_LIBRARY_DIR} -I${GFLAGS_INCLUDE_DIR}  -L${GFLAGS_LIBRARY_DIR}")
     string (REPLACE ";" " " FLAGS "${FLAGS}")


Add a new version for the sqlite3 find module.

--- cmake/Modules/FindSqlite3.cmake
+++ cmake/Modules/FindSqlite3.cmake
@@ -1,82 +1,84 @@
-# - Try to find sqlite3
-# Find sqlite3 headers, libraries and the answer to all questions.
+# - Try to find Sqlite3
+# Once done this will define
 #
-#  SQLITE3_FOUND               True if sqlite3 got found
-#  SQLITE3_INCLUDEDIR          Location of sqlite3 headers
-#  SQLITE3_LIBRARIES           List of libaries to use sqlite3
-#  SQLITE3_DEFINITIONS         Definitions to compile sqlite3
+#  SQLITE3_FOUND - system has Sqlite3
+#  SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory
+#  SQLITE3_LIBRARIES - Link these to use Sqlite3
+#  SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3
 #
-# Copyright (c) 2007 Juha Tuomala <tuju@iki.fi>
-# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
-# Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
+#  Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
 #
 #  Redistribution and use is allowed according to the terms of the New
 #  BSD license.
 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 #

-INCLUDE( FindPkgConfig )
-# Take care about sqlite3.pc settings
-IF ( Sqlite3_FIND_REQUIRED )
-  SET( _pkgconfig_REQUIRED "REQUIRED" )
-ELSE ( Sqlite3_FIND_REQUIRED )
-  SET( _pkgconfig_REQUIRED "" )
-ENDIF ( Sqlite3_FIND_REQUIRED )

-IF ( SQLITE3_MIN_VERSION )
-	PKG_SEARCH_MODULE( SQLITE3 ${_pkgconfig_REQUIRED} sqlite3>=${SQLITE3_MIN_VERSION} )
-ELSE ( SQLITE3_MIN_VERSION )
-	pkg_search_module( SQLITE3 ${_pkgconfig_REQUIRED} sqlite3 )
-ENDIF ( SQLITE3_MIN_VERSION )
+if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
+  # in cache already
+  set(SQLITE3_FOUND TRUE)
+else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
+  # use pkg-config to get the directories and then use these values
+  # in the FIND_PATH() and FIND_LIBRARY() calls
+  include(UsePkgConfig)

+  pkgconfig(sqlite3 _Sqlite3IncDir _Sqlite3LinkDir _Sqlite3LinkFlags _Sqlite3Cflags)

-# Look for sqlite3 include dir and libraries w/o pkgconfig
-IF ( NOT SQLITE3_FOUND AND NOT PKG_CONFIG_FOUND )
-	FIND_PATH( _sqlite3_include_DIR sqlite3.h
-		PATHS
-		/opt/local/include/
-		/sw/include/
-		/usr/local/include/
-		/usr/include/
-	)
-	FIND_LIBRARY( _sqlite3_link_DIR sqlite3
-		PATHS
-		/opt/local/lib
-		/sw/lib
-		/usr/lib
-		/usr/local/lib
-		/usr/lib64
-		/usr/local/lib64
-		/opt/lib64
-	)
-	IF ( _sqlite3_include_DIR AND _sqlite3_link_DIR )
-		SET ( _sqlite3_FOUND TRUE )
-	ENDIF ( _sqlite3_include_DIR AND _sqlite3_link_DIR )
+  set(SQLITE3_DEFINITIONS ${_Sqlite3Cflags})

+  find_path(SQLITE3_INCLUDE_DIR
+    NAMES
+      sqlite3.h
+    PATHS
+      ${_Sqlite3IncDir}
+      /usr/include
+      /usr/local/include
+      /opt/local/include
+      /sw/include
+  )

-	IF ( _sqlite3_FOUND )
-		SET ( SQLITE3_INCLUDE_DIRS ${_sqlite3_include_DIR} )
-		SET ( SQLITE3_LIBRARIES ${_sqlite3_link_DIR} )
-	ENDIF ( _sqlite3_FOUND )
+  find_library(SQLITE3_LIBRARY
+    NAMES
+      sqlite3
+    PATHS
+      ${_Sqlite3LinkDir}
+      /usr/lib
+      /usr/local/lib
+      /opt/local/lib
+      /sw/lib
+  )

-	# Report results
-	IF ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
-		SET( SQLITE3_FOUND 1 )
-		IF ( NOT Sqlite3_FIND_QUIETLY )
-			MESSAGE( STATUS "Found sqlite3: ${SQLITE3_LIBRARIES} ${SQLITE3_INCLUDE_DIRS}" )
-		ENDIF ( NOT Sqlite3_FIND_QUIETLY )
-	ELSE ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
-		IF ( Sqlite3_FIND_REQUIRED )
-			MESSAGE( SEND_ERROR "Could NOT find sqlite3" )
-		ELSE ( Sqlite3_FIND_REQUIRED )
-			IF ( NOT Sqlite3_FIND_QUIETLY )
-				MESSAGE( STATUS "Could NOT find sqlite3" )
-			ENDIF ( NOT Sqlite3_FIND_QUIETLY )
-		ENDIF ( Sqlite3_FIND_REQUIRED )
-	ENDIF ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
+  if (SQLITE3_LIBRARY)
+    set(SQLITE3_FOUND TRUE)
+  endif (SQLITE3_LIBRARY)

-ENDIF ( NOT SQLITE3_FOUND AND NOT PKG_CONFIG_FOUND )
+  set(SQLITE3_INCLUDE_DIRS
+    ${SQLITE3_INCLUDE_DIR}
+  )

-# Hide advanced variables from CMake GUIs
-MARK_AS_ADVANCED( SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIRS )
+  if (SQLITE3_FOUND)
+    set(SQLITE3_LIBRARIES
+      ${SQLITE3_LIBRARIES}
+      ${SQLITE3_LIBRARY}
+    )
+  endif (SQLITE3_FOUND)

+  if (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
+     set(SQLITE3_FOUND TRUE)
+  endif (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
+
+  if (SQLITE3_FOUND)
+    if (NOT Sqlite3_FIND_QUIETLY)
+      message(STATUS "Found Sqlite3: ${SQLITE3_LIBRARIES}")
+    endif (NOT Sqlite3_FIND_QUIETLY)
+  else (SQLITE3_FOUND)
+    if (Sqlite3_FIND_REQUIRED)
+      message(FATAL_ERROR "Could not find Sqlite3")
+    endif (Sqlite3_FIND_REQUIRED)
+  endif (SQLITE3_FOUND)
+
+  # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view
+  mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)
+
+endif (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
+


Squashed '3rdparty/github/cmake-utils/' changes from 372b25c6..c662ce98

c662ce98 cmake/MyPackagePrintSetup.cmake: add CMAKE_MAKE_PROGRAM

git-subtree-dir: 3rdparty/github/cmake-utils
git-subtree-split: c662ce9829d61399f157826f3b6395ecb9d6a330

--- cmake/MyPackagePrintSetup.cmake
+++ cmake/MyPackagePrintSetup.cmake
@@ -12,6 +12,7 @@
   MESSAGE(STATUS "         CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
   MESSAGE(STATUS "               CMAKE_CFG_INTDIR: ${CMAKE_CFG_INTDIR}")
   MESSAGE(STATUS "               CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+  MESSAGE(STATUS "             CMAKE_MAKE_PROGRAM: ${CMAKE_MAKE_PROGRAM}")
   MESSAGE(STATUS "               CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
   MESSAGE(STATUS "            CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")
   MESSAGE(STATUS "                  CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")


Fixed XLink dependency in config mode

Fixed XLink dependency in config mode

--- cmake/depthaiDependencies.cmake
+++ cmake/depthaiDependencies.cmake
@@ -54,19 +54,17 @@
 find_package(nlohmann_json ${_QUIET} CONFIG REQUIRED)

 # XLink
-if(NOT CONFIG_MODE)
-    if(DEPTHAI_XLINK_LOCAL)
-        set(_BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
-        set(BUILD_SHARED_LIBS OFF)
-        add_subdirectory("${DEPTHAI_XLINK_LOCAL}" ${CMAKE_CURRENT_BINARY_DIR}/XLink)
-        set(BUILD_SHARED_LIBS "${_BUILD_SHARED_LIBS_SAVED}")
-        unset(_BUILD_SHARED_LIBS_SAVED)
-        if(NOT BUILD_SHARED_LIBS)
-            list(APPEND targets_to_export XLink)
-        endif()
-    else()
-        find_package(XLink ${_QUIET} CONFIG REQUIRED)
+if(DEPTHAI_XLINK_LOCAL)
+    set(_BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
+    set(BUILD_SHARED_LIBS OFF)
+    add_subdirectory("${DEPTHAI_XLINK_LOCAL}" ${CMAKE_CURRENT_BINARY_DIR}/XLink)
+    set(BUILD_SHARED_LIBS "${_BUILD_SHARED_LIBS_SAVED}")
+    unset(_BUILD_SHARED_LIBS_SAVED)
+    if(NOT BUILD_SHARED_LIBS)
+        list(APPEND targets_to_export XLink)
     endif()
+else()
+    find_package(XLink ${_QUIET} CONFIG REQUIRED)
 endif()

 # OpenCV 4 - (optional, quiet always)


Add call to find_package to load LLVM dependencies

ClangConfig requires LLVMConfig, so add find_package call in
ClangConfig so find_package(clang REQUIRED CONFIG) will just work.  This
makes it easier for cmake based projects to use clang, e.g., tools using
ClangTooling.

Patch by Don Hinton

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

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

--- cmake/modules/ClangConfig.cmake
+++ cmake/modules/ClangConfig.cmake
@@ -4,5 +4,7 @@
 # uses LLVM's. When it does, we should move this file to ClangConfig.cmake.in
 # and call configure_file() on it.

+find_package(LLVM REQUIRED CONFIG)
+
 # Provide all our library targets to users.
 include("${CMAKE_CURRENT_LIST_DIR}/ClangTargets.cmake")


Update CMake dependencies.

Update CMake dependencies.

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

--- cmake/modules/LLVMLibDeps.cmake
+++ cmake/modules/LLVMLibDeps.cmake
@@ -23,7 +23,6 @@
 set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
 set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMSystem LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
-set(MSVC_LIB_DEPS_LLVMDebugger LLVMAnalysis LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
 set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMHello LLVMCore LLVMSupport LLVMSystem)
 set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTransformUtils)


build: repair the sub-build for libdispatch on Windows i686

When building on Windows i686 with a toolchain build for Windows x64, we
would try to build libdispatch for i686 as x86_64.  This obviously would
be incorrect.  Explicitly pass the target triple for the sub-builds.  We
can do this unconditionally since we always use `clang-cl` builds.  This
allows us to build the SDK only components for Windows i686 from a 64bit
build.

--- cmake/modules/Libdispatch.cmake
+++ cmake/modules/Libdispatch.cmake
@@ -69,6 +69,11 @@
   foreach(arch ${ARCHS})
     set(LIBDISPATCH_VARIANT_NAME "libdispatch-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")

+    if(sdk MATCHES WINDOWS)
+      set(SWIFT_LIBDISPATCH_COMPILER_TRIPLE_CMAKE_ARGS -DCMAKE_C_COMPILER_TARGET=${SWIFT_SDK_WINDOWS_ARCH_${arch}_TRIPLE};-DCMAKE_CXX_COMPILER_TARGET=${SWIFT_SDK_WINDOWS_ARCH_${arch}_TRIPLE})
+    endif()
+
+
     if(NOT sdk STREQUAL ANDROID)
       set(SWIFT_LIBDISPATCH_SYSTEM_PROCESSOR  -DCMAKE_SYSTEM_PROCESSOR=${arch})
     endif()
@@ -80,6 +85,7 @@
                           -DCMAKE_AR=${CMAKE_AR}
                           -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                           ${SWIFT_LIBDISPATCH_COMPILER_CMAKE_ARGS}
+                          ${SWIFT_LIBDISPATCH_COMPILER_TRIPLE_CMAKE_ARGS}
                           -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
                           -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
                           -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}


fix if Zorba is built with a different store (name of the tests contained a suffix that doesn't exist anymore)

--- cmake_modules/ZorbaModule.cmake
+++ cmake_modules/ZorbaModule.cmake
@@ -544,13 +544,7 @@
     set (willfail 1)
   endif (willfail)

-  # simplestore executable doesn't need an extension
-  SET(SUFFIX)
-  IF (NOT ${ZORBA_STORE_NAME} STREQUAL "simplestore")
-    SET(SUFFIX "_${ZORBA_STORE_NAME}")
-  ENDIF (NOT ${ZORBA_STORE_NAME} STREQUAL "simplestore")
-
-  set_tests_properties ("${testname}${SUFFIX}"
+  set_tests_properties ("${testname}"
     PROPERTIES WILL_FAIL ${willfail})

   # Also store the name and bug ID of this test in our output file


further apple fix

further apple fix

--- cmakemodules/DownloadGlog.cmake
+++ cmakemodules/DownloadGlog.cmake
@@ -13,5 +13,9 @@
 file(MAKE_DIRECTORY "${install_dir}/include")

 set(${package_found_prefix}_CMAKE_DEP glog_external)
-set(${package_found_prefix}_LIBRARIES "${install_dir}/lib${LIBSUFFIX}/libglog.a")
+if(APPLE)
+    set(${package_found_prefix}_LIBRARIES "${install_dir}/lib/libglog.a")
+elseif(UNIX)
+    set(${package_found_prefix}_LIBRARIES "${install_dir}/lib${LIBSUFFIX}/libglog.a")
+endif()
 set(${package_found_prefix}_INCLUDE_DIRS "${install_dir}/include")


Make it possible to find numpy without checking API features

--- modules/FindNumpy.cmake
+++ modules/FindNumpy.cmake
@@ -85,7 +85,7 @@
 if(NUMPYLIBRARY_FOUND)
     set(NUMPYLIBRARY_FOUND TRUE CACHE BOOL "Numpy library was found")
     set(NumpyLibrary_FOUND TRUE CACHE BOOL "Numpy library was found")
-    set(NUMPY_INCLUDE_DIRS
+    set(NUMPY_INCLUDE_DIRS
         "${NUMPY_INCLUDE_DIRS}" CACHE
         PATH "Path to numpy includes"
     )
@@ -94,35 +94,36 @@
     return()
 endif()

-## Now check some features of numpy c api
-## This is RSDT stuff
-macro(numpy_feature_test OUTVARNAME testfilename testname)
-    ## try to compile and run
-    ## Using Release flags because MSCrapware fails otherwise.
-    try_compile(
-      ${OUTVARNAME}
-      ${CMAKE_BINARY_DIR}
-      ${CMAKE_CURRENT_LIST_DIR}/numpy/${testfilename}
-      COMPILE_DEFINITIONS -I${PYTHON_INCLUDE_DIRS}  -I${NUMPY_INCLUDE_DIRS}
-                          -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
-      CMAKE_FLAGS -DLINK_LIBRARIES:STRING=${PYTHON_LIBRARIES}
-                  -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CMAKE_CXX_FLAGS_RELEASE}"
-                  -DCMAKE_C_FLAGS_DEBUG:STRING="${CMAKE_C_FLAGS_RELEASE}"
-                  -DCMAKE_EXE_LINKER_FLAGS_DEBUG:STRING="${CMAKE_EXE_LINKER_FLAGS_RELEASE}"
-      OUTPUT_VARIABLE NUMPY_TESTCOMPILE
-    )
-    ## display results
-    if(NOT Numpy_FIND_QUIETLY)
-        message (STATUS "[NumPy] ${testname} = ${${OUTVARNAME}}")
-    endif()
-    set(${OUTVARNAME} ${${OUTVARNAME}}
-        CACHE BOOL
-        "Numpy feature check: ${testname}"
-    )
-endmacro()
+if(NOT no_numpy_feature_tests)
+    ## Now check some features of numpy c api
+    macro(numpy_feature_test OUTVARNAME testfilename testname)
+        ## try to compile and run
+        ## Using Release flags because MSCrapware fails otherwise.
+        try_compile(
+          ${OUTVARNAME}
+          ${CMAKE_BINARY_DIR}
+          ${CMAKE_CURRENT_LIST_DIR}/numpy/${testfilename}
+          COMPILE_DEFINITIONS -I${PYTHON_INCLUDE_DIRS}  -I${NUMPY_INCLUDE_DIRS}
+                              -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+          CMAKE_FLAGS -DLINK_LIBRARIES:STRING=${PYTHON_LIBRARIES}
+                      -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CMAKE_CXX_FLAGS_RELEASE}"
+                      -DCMAKE_C_FLAGS_DEBUG:STRING="${CMAKE_C_FLAGS_RELEASE}"
+                      -DCMAKE_EXE_LINKER_FLAGS_DEBUG:STRING="${CMAKE_EXE_LINKER_FLAGS_RELEASE}"
+          OUTPUT_VARIABLE NUMPY_TESTCOMPILE
+        )
+        ## display results
+        if(NOT Numpy_FIND_QUIETLY)
+            message (STATUS "[NumPy] ${testname} = ${${OUTVARNAME}}")
+        endif()
+        set(${OUTVARNAME} ${${OUTVARNAME}}
+            CACHE BOOL
+            "Numpy feature check: ${testname}"
+        )
+    endmacro()

-numpy_feature_test(NUMPY_NPY_LONG_DOUBLE test_numpy_long_double.cc "Long double exists")
-numpy_feature_test(NUMPY_NPY_BOOL test_numpy_ubyte.cc "Bool is a separate type")
-numpy_feature_test(NUMPY_NPY_ARRAY test_numpy_is_noarray.c "NPY_ARRAY_* macros exist")
-numpy_feature_test( NUMPY_NPY_ENABLEFLAGS test_numpy_has_enableflags.c
-                    "PyArray_ENABLEFLAGS exists" )
+    numpy_feature_test(NUMPY_NPY_LONG_DOUBLE test_numpy_long_double.cc "Long double exists")
+    numpy_feature_test(NUMPY_NPY_BOOL test_numpy_ubyte.cc "Bool is a separate type")
+    numpy_feature_test(NUMPY_NPY_ARRAY test_numpy_is_noarray.c "NPY_ARRAY_* macros exist")
+    numpy_feature_test( NUMPY_NPY_ENABLEFLAGS test_numpy_has_enableflags.c
+                        "PyArray_ENABLEFLAGS exists" )
+endif()


Fix code coverage ignored paths.

Fix code coverage ignored paths.

* Replace 'tests/*' with '*/test/*'.
* Replace '/usr/*' with '/usr/include/*'.  This resolves an issue where
  it was impossible to test code coverage with the source in /usr/src.
* Ignore build/include/jansson.h as we just want src/jansson.h.

--- cmake/CodeCoverage.cmake
+++ cmake/CodeCoverage.cmake
@@ -111,7 +111,7 @@

 		# Capturing lcov counters and generating report
 		COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info --rc lcov_branch_coverage=1
-		COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned --rc lcov_branch_coverage=1
+		COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/build/include/*' '*/test/*' '/usr/include/*' --output-file ${_outputname}.info.cleaned --rc lcov_branch_coverage=1
 		COMMAND ${GENHTML_PATH} --branch-coverage -o ${_outputname} ${_outputname}.info.cleaned
 		COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned


add debug message

add debug message

--- cmake/DetectOpenCV.cmake
+++ cmake/DetectOpenCV.cmake
@@ -9,6 +9,7 @@

     if(OpenCV_DIR_EXT STREQUAL ".pc")

+        message(STATUS "PC file ${OpenCV_DIR}")
         if(NOT EXISTS ${OpenCV_DIR})
             message(SEND_ERROR "${OpenCV_DIR}. File does not exist.")
         endif(NOT EXISTS ${OpenCV_DIR})


avoid overriding cached opencv dir variable

--- cmake/DetectOpenCV.cmake
+++ cmake/DetectOpenCV.cmake
@@ -10,7 +10,6 @@

 else(DEFINED OpenCV_DIR)

-    set(OpenCV_DIR "" CACHE PATH "Root directory for OpenCV build directory." )
     find_package(OpenCV REQUIRED core highgui imgproc ml)

 endif(DEFINED OpenCV_DIR)


add dependencies when TARGET is exists

add dependencies when TARGET is exists

--- cmake/InstallFolly.cmake
+++ cmake/InstallFolly.cmake
@@ -29,6 +29,14 @@
         TEST_COMMAND        ""
     )

+    if (TARGET GFlags)
+        add_dependencies(Folly GFlags)
+    endif ()
+
+    if (TARGET GLog)
+        add_dependencies(Folly GLog)
+    endif ()
+
     ExternalProject_Get_Property(Folly INSTALL_DIR)

     set (FOLLY_ROOT_DIR         ${INSTALL_DIR})


Update ModulePython.cmake

Update ModulePython.cmake

--- cmake/ModulePython.cmake
+++ cmake/ModulePython.cmake
@@ -1,7 +1,7 @@
-# Build Python bindings if module is enabled and SWIG is found
+# Build Python bindings (requires SWIG installed)

-find_package(SWIG)
-if(SWIG_FOUND AND FAST_MODULE_Python)
+if(FAST_MODULE_Python)
+    find_package(SWIG REQUIRED)
     message("-- SWIG found, creating python bindings...")
     include(${SWIG_USE_FILE})


Fixed setting of MPI parameters in Cmake.

--- cmake/NektarCommon.cmake
+++ cmake/NektarCommon.cmake
@@ -170,10 +170,14 @@

     IF( NEKTAR_USE_MPI )
         TARGET_LINK_LIBRARIES(${name} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
-        SET_PROPERTY(TARGET ${name}
-                     APPEND PROPERTY COMPILE_FLAGS ${MPI_COMPILE_FLAGS})
-        SET_PROPERTY(TARGET ${name}
-                     APPEND PROPERTY LINK_FLAGS ${MPI_LINK_FLAGS})
+        SET_TARGET_PROPERTIES(${name}
+            PROPERTIES COMPILE_FLAGS "${THE_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}")
+        SET_TARGET_PROPERTIES(${name}
+            PROPERTIES LINK_FLAGS "${THE_LINK_FLAGS} ${MPI_LINK_FLAGS}")
+        #SET_PROPERTY(TARGET ${name}
+        #             APPEND PROPERTY COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
+        #SET_PROPERTY(TARGET ${name}
+        #             APPEND PROPERTY LINK_FLAGS "${MPI_LINK_FLAGS}")
     ENDIF( NEKTAR_USE_MPI )

     IF( ${CMAKE_SYSTEM} MATCHES "Linux.*" )


Turn off -Wimplicit-int-conversion for development

--- cmake/add_warnings.cmake
+++ cmake/add_warnings.cmake
@@ -31,6 +31,9 @@
     # FIXME: Temporarily silenced during development
     list(APPEND all_warn -Wno-sign-conversion)

+    # FIXME: Temporarily silenced during development
+    list(APPEND all_warn -Wno-implicit-int-conversion)
+
     # FIXME: Temporarily silence warnings during development
     if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     list(APPEND all_warn -Wno-missing-noreturn)


CMake: add static analysis tools

CMake: add static analysis tools

--- cmake/bart_options.cmake
+++ cmake/bart_options.cmake
@@ -28,6 +28,18 @@
   "BART_LOG_BACKEND" OFF)
 cmake_dependent_option(BART_LOG_GADGETRON_BACKEND "Use the Gadgetron logging backend" OFF
   "BART_LOG_BACKEND" OFF)
+
+# ------------------------------------------------------------------------------
+
+option(BART_SA "Turn on static analysis for compiling and linking BART" OFF)
+cmake_dependent_option(BART_SA_CPPCHECK "Run cppcheck on each file" OFF
+  "BART_SA" OFF)
+cmake_dependent_option(BART_SA_CLANG_TIDY "Run clang-tidy on each file" OFF
+  "BART_SA" OFF)
+cmake_dependent_option(BART_SA_IWYU "Run include-what-you-use on each file" OFF
+  "BART_SA" OFF)
+cmake_dependent_option(BART_SA_LWYU "Run link-what-you-use at the linking stage" OFF
+  "BART_SA" OFF)

 # ------------------------------------------------------------------------------

@@ -168,6 +180,59 @@
 if(BART_LOG_GADGETRON_BACKEND)
   message(STATUS "Delegating all outputs to the Gadgetron logging backend")
 endif(BART_LOG_GADGETRON_BACKEND)
+
+# ==============================================================================
+
+if(BART_SA)
+  if(BART_SA_CPPCHECK)
+    find_program(_cppcheck
+      NAMES cppcheck
+      DOC "cppcheck executable path"
+      )
+    mark_as_advanced(_cppcheck)
+    if(NOT _cppcheck)
+      message(WARNING "Unable to find the path to the cppcheck executable")
+    else()
+      set(BART_SA_CPPCHECK_C_ARGS   "" CACHE STRING "Arguments to pass to cppcheck for C code")
+      set(BART_SA_CPPCHECK_CXX_ARGS "-std=c++11" CACHE STRING "Arguments to pass to cppcheck for C++ code")
+      set(CMAKE_C_CPPCHECK   "${_cppcheck};${BART_SA_CPPCHECK_C_ARGS}")
+      set(CMAKE_CXX_CPPCHECK "${_cppcheck};${BART_SA_CPPCHECK_CXX_ARGS}")
+    endif()
+  endif()
+  if(BART_SA_CLANG_TIDY)
+    find_program(_clang_tidy
+      NAMES clang-tidy
+      DOC "clang-tidy executable path"
+      )
+    mark_as_advanced(_clang_tidy)
+    if(NOT _clang_tidy)
+      message(WARNING "Unable to find the path to the clang-tidy executable")
+    else()
+      set(BART_SA_CLANG_TIDY_C_ARGS   "-checks=*,-cppcoreguidelines-*,-hicpp-*" CACHE STRING "Arguments to pass to clang-tidy for C code")
+      set(BART_SA_CLANG_TIDY_CXX_ARGS "-checks=*" CACHE STRING "Arguments to pass to clang-tidy for C++ code")
+      set(CMAKE_C_CLANG_TIDY   "${_clang_tidy};${BART_SA_CLANG_TIDY_C_ARGS}")
+      set(CMAKE_CXX_CLANG_TIDY "${_clang_tidy};${BART_SA_CLANG_TIDY_CXX_ARGS}")
+    endif()
+  endif()
+  if(BART_SA_IWYU)
+    find_program(_iwyu
+      NAMES iwyu include-what-you-use
+      DOC "include-what-you-use executable path"
+      )
+    mark_as_advanced(_iwyu)
+    if(NOT _iwyu)
+      message(WARNING "Unable to find the path to the _iwyu executable")
+    else()
+      set(BART_SA_IWYU_C_ARGS "" CACHE STRING "Arguments to pass to include-what-you-use for C code")
+      set(BART_SA_IWYU_CXX_ARGS "" CACHE STRING "Arguments to pass to include-what-you-use for C++ code")
+      set(CMAKE_C_INCLUDE_WHAT_YOU_USE   "${_iwyu};${BART_SA_IWYU_C_ARGS}")
+      set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${_iwyu};${BART_SA_IWYU_CXX_ARGS}")
+    endif()
+  endif()
+  if(BART_SA_LWYU)
+    set(CMAKE_LINK_WHAT_YOU_USE TRUE)
+  endif()
+endif()

 # ==============================================================================


script update

script update

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@6709 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/ctest_script.cmake
+++ cmake/ctest_script.cmake
@@ -4,6 +4,20 @@
 ##
 ## Author: Angelos Mantzaflaris
 ## Copyright (C) 2012 - 2016 RICAM-Linz.
+##
+## To execute:
+##
+##   ctest -S /path/to/ctest_script.cmake
+##
+## For extra information
+##
+##   ctest -S /path/to/ctest_script.cmake -V
+##
+## or even  -VV
+##
+## Set execution options in the Configuration part.
+## For multiple tests (eg. different compilers) copy this file and adjust options.
+##
 ######################################################################

 ## #################################################################
@@ -11,29 +25,44 @@
 ## #################################################################

 # ID for this computer that shows up on the dashboard.
-set(CTEST_SITE "SP2_0407_OpenSuse")
+find_program(HOSTNAME_CMD NAMES hostname)
+exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
+set(CTEST_SITE "${HOSTNAME}")
+
+# The Generator for CMake.
+set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+
+# Set compiler
+#set(CXX g++)
+#set(CC  gcc)

 # Build type
 set(CTEST_BUILD_CONFIGURATION RelWithDebInfo)

+# Name of this build
+find_program(UNAME NAMES uname)
+exec_program("${UNAME}" ARGS "-s" OUTPUT_VARIABLE osname)
+exec_program("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "cpu")
+set(CTEST_BUILD_NAME "${osname}-${cpu} ${CTEST_CMAKE_GENERATOR} / ${CTEST_BUILD_CONFIGURATION} ${CXX}")
+
 # Test type (Nightly, Continuous, Experimental)
-set(dashboard_model "Nightly")
+set(dashboard_model "Experimental")
+
+# For continuous builds, number of seconds to stay alive
+set(dashboard_runtime 40000)

 # Build flags
 set( CTEST_BUILD_FLAGS "-j2")

 # Source folder
-set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/..)
+set(CTEST_SOURCE_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}/..)

 #Build folder
 set(CTEST_BINARY_DIRECTORY ${CTEST_SOURCE_DIRECTORY}/build_ctest)

-# Name of this build (eg. compiler/build type)
-set(CTEST_BUILD_NAME "GCC_4.7_${CTEST_BUILD_CONFIGURATION}")
-
 # Update type (eg. svn or git)
 set( UPDATE_TYPE svn)
-#set( CTEST_UPDATE_COMMAND "svn_github.sh")
+set( CTEST_UPDATE_COMMAND "svn") #"${CTEST_SOURCE_DIRECTORY}/cmake/svn_github.sh"

 # Timeouts
 set(CTEST_TEST_TIMEOUT 200 CACHE STRING
@@ -60,31 +89,36 @@
 #set(CTEST_CUSTOM_COVERAGE_EXCLUDE "${CTEST_SOURCE_DIRECTORY}/external/")

 # Memory check with valgrind
-set(dashboard_do_memcheck true)
-set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
+#set(dashboard_do_memcheck true)
+#set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")

-# The Generator for CMake.
-set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
-
-# This is the directory where the source and build trees will be placed.
-get_filename_component(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}/dashboard_gismo" ABSOLUTE)

 ## #################################################################
-## Test routine
+## Test routines
 ## #################################################################

-if("${dashboard_model}" STREQUAL "Continuous")
-  set(dashboard_continuous 1)
-  set(dashboard_loop 40000)
-else()
-  set(dashboard_continuous 0)
-  set(dashboard_loop 0)
-endif()
+macro(run_ctests)
+  ctest_configure(OPTIONS "${gismo_build_options}")
+  ctest_submit(PARTS Update Notes Configure)
+  ctest_build()
+  ctest_build(TARGET doc-snippets APPEND)
+  ctest_submit(PARTS Build)
+  ctest_test()
+  ctest_submit(PARTS Test)

+  if(dashboard_do_coverage)
+     message("Running coverage..")
+     ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+     ctest_submit(PARTS Coverage)
+  endif()

-#todo
-#if("${dashboard_model}" STREQUAL "Continuous")
+  if(dashboard_do_memcheck)
+    message("Running memcheck..")
+    ctest_memcheck()
+    ctest_submit(PARTS MemCheck)
+  endif()
+endmacro(run_ctests)

 #if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
 #  message("Starting fresh configuration...")
@@ -92,25 +126,25 @@
 #endif()

 file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
-ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+#ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})

 ctest_start(${dashboard_model})
-ctest_configure(OPTIONS "${gismo_build_options}")
-ctest_submit(PARTS Update Notes Configure)
-ctest_build()
-ctest_submit(PARTS Build)
-ctest_test()
-ctest_submit(PARTS Test)

-if(dashboard_do_coverage)
-   message("Running coverage..")
-   ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
-   ctest_submit(PARTS Coverage)
-endif()
+if(NOT "${dashboard_model}" STREQUAL "Continuous")

-if(dashboard_do_memcheck)
-    message("Running memcheck..")
-    ctest_memcheck()
-    ctest_submit(PARTS MemCheck)
-endif()
+ctest_update()
+run_ctests()

+else() #continuous model
+
+while(${CTEST_ELAPSED_TIME} LESS ${dashboard_runtime})
+  set(START_TIME ${CTEST_ELAPSED_TIME})
+  ctest_update(RETURN_VALUE count)
+  #message(STATUS "Found ${count} changed files.")
+  if( ${count} GREATER 0 )
+    run_ctests()
+  endif()
+  ctest_sleep(${START_TIME} 300    ${CTEST_ELAPSED_TIME})
+endwhile()
+
+endif(NOT "${dashboard_model}" STREQUAL "Continuous")


NaCl with Cmake: New path to NaCl transpiler repository

--- cmake/post.service.cmake
+++ cmake/post.service.cmake
@@ -85,7 +85,7 @@
 if (EXISTS ${CMAKE_SOURCE_DIR}/nacl.txt)
   add_custom_command(
      OUTPUT nacl_content.cpp
-     COMMAND cat ${CMAKE_SOURCE_DIR}/nacl.txt | python $ENV{HOME}/oxling/NaClv4/NaClv4.py ${CMAKE_BINARY_DIR}/nacl_content.cpp
+     COMMAND cat ${CMAKE_SOURCE_DIR}/nacl.txt | python $ENV{HOME}/NaCl/NaCl.py ${CMAKE_BINARY_DIR}/nacl_content.cpp
      DEPENDS ${CMAKE_SOURCE_DIR}/nacl.txt
    )
    add_library(nacl_content STATIC nacl_content.cpp)


Fixed typo in CodeCoverage.cmake (#32)

Fixed typo in CodeCoverage.cmake (#32)

* Fixed: typo in CodeCoverage

* Exclude "3rd" party directory from code coverage

--- cmake/CodeCoverage.cmake
+++ cmake/CodeCoverage.cmake
@@ -76,7 +76,7 @@
 		# Capturing lcov counters and generating report
 		COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info

-        COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/tests/*' '/usr/*' '*/external/*' '/Applications/*' --output-file ${_outputname}.info.cleaned
+        COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/tests/*' '/usr/*' '*/external/*' '*/3rd/*' '/Applications/*' --output-file ${_outputname}.info.cleaned
 		COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
         COMMAND ${LCOV_PATH} --list ${_outputname}.info.cleaned

@@ -98,10 +98,10 @@

     # Check prereqs
-    fund_program(GCOV_PATH gcov)
-    fund_program(LCOV_PATH lcov)
-    fund_program(GENHTML_PATH genhtml)
-    fund_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
+    find_program(GCOV_PATH gcov)
+    find_program(LCOV_PATH lcov)
+    find_program(GENHTML_PATH genhtml)
+    find_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)

     if(NOT GCOV_PATH)
         message(FATAL_ERROR "gcov not found! Aborting...")


Add build number parameter for alpine based images

Signed-off-by: Arpad Boda <aboda@apache.org>

This closes #998

--- cmake/DockerConfig.cmake
+++ cmake/DockerConfig.cmake
@@ -55,6 +55,7 @@
         -c DISABLE_SCRIPTING=${DISABLE_SCRIPTING}
         -c DISABLE_CONTROLLER=${DISABLE_CONTROLLER}
         -c DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}
+        -c BUILD_NUMBER=${BUILD_NUMBER}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)

 # Create minimal docker image
@@ -66,6 +67,7 @@
         -v ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
         -i minimal
         -c DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}
+        -c BUILD_NUMBER=${BUILD_NUMBER}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)

 add_custom_target(


fix finFreeRTOS for M33 with NTZ

fix finFreeRTOS for M33 with NTZ

--- cmake/FindFreeRTOS.cmake
+++ cmake/FindFreeRTOS.cmake
@@ -155,6 +155,16 @@
             target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_SOURCE}")
             target_include_directories(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_PATH}")
         endif()
+
+        # armv8-m needs additional file even if using "No Trust Zone" port
+        if(${PORT} STREQUAL ARM_CM23_NTZ OR ${PORT} STREQUAL ARM_CM33_NTZ)
+            find_file(FreeRTOS_${PORT}_ASM
+                NAMES portasm.c
+                PATHS "${FreeRTOS_${PORT}_PATH}"
+                NO_DEFAULT_PATH
+            )
+            target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_ASM}")
+        endif()

         if(FreeRTOS_${PORT}_PATH AND
            FreeRTOS_${PORT}_SOURCE AND


Bugfix: misspelled STM32F2 peripherals names.

--- cmake/FindSTM32HAL.cmake
+++ cmake/FindSTM32HAL.cmake
@@ -46,7 +46,7 @@
     SET(HAL_COMPONENTS adc can cortex crc cryp dac dcmi dma eth flash
                        gpio hash hcd i2c i2s irda iwdg nand nor pccard
                        pcd pwr rcc rng rtc sd smartcard spi sram tim
-                       uart sart wwdg fsmc sdmmc usbb)
+                       uart usart wwdg fsmc sdmmc usb)

     SET(HAL_REQUIRED_COMPONENTS cortex pwr rcc)


deactive failing git function

deactive failing git function

--- cmake/GitFunctions.cmake
+++ cmake/GitFunctions.cmake
@@ -4,6 +4,22 @@
 set(__git_functions YES)

 function( get_info_from_git )
+	# get the link of remote
+#    execute_process(
+#        COMMAND git remote -v
+#        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+#        RESULT_VARIABLE   git_result
+#        OUTPUT_VARIABLE   git_branch
+#        ERROR_VARIABLE    git_error
+#        OUTPUT_STRIP_TRAILING_WHITESPACE
+#        ERROR_STRIP_TRAILING_WHITESPACE
+#    )
+#    if( NOT git_result EQUAL 0 )
+#        message( FATAL_ERROR "Failed to execute Git: ${git_error}")
+#    else()
+#        set(GIT_URL ${git_branch} PARENT_SCOPE)
+#    endif()
+	# get the branch name
     execute_process(
         COMMAND git rev-parse --abbrev-ref HEAD
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -18,8 +34,7 @@
     else()
         set(GIT_BRANCH ${git_branch} PARENT_SCOPE)
     endif()
-
-    # Get the latest abbreviated commit hash of the working branch
+    # get the latest abbreviated commit hash of the working branch
     execute_process(
         COMMAND git log -1 --format=%h
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -32,9 +47,24 @@
     if( NOT git_result EQUAL 0 )
         message( FATAL_ERROR "Failed to execute Git: ${git_error}")
     else()
+        set(GIT_COMMIT_SHA ${git_commit_hash} PARENT_SCOPE)
+    endif()
+    # get the latest commit hash of the working branch
+    execute_process(
+        COMMAND git log -1 --format=%H
+        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+        RESULT_VARIABLE   git_result
+        OUTPUT_VARIABLE   git_commit_hash
+        ERROR_VARIABLE    git_error
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        ERROR_STRIP_TRAILING_WHITESPACE
+    )
+    if( NOT git_result EQUAL 0 )
+        message( FATAL_ERROR "Failed to execute Git: ${git_error}")
+    else()
         set(GIT_COMMIT_HASH ${git_commit_hash} PARENT_SCOPE)
     endif()
-
+    # get the last tag
     execute_process(
         COMMAND           git describe --tags --abbrev=0
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"


Version update to 0.9.7

Version update to 0.9.7


Builds on windows

Builds on windows

--- cmake/gtest-config.cmake
+++ cmake/gtest-config.cmake
@@ -37,6 +37,24 @@
   get_property(GTEST_MAIN_LIBRARY TARGET libgtest-main PROPERTY LOCATION)
   set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
   set(GTEST_INCLUDE_DIR ${SOURCE_DIR}/include)
+
+  ### INSTALL
+  if(NOT TARGET install-gtest)
+    add_custom_target(install-gtest DEPENDS ${GTEST_BOTH_LIBRARIES})
+  endif()
+  foreach(lib libgtest libgtest-main)
+    get_target_property(loc ${lib} IMPORTED_LOCATION)
+    if(MSVC)
+      string(REPLACE ${CMAKE_CFG_INTDIR} Debug   loc_debug   ${loc})
+      string(REPLACE ${CMAKE_CFG_INTDIR} Release loc_release ${loc})
+    else()
+      set(loc_debug   ${loc})
+      set(loc_release ${loc})
+    endif()
+    install(FILES ${loc_debug}   DESTINATION bin CONFIGURATIONS Debug)
+    install(FILES ${loc_release} DESTINATION bin CONFIGURATIONS Release)
+endforeach()
+
 endif()
 find_package_handle_standard_args(GTEST DEFAULT_MSG
   GTEST_BOTH_LIBRARIES
@@ -50,20 +68,3 @@
   endforeach()
 endmacro()

-### INSTALL
-if(NOT TARGET install-gtest)
-  add_custom_target(install-gtest DEPENDS ${GTEST_BOTH_LIBRARIES})
-endif()
-#install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --build --target install-gtest)")
-foreach(lib ${GTEST_BOTH_LIBRARIES})
-  get_target_property(loc ${lib} IMPORTED_LOCATION)
-  if(MSVC)
-    string(REPLACE ${CMAKE_CFG_INTDIR} Debug   loc_debug   ${loc})
-    string(REPLACE ${CMAKE_CFG_INTDIR} Release loc_release ${loc})
-  else()
-    set(loc_debug   ${loc})
-    set(loc_release ${loc})
-  endif()
-  install(FILES ${loc_debug}   DESTINATION bin CONFIGURATIONS Debug)
-  install(FILES ${loc_release} DESTINATION bin CONFIGURATIONS Release)
-endforeach()


- updated the overwrite script to also take cppunit into account and remove a warning

--- cmake-set-dependencies.cmake
+++ cmake-set-dependencies.cmake
@@ -69,12 +69,26 @@
 set (LAPACK_F2C_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libf2c.lib CACHE FILEPATH "lapack library" FORCE)
 endif()

+# cpp unit
+if (NOT EXISTS ${CPPUNIT_INCLUDE_DIR})
+set (CPPUNIT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "cpp unit include directory" FORCE)
+endif()
+if (NOT EXISTS ${CPPUNIT_LIBRARY})
+set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/cppunit.lib CACHE FILEPATH "cppunit library" FORCE)
+endif()
+
 # expat
 if (NOT EXISTS ${LIBEXPAT_INCLUDE_DIR})
 set (LIBEXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
 endif()
 if (NOT EXISTS ${LIBEXPAT_LIBRARY})
 set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
+endif()
+if (NOT EXISTS ${EXPAT_INCLUDE_DIR})
+set (EXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
+endif()
+if (NOT EXISTS ${EXPAT_LIBRARY})
+set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
 endif()

 # mml
@@ -147,6 +161,14 @@
 endif()
 endif()

+# cpp unit
+if (NOT EXISTS ${CPPUNIT_INCLUDE_DIR})
+set (CPPUNIT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "cpp unit include directory" FORCE)
+endif()
+if (NOT EXISTS ${CPPUNIT_LIBRARY})
+set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libcppunit.a CACHE FILEPATH "cppunit library" FORCE)
+endif()
+
 # expat
 if (NOT EXISTS ${LIBEXPAT_INCLUDE_DIR})
 set (LIBEXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
@@ -155,6 +177,13 @@
 set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
 endif()

+if (NOT EXISTS ${EXPAT_INCLUDE_DIR})
+set (EXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
+endif()
+if (NOT EXISTS ${EXPAT_LIBRARY})
+set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
+endif()
+
 # mml
 if (NOT EXISTS ${MML_INCLUDE_DIR})
 set (MML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "mml include directory" FORCE)
@@ -182,4 +211,4 @@

 endif()

-endif(COPASI_DEPENDENCY_DIR)+endif()


- also allow the name from the dependency archive to be used (blas.lib / lapack.lib as generated the clapack src distributions)

--- cmake-set-dependencies.cmake
+++ cmake-set-dependencies.cmake
@@ -58,8 +58,111 @@

   # clapack
   set (CLAPACK_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "clapack include directory" FORCE)
+
+  # the default clapack uses the names 'lapack.lib' / 'blas.lib'
+  set(CLAPACK_LIBRARY_LAPACK ${COPASI_DEPENDENCY_DIR}/lib/liblapack.lib)
+  if (NOT EXISTS ${CLAPACK_LIBRARY_LAPACK})
+  set(CLAPACK_LIBRARY_LAPACK ${COPASI_DEPENDENCY_DIR}/lib/lapack.lib)
+  endif()
+  set(CLAPACK_LIBRARY_BLAS ${COPASI_DEPENDENCY_DIR}/lib/libblas.lib)
+  if (NOT EXISTS ${CLAPACK_LIBRARY_BLAS})
+  set(CLAPACK_LIBRARY_BLAS ${COPASI_DEPENDENCY_DIR}/lib/blas.lib)
+  endif()
   set (CLAPACK_LIBRARIES
-       ${COPASI_DEPENDENCY_DIR}/lib/liblapack.lib;${COPASI_DEPENDENCY_DIR}/lib/libblas.lib;${COPASI_DEPENDENCY_DIR}/lib/libf2c.lib
+       ${CLAPACK_LIBRARY_LAPACK};${CLAPACK_LIBRARY_BLAS};${COPASI_DEPENDENCY_DIR}/lib/libf2c.lib
+       CACHE FILEPATH "lapack library" FORCE)
+
+  add_definitions(-DHAVE_BLASWRAP_H)
+  add_definitions(-DHAVE_F2C_H)
+  add_definitions(-DHAVE_CLAPACK_H)
+  add_definitions(-DNO_BLAS_WRAP)
+
+  set (BLA_VENDOR "COPASI Dependencies")
+  set (CLAPACK_FOUND TRUE)
+  mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARIES)
+
+# cpp unit
+if (NOT EXISTS ${CPPUNIT_INCLUDE_DIR})
+set (CPPUNIT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "cpp unit include directory" FORCE)
+endif()
+if (NOT EXISTS ${CPPUNIT_LIBRARY})
+set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/cppunit.lib CACHE FILEPATH "cppunit library" FORCE)
+endif()
+
+# expat
+if (NOT EXISTS ${LIBEXPAT_INCLUDE_DIR})
+set (LIBEXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
+endif()
+if (NOT EXISTS ${LIBEXPAT_LIBRARY})
+set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
+endif()
+if (NOT EXISTS ${EXPAT_INCLUDE_DIR})
+set (EXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
+endif()
+if (NOT EXISTS ${EXPAT_LIBRARY})
+set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
+endif()
+
+# mml
+if (NOT EXISTS ${MML_INCLUDE_DIR})
+set (MML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "mml include directory" FORCE)
+endif()
+if (NOT EXISTS ${MML_LIBRARY})
+set (MML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/mml.lib CACHE FILEPATH "mml library" FORCE)
+endif()
+
+# QWT
+if (NOT EXISTS ${QWT_INCLUDE_DIR})
+set (QWT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwt include directory" FORCE)
+endif()
+if (NOT EXISTS ${QWT_LIBRARY})
+set (QWT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/qwt.lib CACHE FILEPATH "qwt library" FORCE)
+endif()
+
+# QWT Plot
+if (NOT EXISTS ${QWTPLOT3D_INCLUDE_DIR})
+set (QWTPLOT3D_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwtplot3d include directory" FORCE)
+endif()
+if (NOT EXISTS ${QWTPLOT3D_LIBRARY})
+set (QWTPLOT3D_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/qwtplot3d.lib CACHE FILEPATH "qwtplot3d library" FORCE)
+endif()
+
+
+else()
+
+# dependencies for linux like
+
+# SBW
+if (NOT EXISTS ${SBW_INCLUDE_DIR})
+set (SBW_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "SBW include directory" FORCE)
+endif()
+if (NOT EXISTS ${SBW_LIBRARY})
+set (SBW_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libSBW-static.a CACHE FILEPATH "SBW library" FORCE)
+set (SBW_LIBRARIES ${COPASI_DEPENDENCY_DIR}/lib/libSBW-static.a CACHE FILEPATH "SBW library" FORCE)
+endif()
+
+
+# libsbml
+if (NOT EXISTS ${LIBSBML_INCLUDE_DIR})
+set (LIBSBML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "SBML include directory" FORCE)
+endif()
+if (NOT EXISTS ${LIBSBML_LIBRARY})
+set (LIBSBML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libsbml-static.a CACHE FILEPATH "libSBML library" FORCE)
+endif()
+
+# raptor
+if (NOT EXISTS ${RAPTOR_INCLUDE_DIR})
+set (RAPTOR_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "raptor include directory" FORCE)
+endif()
+if (NOT EXISTS ${RAPTOR_LIBRARY})
+set (RAPTOR_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libraptor.a CACHE FILEPATH "raptor library" FORCE)
+endif()
+
+if (NOT APPLE)
+  # clapack
+  set (CLAPACK_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "clapack include directory" FORCE)
+  set (CLAPACK_LIBRARIES
+       ${COPASI_DEPENDENCY_DIR}/lib/liblapack.a;${COPASI_DEPENDENCY_DIR}/lib/libblas.a;${COPASI_DEPENDENCY_DIR}/lib/libf2c.a
        CACHE FILEPATH "lapack library" FORCE)

   add_definitions(-DHAVE_BLASWRAP_H)
@@ -70,13 +173,14 @@
   set (BLA_VENDOR "COPASI Dependecies")
   set (CLAPACK_FOUND TRUE)
   mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARIES)
+endif()

 # cpp unit
 if (NOT EXISTS ${CPPUNIT_INCLUDE_DIR})
 set (CPPUNIT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "cpp unit include directory" FORCE)
 endif()
 if (NOT EXISTS ${CPPUNIT_LIBRARY})
-set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/cppunit.lib CACHE FILEPATH "cppunit library" FORCE)
+set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libcppunit.a CACHE FILEPATH "cppunit library" FORCE)
 endif()

 # expat
@@ -84,13 +188,14 @@
 set (LIBEXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
 endif()
 if (NOT EXISTS ${LIBEXPAT_LIBRARY})
-set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
-endif()
+set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
+endif()
+
 if (NOT EXISTS ${EXPAT_INCLUDE_DIR})
 set (EXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
 endif()
 if (NOT EXISTS ${EXPAT_LIBRARY})
-set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/expat.lib CACHE FILEPATH "expat library" FORCE)
+set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
 endif()

 # mml
@@ -98,7 +203,7 @@
 set (MML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "mml include directory" FORCE)
 endif()
 if (NOT EXISTS ${MML_LIBRARY})
-set (MML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/mml.lib CACHE FILEPATH "mml library" FORCE)
+set (MML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libmml.a CACHE FILEPATH "mml library" FORCE)
 endif()

 # QWT
@@ -106,7 +211,7 @@
 set (QWT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwt include directory" FORCE)
 endif()
 if (NOT EXISTS ${QWT_LIBRARY})
-set (QWT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/qwt.lib CACHE FILEPATH "qwt library" FORCE)
+set (QWT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libqwt.a CACHE FILEPATH "qwt library" FORCE)
 endif()

 # QWT Plot
@@ -114,101 +219,6 @@
 set (QWTPLOT3D_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwtplot3d include directory" FORCE)
 endif()
 if (NOT EXISTS ${QWTPLOT3D_LIBRARY})
-set (QWTPLOT3D_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/qwtplot3d.lib CACHE FILEPATH "qwtplot3d library" FORCE)
-endif()
-
-
-else()
-
-# dependencies for linux like
-
-# SBW
-if (NOT EXISTS ${SBW_INCLUDE_DIR})
-set (SBW_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "SBW include directory" FORCE)
-endif()
-if (NOT EXISTS ${SBW_LIBRARY})
-set (SBW_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libSBW-static.a CACHE FILEPATH "SBW library" FORCE)
-set (SBW_LIBRARIES ${COPASI_DEPENDENCY_DIR}/lib/libSBW-static.a CACHE FILEPATH "SBW library" FORCE)
-endif()
-
-
-# libsbml
-if (NOT EXISTS ${LIBSBML_INCLUDE_DIR})
-set (LIBSBML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "SBML include directory" FORCE)
-endif()
-if (NOT EXISTS ${LIBSBML_LIBRARY})
-set (LIBSBML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libsbml-static.a CACHE FILEPATH "libSBML library" FORCE)
-endif()
-
-# raptor
-if (NOT EXISTS ${RAPTOR_INCLUDE_DIR})
-set (RAPTOR_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "raptor include directory" FORCE)
-endif()
-if (NOT EXISTS ${RAPTOR_LIBRARY})
-set (RAPTOR_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libraptor.a CACHE FILEPATH "raptor library" FORCE)
-endif()
-
-if (NOT APPLE)
-  # clapack
-  set (CLAPACK_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "clapack include directory" FORCE)
-  set (CLAPACK_LIBRARIES
-       ${COPASI_DEPENDENCY_DIR}/lib/liblapack.a;${COPASI_DEPENDENCY_DIR}/lib/libblas.a;${COPASI_DEPENDENCY_DIR}/lib/libf2c.a
-       CACHE FILEPATH "lapack library" FORCE)
-
-  add_definitions(-DHAVE_BLASWRAP_H)
-  add_definitions(-DHAVE_F2C_H)
-  add_definitions(-DHAVE_CLAPACK_H)
-  add_definitions(-DNO_BLAS_WRAP)
-
-  set (BLA_VENDOR "COPASI Dependecies")
-  set (CLAPACK_FOUND TRUE)
-  mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARIES)
-endif()
-
-# cpp unit
-if (NOT EXISTS ${CPPUNIT_INCLUDE_DIR})
-set (CPPUNIT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "cpp unit include directory" FORCE)
-endif()
-if (NOT EXISTS ${CPPUNIT_LIBRARY})
-set (CPPUNIT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libcppunit.a CACHE FILEPATH "cppunit library" FORCE)
-endif()
-
-# expat
-if (NOT EXISTS ${LIBEXPAT_INCLUDE_DIR})
-set (LIBEXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
-endif()
-if (NOT EXISTS ${LIBEXPAT_LIBRARY})
-set (LIBEXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
-endif()
-
-if (NOT EXISTS ${EXPAT_INCLUDE_DIR})
-set (EXPAT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "expat include directory" FORCE)
-endif()
-if (NOT EXISTS ${EXPAT_LIBRARY})
-set (EXPAT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libexpat.a CACHE FILEPATH "expat library" FORCE)
-endif()
-
-# mml
-if (NOT EXISTS ${MML_INCLUDE_DIR})
-set (MML_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "mml include directory" FORCE)
-endif()
-if (NOT EXISTS ${MML_LIBRARY})
-set (MML_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libmml.a CACHE FILEPATH "mml library" FORCE)
-endif()
-
-# QWT
-if (NOT EXISTS ${QWT_INCLUDE_DIR})
-set (QWT_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwt include directory" FORCE)
-endif()
-if (NOT EXISTS ${QWT_LIBRARY})
-set (QWT_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libqwt.a CACHE FILEPATH "qwt library" FORCE)
-endif()
-
-# QWT Plot
-if (NOT EXISTS ${QWTPLOT3D_INCLUDE_DIR})
-set (QWTPLOT3D_INCLUDE_DIR ${COPASI_DEPENDENCY_DIR}/include CACHE PATH "qwtplot3d include directory" FORCE)
-endif()
-if (NOT EXISTS ${QWTPLOT3D_LIBRARY})
 set (QWTPLOT3D_LIBRARY ${COPASI_DEPENDENCY_DIR}/lib/libqwtplot3d.a CACHE FILEPATH "qwtplot3d library" FORCE)
 endif()


Added Maya short version. Formatting

Added Maya short version. Formatting

--- cmake/Modules/FindMaya.cmake
+++ cmake/Modules/FindMaya.cmake
@@ -1,3 +1,4 @@
+
 # - Maya finder module
 # This module searches for a valid Maya instalation.
 # It searches for Maya's devkit, libraries, executables
@@ -28,8 +29,8 @@

 ## add one to this list to match your install if none match

-IF(APPLE)
-  FIND_PATH(MAYA_BASE_DIR ../../devkit/include/maya/MFn.h PATH
+if(APPLE)
+  find_path(MAYA_BASE_DIR ../../devkit/include/maya/MFn.h PATH
     ENV MAYA_LOCATION
     "/Applications/Autodesk/maya2016/Maya.app/Contents"
     "/Applications/Autodesk/maya2015/Maya.app/Contents"
@@ -40,7 +41,7 @@
     "/Applications/Autodesk/maya2011/Maya.app/Contents"
     "/Applications/Autodesk/maya2010/Maya.app/Contents"
   )
-  FIND_PATH(MAYA_LIBRARY_DIR libOpenMaya.dylib
+  find_path(MAYA_LIBRARY_DIR libOpenMaya.dylib
     PATHS
       ENV MAYA_LOCATION
       ${MAYA_BASE_DIR}
@@ -48,10 +49,10 @@
       Maya.app/Contents/MacOS/
     DOC "Maya's libraries path"
   )
-ENDIF(APPLE)
+endif(APPLE)

-IF(UNIX)
-  FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h
+if(UNIX)
+  find_path(MAYA_BASE_DIR include/maya/MFn.h
     PATH
       ENV MAYA_LOCATION
       "/usr/autodesk/maya2016"
@@ -63,7 +64,7 @@
       "/usr/autodesk/maya2011-x64"
       "/usr/autodesk/maya2010-x64"
   )
-  FIND_PATH(MAYA_LIBRARY_DIR libOpenMaya.so
+  find_path(MAYA_LIBRARY_DIR libOpenMaya.so
     PATHS
       ENV MAYA_LOCATION
       ${MAYA_BASE_DIR}
@@ -71,10 +72,10 @@
       lib/
     DOC "Maya's libraries path"
   )
-ENDIF(UNIX)
+endif(UNIX)

-IF(WIN32)
-  FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h
+if(WIN32)
+  find_path(MAYA_BASE_DIR include/maya/MFn.h
     PATH
       ENV MAYA_LOCATION
         "C:/Program Files/Autodesk/Maya2016"
@@ -94,7 +95,7 @@
         "C:/Program Files (x86)/Autodesk/Maya2010"
         "C:/Autodesk/maya-2010x64"
   )
-  FIND_PATH(MAYA_LIBRARY_DIR OpenMaya.lib
+  find_path(MAYA_LIBRARY_DIR OpenMaya.lib
     PATHS
       ENV MAYA_LOCATION
       ${MAYA_BASE_DIR}
@@ -102,9 +103,9 @@
       lib/
     DOC "Maya's libraries path"
   )
-ENDIF(WIN32)
+endif(WIN32)

-FIND_PATH(MAYA_INCLUDE_DIR maya/MFn.h
+find_path(MAYA_INCLUDE_DIR maya/MFn.h
   PATHS
     ENV MAYA_LOCATION
     ${MAYA_BASE_DIR}
@@ -114,7 +115,7 @@
   DOC "Maya's devkit headers path"
 )

-FIND_PATH(MAYA_LIBRARY_DIR OpenMaya
+find_path(MAYA_LIBRARY_DIR OpenMaya
   PATHS
     ENV MAYA_LOCATION
     ${MAYA_BASE_DIR}
@@ -124,9 +125,9 @@
   DOC "Maya's devkit headers path"
 )

-LIST(APPEND MAYA_INCLUDE_DIRS ${MAYA_INCLUDE_DIR})
+list(APPEND MAYA_INCLUDE_DIRS ${MAYA_INCLUDE_DIR})

-FIND_PATH(MAYA_DEVKIT_INC_DIR GL/glext.h
+find_path(MAYA_DEVKIT_INC_DIR GL/glext.h
   PATHS
     ENV MAYA_LOCATION
     ${MAYA_BASE_DIR}
@@ -136,9 +137,9 @@
   DOC "Maya's devkit headers path"
 )

-LIST(APPEND MAYA_INCLUDE_DIRS ${MAYA_DEVKIT_INC_DIR})
+list(APPEND MAYA_INCLUDE_DIRS ${MAYA_DEVKIT_INC_DIR})

-FOREACH(MAYA_LIB
+foreach(MAYA_LIB
   OpenMaya
   OpenMayaAnim
   OpenMayaFX
@@ -151,7 +152,7 @@
   cg
   cgGL
 )
-  FIND_LIBRARY(MAYA_${MAYA_LIB}_LIBRARY ${MAYA_LIB}
+  find_library(MAYA_${MAYA_LIB}_LIBRARY ${MAYA_LIB}
     PATHS
       ENV MAYA_LOCATION
       ${MAYA_BASE_DIR}
@@ -161,17 +162,18 @@
     DOC "Maya's ${MAYA_LIB} library path"
   )

-  LIST(APPEND ${MAYA_LIBRARIES} MAYA_${MAYA_LIB}_LIBRARY)
-ENDFOREACH(MAYA_LIB)
+  list(APPEND ${MAYA_LIBRARIES} MAYA_${MAYA_LIB}_LIBRARY)
+endforeach(MAYA_LIB)

 if(MAYA_INCLUDE_DIRS AND EXISTS "${MAYA_INCLUDE_DIR}/maya/MTypes.h")
-    FILE(STRINGS ${MAYA_INCLUDE_DIR}/maya/MTypes.h TMP REGEX "#define MAYA_API_VERSION.*$")
-    STRING(REGEX MATCHALL "[0-9]+" MAYA_API_VERSION ${TMP})
+    file(STRINGS ${MAYA_INCLUDE_DIR}/maya/MTypes.h TMP REGEX "#define MAYA_API_VERSION.*$")
+    string(REGEX MATCHALL "[0-9]+" MAYA_API_VERSION ${TMP})
+    string(SUBSTRING ${MAYA_API_VERSION} 0 4 MAYA_API_VERSION_SHORT)
 endif()

 # handle the QUIETLY and REQUIRED arguments and set MAYA_FOUND to TRUE if
 # all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
+include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Maya DEFAULT_MSG
     ${MAYA_LIBRARIES}
     MAYA_INCLUDE_DIRS)


Added check for CUDA toolkit version ( older can't compile Kepler )

--- cmake/OpenCVDetectCUDA.cmake
+++ cmake/OpenCVDetectCUDA.cmake
@@ -13,7 +13,12 @@

   message(STATUS "CUDA detected: " ${CUDA_VERSION})

-  set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+  if("CUDA_VERSION_STRING" VERSION_GREATER "4.1")
+    set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+  else()
+    set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0)" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+  endif()
+
   set(CUDA_ARCH_PTX "2.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")

   string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")


get some help from cmake_prefix_path, cmake_include_path to set up directories.

--- cmake/catkin_workspace.cmake
+++ cmake/catkin_workspace.cmake
@@ -7,10 +7,19 @@
   assert_file_exists(${catkin_EXTRAS_DIR}/templates/topologically_traverse.py.in "${catkin_EXTRAS_DIR}")
   assert_file_exists(${catkin_EXTRAS_DIR}/em/topologically_traverse.cmake.em "file not found")
   include_directories(${CMAKE_BINARY_DIR}/gen/cpp)
+  list(APPEND CMAKE_MODULE_PATH ${catkin_EXTRAS_DIR}/Modules)

   set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
+  foreach(path ${CMAKE_INCLUDE_PATH})
+    include_directories(${path})
+  endforeach()
+  foreach(path ${CMAKE_PREFIX_PATH})
+    message(STATUS "Include directory added: ${path}/include")
+    include_directories(${path}/include)
+  endforeach()

   # libraries.cmake
   configure_shared_library_build_settings()


[build] Pass target to linker for host tools for Apple SDKs (#32618)

As part of this refactor some code touched as part of #31794 to better fit into the work done in #32120 -- in detail

* `_add_host_variant_c_compile_link_flags` is now invoked by both add_swift_host_library and add_swift_host_library
* `_add_host_variant_c_compile_link_flags` now sets the target in linker arguments when building against Apple SDKs

Addresses rdar://64911978

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -88,6 +88,7 @@
       MACCATALYST_BUILD_FLAVOR ""
       DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
     target_compile_options(${name} PRIVATE -target;${target})
+    target_link_options(${name} PRIVATE -target;${target})
   endif()

   set(_sysroot
@@ -470,6 +471,7 @@

   _add_host_variant_c_compile_flags(${name})
   _add_host_variant_link_flags(${name})
+  _add_host_variant_c_compile_link_flags(${name})
   _set_target_prefix_and_suffix(${name} "${libkind}" "${SWIFT_HOST_VARIANT_SDK}")

   # Set compilation and link flags.
@@ -526,11 +528,6 @@
       target_link_options(${name} PRIVATE
         "LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
     endif()
-
-    get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
-      MACCATALYST_BUILD_FLAVOR ""
-      DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
-    target_link_options(${name} PRIVATE -target;${target})
   endif()

   add_dependencies(dev ${name})
@@ -575,6 +572,7 @@
   add_executable(${executable} ${ASHT_UNPARSED_ARGUMENTS})
   _add_host_variant_c_compile_flags(${executable})
   _add_host_variant_link_flags(${executable})
+  _add_host_variant_c_compile_link_flags(${executable})
   target_link_directories(${executable} PRIVATE
     ${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
   add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})


Its ok to fail on loading 'vendor-specific'

--- cmake/modules/FindRuby.cmake
+++ cmake/modules/FindRuby.cmake
@@ -51,6 +51,8 @@
     EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']"
        OUTPUT_VARIABLE RUBY_VENDORLIB_DIR)
 ELSE(RUBY_VENDOR_ARG)
+    MESSAGE(STATUS "'vendor-specific' not found, using 'site-specific'")
+
     # fall back to site*dir
     EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
        OUTPUT_VARIABLE RUBY_VENDORARCH_DIR)


Fix Ldap include path in cmake find module.

Change-Id: I877475e7f2b4888a712c3aef5bd207e35046afb1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3865
Reviewed-by: Nong Li <99a5e5f8f5911755b88e0b536d46aafa102bed41@cloudera.com>
Reviewed-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>
Tested-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>

--- cmake_modules/FindLdap.cmake
+++ cmake_modules/FindLdap.cmake
@@ -13,7 +13,7 @@
 )

 set(LDAP_INCLUDE_DIR
-  ${THIRDPARTY_LDAP}/install/include
+  ${THIRDPARTY_LDAP}/impala_install/include
 )

 find_library(LDAP_LIB_PATH NAMES ldap


remove prefix from module name

remove prefix from module name

--- cmake/DetectOpenCV.cmake
+++ cmake/DetectOpenCV.cmake
@@ -56,6 +56,8 @@

             convert_to_lib_name(__OpenCV_LIBS_MISSING_ITEM_MODULE ${__OpenCV_LIBS_MISSING_ITEM})

+            string(REGEX REPLACE "opencv_" "" __OpenCV_LIBS_MISSING_ITEM_MODULE ${__OpenCV_LIBS_MISSING_ITEM_MODULE})
+
             message(STATUS "__OpenCV_LIBS_MISSING_ITEM_MODULE=${__OpenCV_LIBS_MISSING_ITEM_MODULE}")
             list(FIND OpenCV_REQUIRED_MODULES ${__OpenCV_LIBS_MISSING_ITEM_MODULE} __MODULE_FOUND)
             if(NOT ${__MODULE_FOUND} EQUAL -1)


Findmuparser.cmake script updated

Findmuparser.cmake script updated

--- cmake/Findmuparser.cmake
+++ cmake/Findmuparser.cmake
@@ -11,36 +11,29 @@
 #   muparser_LIBRARIES           ... full path to muparser library
 #   muparser_INCLUDES            ... muparser include directory
 #
-# It defines the following targets:
-#   muparser::muparser           ... muparser library to link against
 #

-find_library(muparser_LIBRARY
-    NAMES muparser muparserd
-    HINTS ${muparser_ROOT} ENV muparser_ROOT
-)
+find_package(PkgConfig)

-find_path(muparser_INCLUDE_DIR
-    muParserDef.h
-    HINTS ${muparser_ROOT} ENV muparser_ROOT
-)
+pkg_check_modules(PC_MUPARSER QUIET muparser)
+set(MUPARSER_DEFINITIONS ${PC_MUPARSER_CFLAGS_OTHER})

-mark_as_advanced(muparser_INCLUDE_DIR muparser_LIBRARY)
+find_path(muparser_INCLUDES muParser.h
+          HINTS ${PC_MUPARSER_INCLUDEDIR} ${PC_MUPARSER_INCLUDE_DIRS})

-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(muparser
-    DEFAULT_MSG
-    muparser_LIBRARY muparser_INCLUDE_DIR)
+find_library(muparser_LIBRARIES NAMES muparser libmuparser
+             HINTS ${PC_MUPARSER_LIBDIR} ${PC_MUPARSER_LIBRARY_DIRS} )

-if (muparser_FOUND)
-    set(muparser_LIBRARIES ${muparser_LIBRARY} )
-    set(muparser_INCLUDES ${muparser_INCLUDE_DIR} )
+set(MUPARSER_LIBRARIES ${muparser_LIBRARIES} )
+set(MUPARSER_INCLUDE_DIRS ${muparser_INCLUDES} )

-    # add the target
-    add_library(muparser::muparser SHARED IMPORTED)
-    set_target_properties(muparser::muparser
-      PROPERTIES IMPORTED_LOCATION ${muparser_LIBRARIES}
-                 INTERACE_INCLUDE_DIRECTORIES ${muparser_INCLUDES}
-    )
+set(muparser_FOUND FALSE)
+if(muparser_INCLUDES AND muparser_LIBRARIES)
+    set(muparser_FOUND TRUE)
+    MESSAGE(STATUS "Found muParser: ${muparser_LIBRARIES}")
+else()
+    MESSAGE(STATUS "Not found muParser")
 endif()

+mark_as_advanced(muparser_INCLUDES muparser_LIBRARIES )
+


fix ocv_add_module CMake macro:

fix ocv_add_module CMake macro:

it tries to remove 'opencv_' prefix from 'name' variable, but
it creates new variable with the same name as module

--- cmake/OpenCVModule.cmake
+++ cmake/OpenCVModule.cmake
@@ -113,7 +113,6 @@
 macro(ocv_add_module _name)
   ocv_debug_message("ocv_add_module(" ${_name} ${ARGN} ")")
   string(TOLOWER "${_name}" name)
-  string(REGEX REPLACE "^opencv_" "" ${name} "${name}")
   set(the_module opencv_${name})

   # the first pass - collect modules info, the second pass - create targets


GCC BIN path

GCC BIN path

--- firmware/fw-stm32f042/STM32F042x6.cmake
+++ firmware/fw-stm32f042/STM32F042x6.cmake
@@ -10,10 +10,10 @@

 # specify the cross compiler
 SET(CMAKE_C_COMPILER_WORKS 1)
-SET(CMAKE_C_COMPILER ${ARM_NONE_EABI_GCC_BIN}/arm-none-eabi-gcc)
+SET(CMAKE_C_COMPILER ${ARM_NONE_EABI_GCC_BIN}arm-none-eabi-gcc)
 SET(CMAKE_CXX_COMPILER_WORKS 1)
-SET(CMAKE_CXX_COMPILER ${ARM_NONE_EABI_GCC_BIN}/arm-none-eabi-g++)
-set(CMAKE_SIZE ${ARM_NONE_EABI_GCC_BIN}/arm-none-eabi-size)
+SET(CMAKE_CXX_COMPILER ${ARM_NONE_EABI_GCC_BIN}arm-none-eabi-g++)
+set(CMAKE_SIZE ${ARM_NONE_EABI_GCC_BIN}arm-none-eabi-size)

 SET(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F042x6Tx_FLASH.ld)
 SET(COMMON_FLAGS "-mcpu=cortex-m0 -mthumb -mfloat-abi=soft -ffunction-sections -fdata-sections -Og -g3 -fno-common -fmessage-length=0 -Wall -DSTM32F042x6")


Update ITK version to after 5.2rc1

Update ITK version to after 5.2rc1

This update include fixes for MetaIO valgrind defects, and option to
select the threader at compile time.

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -57,7 +57,7 @@
 mark_as_advanced(ITK_GIT_REPOSITORY)
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

-set(_DEFAULT_ITK_GIT_TAG "v5.2rc01")
+set(_DEFAULT_ITK_GIT_TAG "3c399efa316ce7c38cd253a350383efbf118eb15")
 set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")


Update ITK to v5.2.1

Update ITK to v5.2.1

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -61,7 +61,7 @@
 mark_as_advanced(ITK_GIT_REPOSITORY)
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

-set(_DEFAULT_ITK_GIT_TAG "v5.2.0")
+set(_DEFAULT_ITK_GIT_TAG "v5.2.1")
 set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")