fixed deps on buildbot server && updated findMHD

--- cmake/FindMHD.cmake
+++ cmake/FindMHD.cmake
@@ -38,8 +38,8 @@
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

 	#TODO: place dlls into CMAKE_CFG_INTDIR subfolders
-	string(REPLACE ".lib" ".dll" MHD_DLL_RELEASE ${MHD_LIBRARY})
-	string(REPLACE "/lib/" "/bin/" MHD_DLL_RELEASE ${MHD_DLL_RELEASE})
+	#string(REPLACE ".lib" ".dll" MHD_DLL_RELEASE ${MHD_LIBRARY})
+	#string(REPLACE "/lib/" "/bin/" MHD_DLL_RELEASE ${MHD_DLL_RELEASE})

 	if (CMAKE_CL_64)
 		set(MHD_NAMES_DEBUG microhttpd_d_x64 microhttpd-10_d_x64 libmicrohttpd_d_x64 libmicrohttpd-dll_d_x64)
@@ -56,7 +56,7 @@
 	# not sure why this was commented
 	# always use release for now, need to ask Arkadiy
 	#string(REPLACE ".lib" ".dll" MHD_DLL_DEBUG ${MHD_LIBRARY_DEBUG})
-	#set(MHD_LIBRARIES optimized ${MHD_LIBRARIES} debug ${MHD_LIBRARY_DEBUG})
+	set(MHD_LIBRARIES optimized ${MHD_LIBRARIES} debug ${MHD_LIBRARY_DEBUG})

 endif()


CMake: genhtml *requires* c++filt

CMake: genhtml *requires* c++filt

--- cmake/genhtml.cmake
+++ cmake/genhtml.cmake
@@ -11,6 +11,7 @@
 endif()

 find_package(GenHtml REQUIRED)
+find_package(CppFilt REQUIRED)

 add_custom_target(
   genhtml


Bluetooth: controller: openisa: Fix unsupported ISR profiling

Fix duplicate include of lll_test.c file under the
unsupported ISR profiling feature in OpenISA port.

Signed-off-by: Vinayak Kariappa Chettimada <e780c9f87dc729ad454f47292ad82c8652353064@nordicsemi.no>

--- subsys/bluetooth/controller/ll_sw/openisa.cmake
+++ subsys/bluetooth/controller/ll_sw/openisa.cmake
@@ -37,10 +37,6 @@
     CONFIG_BT_CTLR_DTM
     ll_sw/openisa/lll/lll_test.c
   )
-  zephyr_library_sources_ifdef(
-    CONFIG_BT_CTLR_PROFILE_ISR
-    ll_sw/openisa/lll/lll_test.c
-  )
 endif()

 zephyr_library_sources_ifdef(


ENH: CI: PKG: (Temporarily) disabled LIBKML.

--- CI/configure_option.cmake
+++ CI/configure_option.cmake
@@ -38,7 +38,7 @@
 OTB_USE_GLFW:BOOL=ON
 OTB_USE_GLUT:BOOL=ON
 OTB_USE_GSL:BOOL=ON
-OTB_USE_LIBKML:BOOL=ON
+OTB_USE_LIBKML:BOOL=OFF
 OTB_USE_LIBSVM:BOOL=ON
 OTB_USE_MPI:BOOL=OFF
 OTB_USE_MUPARSER:BOOL=ON


indentation fix

indentation fix

--- CMake/global_config.cmake
+++ CMake/global_config.cmake
@@ -89,13 +89,11 @@
 macro(global_target_config)
     target_link_libraries(${LRS_TARGET} PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT})

-
-
     set_target_properties (${LRS_TARGET} PROPERTIES FOLDER Library)

     target_include_directories(${LRS_TARGET}
         PRIVATE
-			src
+            src
             ${ROSBAG_HEADER_DIRS}
             ${BOOST_INCLUDE_PATH}
             ${LZ4_INCLUDE_PATH}


generate more complicated brute force search paths

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@1279 5b2332b8-efa3-11de-8684-7d64432d61a3

--- CMakeModules/Sagase.cmake
+++ CMakeModules/Sagase.cmake
@@ -44,32 +44,22 @@
     #    set (normal_path_prefixes ${normal_path_prefixes} ${p})
     #endforeach ()

-    # add prefix paths
-    foreach (prefix ${path_prefixes})
-
-        set (includes ${includes}
-            ${prefix}/include)
-
-        set (libraries ${libraries}
-            ${prefix}/lib
-            ${prefix}/bin
-            ${prefix}/dll)
-
-    endforeach ()
+    set (path_names ${path_names} ".")

     # add prefix+name paths
     foreach (prefix ${path_prefixes})
         foreach (pkgname ${path_names})
-
-            set (includes ${includes}
-                ${prefix}/${pkgname}/include
-                ${prefix}/include/${pkgname})
-
-            set (libraries ${libraries}
-                ${prefix}/${pkgname}/lib ${prefix}/lib/${pkgname}
-                ${prefix}/${pkgname}/bin ${prefix}/bin/${pkgname}
-                ${prefix}/${pkgname}/dll ${prefix}/dll/${pkgname})
-
+            foreach (subpkgname ${path_names})
+
+                set (includes ${includes}
+                    ${prefix}/${pkgname}/include/${subpkgname})
+
+                set (libraries ${libraries}
+                    ${prefix}/${pkgname}/lib/${subpkgname}
+                    ${prefix}/${pkgname}/bin/${subpkgname}
+                    ${prefix}/${pkgname}/dll/${subpkgname})
+
+            endforeach ()
         endforeach ()
     endforeach ()

@@ -124,8 +114,9 @@
     set (found_ FALSE)

     foreach (name_ ${PKG_NAMES})
-
+
         string (TOUPPER ${name_} name_upper_)
+
         # find_package can't handle packages in all caps.
         # cmake is a macro language, which means it defines global variables,
         # which it tries to namespace by choosing all caps variable names,
@@ -190,6 +181,9 @@

         # generate a combination of possible search paths
         sagase_generate_paths (include_paths library_paths NAMES ${PKG_NAMES} PREFIXES ${PKG_PREFIXES})
+
+        # all C and C++ headers
+        set (HEADER_POSTFIXES ".h" ".hpp" ".hh" ".hxx")

         # follow platform library naming
         if (MSVC)
@@ -204,23 +198,19 @@

         # try using "COMPONENTS" as possible file names (without prefix or extension)
         foreach (component_ ${PKG_COMPONENTS})
-            # get C header path
-            find_path (${PREFIX}_${component_}_INCLUDE_DIR ${component_}.h ${include_paths})

-            if (${PREFIX}_${component_}_INCLUDE_DIR)
-                set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${PREFIX}_${component_}_INCLUDE_DIR})
-            endif ()
-
-			# get C++ header path
-            find_path (${PREFIX}_${component_}_INCLUDE_DIR ${component_}.hpp ${include_paths})
-
-            if (${PREFIX}_${component_}_INCLUDE_DIR)
-                set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${PREFIX}_${component_}_INCLUDE_DIR})
-            endif ()
+            # get header path
+            foreach (header_extension_ ${HEADER_POSTFIXES})
+                find_path (${PREFIX}_${component_}_INCLUDE_DIR ${component_}${header_extension_} ${include_paths})
+
+                if (${PREFIX}_${component_}_INCLUDE_DIR)
+                    set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${PREFIX}_${component_}_INCLUDE_DIR})
+                endif ()
+            endforeach ()

             # get library path
-            foreach (extension_ ${LIB_POSTFIXES})
-                find_path (${PREFIX}_${component_}_LIBRARY_DIR ${LIB_PREFIX}${component_}${extension_} ${library_paths})
+            foreach (lib_extension_ ${LIB_POSTFIXES})
+                find_path (${PREFIX}_${component_}_LIBRARY_DIR ${LIB_PREFIX}${component_}${lib_extension_} ${library_paths})

                 if (${PREFIX}_${component_}_LIBRARY_DIR)
                     set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${component_})
@@ -232,7 +222,7 @@

     # stop process if nothing is found through any means
     if (NOT found_ AND NOT ${PREFIX}_INCLUDE_DIRS AND NOT ${PREFIX}_LIBRARY_DIRS AND NOT ${PREFIX}_LIBRARIES)
-		message (FATAL_ERROR "!! sagase: unable to configure " ${PREFIX})
+        message (FATAL_ERROR "!! sagase: unable to configure " ${PREFIX})
     endif ()

     # remove duplicate entires from return variables


Fix whitespace

Fix whitespace

--- cmake/CompileOptions.cmake
+++ cmake/CompileOptions.cmake
@@ -1,7 +1,7 @@

-#
+#
 # Platform and architecture setup
-#
+#

 # Get upper case system name
 string(TOUPPER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME_UPPER)
@@ -13,11 +13,9 @@
 endif()

-
-
-#
+#
 # Project options
-#
+#

 set(DEFAULT_PROJECT_OPTIONS
     DEBUG_POSTFIX             "d"
@@ -29,23 +27,23 @@
 )

-#
+#
 # Include directories
-#
+#

 set(DEFAULT_INCLUDE_DIRECTORIES)

-#
+#
 # Libraries
-#
+#

 set(DEFAULT_LIBRARIES)

-#
+#
 # Compile definitions
-#
+#

 set(DEFAULT_COMPILE_DEFINITIONS
     SYSTEM_${SYSTEM_NAME_UPPER}
@@ -60,9 +58,9 @@
 endif ()

-#
+#
 # Compile options
-#
+#

 set(DEFAULT_COMPILE_OPTIONS)

@@ -84,13 +82,13 @@
         #/RTCc         # -> value is assigned to a smaller data type and results in a data loss
         #>

-        $<$<CONFIG:Release>:
+        $<$<CONFIG:Release>:
         /Gw           # -> whole program global optimization
-        /GS-          # -> buffer security check: no
+        /GS-          # -> buffer security check: no
         /GL           # -> whole program optimization: enable link-time code generation (disables Zi)
         /GF           # -> enable string pooling
         >
-
+
         # No manual c++11 enable for MSVC as all supported MSVC versions for cmake-init have C++11 implicitly enabled (MSVC >=2013)

     PUBLIC
@@ -101,14 +99,14 @@
 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
     PRIVATE
-	# Shared Object size
-	-s
-	-fmerge-all-constants
-	-fno-unroll-loops
-	-fno-unwind-tables
-	-fno-asynchronous-unwind-tables
-
-	# General
+    # Shared Object size
+        -s
+        -fmerge-all-constants
+        -fno-unroll-loops
+        -fno-unwind-tables
+        -fno-asynchronous-unwind-tables
+
+    # General
         -Wall
         -Wextra
         -Wunused
@@ -121,27 +119,27 @@
         -Wswitch-default
         -Wuninitialized
         -Wmissing-field-initializers
-
+
         $<$<CXX_COMPILER_ID:GNU>:
             -Wmaybe-uninitialized
-
+
             $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.8>:
                 -Wpedantic
-
+
                 -Wreturn-local-addr
             >
         >
-
+
         $<$<CXX_COMPILER_ID:Clang>:
             -Wpedantic
-
+
             # -Wreturn-stack-address # gives false positives
         >
     PUBLIC
         $<$<PLATFORM_ID:Darwin>:
             -pthread
         >
-
+
         $<$<VERSION_LESS:${CMAKE_VERSION},3.1>:
             -std=c++11
         >
@@ -149,9 +147,9 @@
 endif ()

-#
+#
 # Linker options
-#
+#

 set(DEFAULT_LINKER_OPTIONS)

@@ -159,8 +157,8 @@
 if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
     set(DEFAULT_LINKER_OPTIONS ${DEFAULT_LINKER_OPTIONS}
     PRIVATE
-	# Shared Object size
-	-Wl,-z,norelro,--build-id=none
+    # Shared Object size
+    -Wl,-z,norelro,--build-id=none
     PUBLIC
         -pthread
         -ldl


Revert "Removed HOUDINI_BIN variable in favor of multiple search paths." (#214)

This reverts commit 453443b483fa7a1f99fc9f2f8f181f174591b5f7.

--- cmake/FindHoudiniUsd.cmake
+++ cmake/FindHoudiniUsd.cmake
@@ -98,14 +98,20 @@
 endforeach()

 # Find Usd Schema Generator
+
+if(APPLE)
+        set(HOUDINI_BIN ${HOUDINI_ROOT}/Resources/bin)
+else()
+        set(HOUDINI_BIN ${HOUDINI_ROOT}/bin)
+endif()
+
 if (NOT USD_SCHEMA_GENERATOR)
         find_program(USD_SCHEMA_GENERATOR
                 NAMES
                 usdGenSchema.py
                 usdGenSchema
                 PATHS
-                ${HOUDINI_BIN}/bin
-                ${HOUDINI_ROOT}/Resources/bin
+                ${HOUDINI_BIN}
                 REQUIRED
                 NO_DEFAULT_PATH
                 )


add missing

add missing

--- cmake/FindHoudiniUsd.cmake
+++ cmake/FindHoudiniUsd.cmake
@@ -79,7 +79,7 @@

 # Usd
 list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) # append lib prefix to have same behaviour on win and lin
-set(_houdini_pxr_libs pxr_ar;pxr_arch;pxr_cameraUtil;pxr_garch;pxr_gf;pxr_glf;pxr_hd;pxr_hdSt;pxr_hdx;pxr_hf;pxr_hgi;pxr_hgiGL;pxr_hio;pxr_js;pxr_kind;pxr_ndr;pxr_pcp;pxr_plug;pxr_pxOsd;pxr_sdf;pxr_sdr;pxr_tf;pxr_trace;pxr_usd;pxr_usdHydra;pxr_usdImaging;pxr_usdImagingGL;pxr_usdLux;pxr_usdRender;pxr_usdShade;pxr_usdSkel;pxr_usdUtils;pxr_usdVol;pxr_vt;pxr_work;)
+set(_houdini_pxr_libs pxr_ar;pxr_arch;pxr_cameraUtil;pxr_garch;pxr_gf;pxr_glf;pxr_hd;pxr_hdSt;pxr_hdx;pxr_hf;pxr_hgi;pxr_hgiGL;pxr_hio;pxr_js;pxr_kind;pxr_ndr;pxr_pcp;pxr_plug;pxr_pxOsd;pxr_sdf;pxr_sdr;pxr_tf;pxr_trace;pxr_usd;pxr_usdHydra;pxr_usdImaging;pxr_usdImagingGL;pxr_usdLux;pxr_usdRender;pxr_usdShade;pxr_usdSkel;pxr_usdUtils;pxr_usdVol;pxr_vt;pxr_work;pxr_usdGeom)
 foreach(_pxr_lib ${_houdini_pxr_libs})
     find_library(${_pxr_lib}_path
             NAMES


Make BoringSSL build cross-platform and propagate some build flags to the sub-build.

--- cmake/external_rules.cmake
+++ cmake/external_rules.cmake
@@ -120,10 +120,34 @@
     set(ENV_COMMAND env -i PATH=${firebase_command_line_path} HOME=${firebase_command_line_home} )
   endif()

-  set(CMAKE_SUBBUILD_OPTIONS
-      -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}"
-      -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}"
-      -G "${CMAKE_GENERATOR}")
+  set(CMAKE_SUBBUILD_OPTIONS -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DOPENSSL_NO_ASM=1)
+  if(APPLE)
+    # Propagate MacOS build flags.
+    set(CMAKE_SUBBUILD_OPTIONS
+        ${CMAKE_SUBBUILD_OPTIONS}
+        -DCMAKE_OSX_ARCHITECTURES="${CMAKE_OSX_ARCHITECTURES}")
+  elseif(MSVC)
+    # Propagate MSVC build flags.
+    set(CMAKE_SUBBUILD_OPTIONS
+        ${CMAKE_SUBBUILD_OPTIONS}
+        -A "${CMAKE_GENERATOR_PLATFORM}")
+    if(MSVC_RUNTIME_LIBRARY_STATIC)
+      set(CMAKE_SUBBUILD_OPTIONS
+          ${CMAKE_SUBBUILD_OPTIONS}
+          -DMSVC_RUNTIME_LIBRARY_STATIC=1)
+    endif()
+  else()
+    # Propagate Linux build flags.
+    if(CMAKE_LIBRARY_PATH MATCHES "/usr/lib/i386-linux-gnu")
+      set(CMAKE_SUBBUILD_OPTIONS
+          ${CMAKE_SUBBUILD_OPTIONS}
+          -DCMAKE_SYSTEM_PROCESSOR=i386
+          -DCMAKE_C_FLAGS=-m32
+          -DCMAKE_CXX_FLAGS=-m32
+          -DCMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu)
+    endif()
+  endif()
+  message("Sub-build options: ${CMAKE_SUBBUILD_OPTIONS}")

   if(NOT ANDROID AND NOT IOS)
     execute_process(


cmake: Bump the minimum required Python version to 3.8

Given that 3.6 is now several years old and the current and previous
Ubuntu LTS ship with 3.8 or later, upgrade the minimum required Python
version from 3.6 to 3.8.

Signed-off-by: Carles Cufi <853081dc8dca4fe6a7e3c984752718b5db36e060@nordicsemi.no>

--- cmake/modules/python.cmake
+++ cmake/modules/python.cmake
@@ -11,7 +11,7 @@
   set(ENV{PYTHONIOENCODING} "utf-8")
 endif()

-set(PYTHON_MINIMUM_REQUIRED 3.6)
+set(PYTHON_MINIMUM_REQUIRED 3.8)

 # We are using foreach here, instead of find_program(PYTHON_EXECUTABLE_SYSTEM_DEFAULT "python" "python3")
 # cause just using find_program directly could result in a python2.7 as python, and not finding a valid python3.


fix build script (mt7688)

fix build script (mt7688)


Tag version as alpha

Tag version as alpha

--- cmake/ospray_version.cmake
+++ cmake/ospray_version.cmake
@@ -19,7 +19,7 @@
 set(OSPRAY_VERSION_PATCH 0)
 set(OSPRAY_SOVERSION 1)
 set(OSPRAY_VERSION_GITHASH 0)
-set(OSPRAY_VERSION_NOTE "")
+set(OSPRAY_VERSION_NOTE "alpha")

 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git AND
    IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git)


qibuild: Fix OSX rpath for targets generated in subfolders

Change-Id: I99dfe2bee10ebc6afdf5f3a8f6f682789b83fec0
Reviewed-on: http://gerrit.aldebaran.lan/87021
Reviewed-by: ngargaud <cc1f618ae68946993764fd1e75c94e934d965a38@aldebaran-robotics.com>
Tested-by: ngargaud <cc1f618ae68946993764fd1e75c94e934d965a38@aldebaran-robotics.com>

--- cmake/qibuild/target.cmake
+++ cmake/qibuild/target.cmake
@@ -127,9 +127,10 @@
     endif()
   endif()
   if(APPLE AND NOT ARG_NO_RPATH)
+     file(RELATIVE_PATH _dotdot "${_runtime_out}" "${QI_SDK_DIR}/${QI_SDK_LIB}")
      set_target_properties("${name}"
        PROPERTIES
-         INSTALL_RPATH "@executable_path/../lib;@executable_path/..")
+         INSTALL_RPATH "@executable_path/${_dotdot};@executable_path/${_dotdot}/..")
   endif()
 endfunction()

@@ -338,9 +339,14 @@
     endif()
   endif()
   if(APPLE AND NOT ARG_NO_RPATH AND NOT _type STREQUAL "STATIC")
+     set(_rpath "@loader_path")
+     file(RELATIVE_PATH _dotdot "${_lib_out}" "${QI_SDK_DIR}/${QI_SDK_LIB}")
+     if(NOT "${_dotdot}" STREQUAL "")
+         set(_rpath "${_rpath};@loader_path/${_dotdot}")
+     endif()
      set_target_properties("${name}"
        PROPERTIES
-         INSTALL_RPATH "@loader_path;@loader_path/..")
+         INSTALL_RPATH "${_rpath}")
   endif()
 endfunction()


added alternate search path for TBB under windows, fixed #138

--- common/cmake/FindTBB.cmake
+++ common/cmake/FindTBB.cmake
@@ -73,8 +73,8 @@
     SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
     SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
     FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
-    FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
-    FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
+    FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${TBB_LIBDIR} ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
+    FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIBDIR} ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
   ENDIF()

 ELSE ()


Reset devices cmake

Reset devices cmake

Signed-off-by: Andrew Butt <f0e550b392ccab9f366ecc80ae525c032211a45e@seas.upenn.edu>

--- common/cmake/devices.cmake
+++ common/cmake/devices.cmake
@@ -1008,270 +1008,490 @@
     message(FATAL_ERROR "BOARD is a required parameters.")
   endif()

-  get_target_property_required(DEVICE_MAIN ${BOARD} DEVICE)
+  get_target_property_required(DEVICE ${BOARD} DEVICE)
   get_target_property_required(PACKAGE ${BOARD} PACKAGE)

-  get_target_property(CONTAINED_ROI_DEVICES ${DEVICE_MAIN} CONTAINED_ROI_DEVICES)
-  if("${CONTAINED_ROI_DEVICES}" STREQUAL "CONTAINED_ROI_DEVICES-NOTFOUND")
-    set(CONTAINED_ROI_DEVICES ${DEVICE_MAIN})
+  get_target_property_required(ARCH ${DEVICE} ARCH)
+  get_target_property_required(DEVICE_TYPE ${DEVICE} DEVICE_TYPE)
+
+  get_target_property_required(YOSYS env YOSYS)
+  get_target_property_required(QUIET_CMD env QUIET_CMD)
+  get_target_property_required(YOSYS_SYNTH_SCRIPT ${ARCH} YOSYS_SYNTH_SCRIPT)
+  get_target_property_required(YOSYS_CONV_SCRIPT ${ARCH} YOSYS_CONV_SCRIPT)
+
+  get_target_property_required(
+    DEVICE_MERGED_FILE ${DEVICE_TYPE} DEVICE_MERGED_FILE
+  )
+  get_target_property_required(
+    OUT_RRXML_REAL ${DEVICE} ${PACKAGE}_OUT_RRXML_REAL
+  )
+  get_target_property_required(
+    OUT_RRBIN_REAL ${DEVICE} ${PACKAGE}_OUT_RRBIN_REAL
+  )
+  get_target_property_required(
+    OUT_RRXML_VIRT ${DEVICE} OUT_RRXML_VIRT
+  )
+
+  if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
+      get_target_property_required(PART_JSON ${BOARD} PART_JSON)
+  endif()
+
+  set(NAME ${ADD_FPGA_TARGET_NAME})
+  get_target_property_required(DEVICE_FULL_TEMPLATE ${ARCH} DEVICE_FULL_TEMPLATE)
+  string(CONFIGURE ${DEVICE_FULL_TEMPLATE} DEVICE_FULL)
+  set(FQDN ${ARCH}-${DEVICE_TYPE}-${DEVICE}-${PACKAGE})
+  set(OUT_LOCAL_REL ${NAME}/${FQDN})
+  set(OUT_LOCAL ${CMAKE_CURRENT_BINARY_DIR}/${OUT_LOCAL_REL})
+
+  # Create target to handle all output paths of off
+  add_custom_target(${NAME})
+  set_target_properties(${NAME} PROPERTIES
+      TOP ${TOP}
+      BOARD ${BOARD}
+      )
+  set(VPR_ROUTE_CHAN_WIDTH 100)
+  set(VPR_ROUTE_CHAN_MINWIDTH_HINT ${VPR_ROUTE_CHAN_WIDTH})
+
+  if(${ADD_FPGA_TARGET_NO_SYNTHESIS})
+    list(LENGTH ADD_FPGA_TARGET_SOURCES SRC_COUNT)
+    if(NOT ${SRC_COUNT} EQUAL 1)
+      message(FATAL_ERROR "In NO_SYNTHESIS, only one input source is allowed, given ${SRC_COUNT}.")
+    endif()
+    set(READ_FUNCTION "read_blif")
   else()
-    list(APPEND CONTAINED_ROI_DEVICES ${DEVICE_MAIN})
-  endif()
-
-  foreach(DEVICE ${CONTAINED_ROI_DEVICES})
-    get_target_property_required(ARCH ${DEVICE} ARCH)
-    get_target_property_required(DEVICE_TYPE ${DEVICE} DEVICE_TYPE)
-
-    get_target_property_required(YOSYS env YOSYS)
-    get_target_property_required(QUIET_CMD env QUIET_CMD)
-    get_target_property_required(YOSYS_SYNTH_SCRIPT ${ARCH} YOSYS_SYNTH_SCRIPT)
-    get_target_property_required(YOSYS_CONV_SCRIPT ${ARCH} YOSYS_CONV_SCRIPT)
-
-    get_target_property_required(
-      DEVICE_MERGED_FILE ${DEVICE_TYPE} DEVICE_MERGED_FILE
-    )
-    get_target_property_required(
-      OUT_RRXML_REAL ${DEVICE} ${PACKAGE}_OUT_RRXML_REAL
-    )
-    get_target_property_required(
-      OUT_RRBIN_REAL ${DEVICE} ${PACKAGE}_OUT_RRBIN_REAL
-    )
-    get_target_property_required(
-      OUT_RRXML_VIRT ${DEVICE} OUT_RRXML_VIRT
-    )
-
-    if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
-        get_target_property_required(PART_JSON ${BOARD} PART_JSON)
-    endif()
-
-    set(NAME ${ADD_FPGA_TARGET_NAME})
-    get_target_property_required(DEVICE_FULL_TEMPLATE ${ARCH} DEVICE_FULL_TEMPLATE)
-    string(CONFIGURE ${DEVICE_FULL_TEMPLATE} DEVICE_FULL)
-    set(FQDN ${ARCH}-${DEVICE_TYPE}-${DEVICE}-${PACKAGE})
-    set(OUT_LOCAL_REL ${NAME}/${FQDN})
-    set(OUT_LOCAL ${CMAKE_CURRENT_BINARY_DIR}/${OUT_LOCAL_REL})
-
-    # Create target to handle all output paths of off
-    add_custom_target(${NAME})
-    set_target_properties(${NAME} PROPERTIES
-        TOP ${TOP}
-        BOARD ${BOARD}
-        )
-    set(VPR_ROUTE_CHAN_WIDTH 100)
-    set(VPR_ROUTE_CHAN_MINWIDTH_HINT ${VPR_ROUTE_CHAN_WIDTH})
-
-    if(${ADD_FPGA_TARGET_NO_SYNTHESIS})
-      list(LENGTH ADD_FPGA_TARGET_SOURCES SRC_COUNT)
-      if(NOT ${SRC_COUNT} EQUAL 1)
-        message(FATAL_ERROR "In NO_SYNTHESIS, only one input source is allowed, given ${SRC_COUNT}.")
-      endif()
-      set(READ_FUNCTION "read_blif")
-    else()
-      set(READ_FUNCTION "read_verilog")
-    endif()
-
-    if(NOT ${ADD_FPGA_TARGET_EXPLICIT_ADD_FILE_TARGET})
-      if(NOT ${ADD_FPGA_TARGET_NO_SYNTHESIS})
-        foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
-          add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
-        endforeach()
-      else()
-        foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
-          add_file_target(FILE ${SRC})
-        endforeach()
-      endif()
-      foreach(SRC ${ADD_FPGA_TARGET_TESTBENCH_SOURCES})
+    set(READ_FUNCTION "read_verilog")
+  endif()
+
+  if(NOT ${ADD_FPGA_TARGET_EXPLICIT_ADD_FILE_TARGET})
+    if(NOT ${ADD_FPGA_TARGET_NO_SYNTHESIS})
+      foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
         add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
       endforeach()
-
-      if(NOT "${ADD_FPGA_TARGET_INPUT_IO_FILE}" STREQUAL "")
-        add_file_target(FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+    else()
+      foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
+        add_file_target(FILE ${SRC})
+      endforeach()
+    endif()
+    foreach(SRC ${ADD_FPGA_TARGET_TESTBENCH_SOURCES})
+      add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
+    endforeach()
+
+    if(NOT "${ADD_FPGA_TARGET_INPUT_IO_FILE}" STREQUAL "")
+      add_file_target(FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+    endif()
+    if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
+      add_file_target(FILE ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
+    endif()
+  endif()
+
+  if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
+    get_file_location(INPUT_XDC_FILE ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
+    append_file_dependency(YOSYS_IO_DEPS ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
+  endif()
+
+  #
+  # Generate BLIF as start of vpr input.
+  #
+  set(OUT_EBLIF ${OUT_LOCAL}/${TOP}.eblif)
+  set(OUT_EBLIF_REL ${OUT_LOCAL_REL}/${TOP}.eblif)
+  set(OUT_SYNTH_V ${OUT_LOCAL}/${TOP}_synth.v)
+  set(OUT_SYNTH_V_REL ${OUT_LOCAL_REL}/${TOP}_synth.v)
+  set(OUT_FASM_EXTRA ${OUT_LOCAL}/${TOP}_fasm_extra.fasm)
+
+  set(SOURCE_FILES_DEPS "")
+  set(SOURCE_FILES "")
+  foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
+    append_file_location(SOURCE_FILES ${SRC})
+    append_file_dependency(SOURCE_FILES_DEPS ${SRC})
+  endforeach()
+
+  set(CELLS_SIM_DEPS "")
+  get_cells_sim_path(PATH_TO_CELLS_SIM ${ARCH})
+  foreach(CELL ${PATH_TO_CELLS_SIM})
+    get_file_target(CELL_TARGET ${CELL})
+    list(APPEND CELLS_SIM_DEPS ${CELL_TARGET})
+  endforeach()
+
+  set(YOSYS_IO_DEPS "")
+
+  if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
+    get_target_property_required(PINMAP_FILE ${BOARD} PINMAP)
+    get_file_location(PINMAP ${PINMAP_FILE})
+    append_file_dependency(YOSYS_IO_DEPS ${PINMAP_FILE})
+  endif()
+
+  if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
+    get_file_location(INPUT_IO_FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+    append_file_dependency(YOSYS_IO_DEPS ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+  endif()
+
+  if(NOT ${ADD_FPGA_TARGET_NO_SYNTHESIS})
+    set(COMPLETE_YOSYS_SYNTH_SCRIPT "tcl ${YOSYS_SYNTH_SCRIPT}")
+
+    set(OUT_JSON_SYNTH ${OUT_LOCAL}/${TOP}_synth.json)
+    set(OUT_JSON_SYNTH_REL ${OUT_LOCAL_REL}/${TOP}_synth.json)
+    set(OUT_JSON ${OUT_LOCAL}/${TOP}.json)
+    set(OUT_JSON_REL ${OUT_LOCAL_REL}/${TOP}.json)
+
+    get_target_property(USE_ROI ${DEVICE_TYPE} USE_ROI)
+    if("${USE_ROI}" STREQUAL "NOTFOUND")
+        set(USE_ROI FALSE)
+    endif()
+    # TECHMAP is optional for ARCH. We don't care if this is NOTFOUND
+    # as targets not defining it should not use TECHMAP_PATH ENV variable
+    get_target_property(YOSYS_TECHMAP ${ARCH} YOSYS_TECHMAP)
+
+    add_custom_command(
+      OUTPUT ${OUT_JSON_SYNTH} ${OUT_SYNTH_V} ${OUT_FASM_EXTRA}
+      DEPENDS ${SOURCE_FILES} ${SOURCE_FILES_DEPS} ${INPUT_XDC_FILE} ${CELLS_SIM_DEPS}
+              ${YOSYS} ${QUIET_CMD} ${YOSYS_IO_DEPS}
+              ${YOSYS_SYNTH_SCRIPT}
+      COMMAND
+        ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}
+      COMMAND
+        ${CMAKE_COMMAND} -E env
+          TECHMAP_PATH=${YOSYS_TECHMAP}
+          symbiflow-arch-defs_SOURCE_DIR=${symbiflow-arch-defs_SOURCE_DIR}
+          symbiflow-arch-defs_BINARY_DIR=${symbiflow-arch-defs_BINARY_DIR}
+          OUT_JSON=${OUT_JSON_SYNTH}
+          OUT_SYNTH_V=${OUT_SYNTH_V}
+          OUT_FASM_EXTRA=${OUT_FASM_EXTRA}
+          PART_JSON=${PART_JSON}
+          INPUT_XDC_FILE=${INPUT_XDC_FILE}
+          USE_ROI=${USE_ROI}
+          PCF_FILE=${INPUT_IO_FILE}
+          PINMAP_FILE=${PINMAP}
+          ${ADD_FPGA_TARGET_DEFINES}
+          ${QUIET_CMD} ${YOSYS} -p "${COMPLETE_YOSYS_SYNTH_SCRIPT}" -l ${OUT_JSON_SYNTH}.log ${SOURCE_FILES}
+      COMMAND
+        ${CMAKE_COMMAND} -E touch ${OUT_FASM_EXTRA}
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+      VERBATIM
+    )
+
+    set(SPLIT_INOUTS ${symbiflow-arch-defs_SOURCE_DIR}/utils/split_inouts.py)
+
+    add_custom_command(
+      OUTPUT ${OUT_JSON}
+      DEPENDS ${OUT_JSON_SYNTH} ${QUIET_CMD} ${SPLIT_INOUTS} ${PYTHON3}
+      COMMAND
+        ${PYTHON3} ${SPLIT_INOUTS} -i ${OUT_JSON_SYNTH} -o ${OUT_JSON}
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+      VERBATIM
+    )
+
+    add_custom_command(
+      OUTPUT ${OUT_EBLIF}
+      DEPENDS ${OUT_JSON}
+              ${YOSYS} ${QUIET_CMD}
+              ${YOSYS_CONV_SCRIPT}
+      COMMAND
+        ${CMAKE_COMMAND} -E env
+          symbiflow-arch-defs_SOURCE_DIR=${symbiflow-arch-defs_SOURCE_DIR}
+          OUT_EBLIF=${OUT_EBLIF}
+          ${ADD_FPGA_TARGET_DEFINES}
+          ${QUIET_CMD} ${YOSYS} -p "read_json ${OUT_JSON}; tcl ${YOSYS_CONV_SCRIPT}" -l ${OUT_EBLIF}.log
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+      VERBATIM
+    )
+
+    add_output_to_fpga_target(${NAME} EBLIF ${OUT_EBLIF_REL})
+    add_output_to_fpga_target(${NAME} SYNTH_V ${OUT_SYNTH_V_REL})
+    add_output_to_fpga_target(${NAME} JSON_SYNTH ${OUT_JSON_SYNTH_REL})
+    add_output_to_fpga_target(${NAME} JSON ${OUT_JSON_REL})
+
+  else()
+    add_custom_command(
+      OUTPUT ${OUT_EBLIF}
+      DEPENDS ${SOURCE_FILES_DEPS}
+      COMMAND
+        ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}
+      COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_FILES} ${OUT_EBLIF}
+      )
+    add_output_to_fpga_target(${NAME} EBLIF ${OUT_EBLIF_REL})
+  endif()
+
+  add_custom_target(${NAME}_eblif DEPENDS ${OUT_EBLIF})
+
+  # Generate routing and generate HLC.
+  set(OUT_ROUTE ${OUT_LOCAL}/${TOP}.route)
+
+  set(VPR_DEPS "")
+  append_file_dependency(VPR_DEPS ${OUT_EBLIF_REL})
+  list(APPEND VPR_DEPS ${DEFINE_DEVICE_DEVICE_TYPE})
+
+  get_file_location(OUT_RRXML_VIRT_LOCATION ${OUT_RRXML_VIRT})
+  get_file_location(OUT_RRXML_REAL_LOCATION ${OUT_RRXML_REAL})
+  get_file_location(OUT_RRBIN_REAL_LOCATION ${OUT_RRBIN_REAL})
+  get_file_location(DEVICE_MERGED_FILE_LOCATION ${DEVICE_MERGED_FILE})
+
+  foreach(SRC ${DEVICE_MERGED_FILE} ${OUT_RRBIN_REAL})
+    append_file_dependency(VPR_DEPS ${SRC})
+  endforeach()
+
+  get_target_property_required(VPR env VPR)
+
+  get_target_property_required(ROUTE_CHAN_WIDTH ${ARCH} ROUTE_CHAN_WIDTH)
+
+  get_target_property(VPR_ARCH_ARGS ${ARCH} VPR_ARCH_ARGS)
+  if("${VPR_ARCH_ARGS}" STREQUAL "VPR_ARCH_ARGS-NOTFOUND")
+    set(VPR_ARCH_ARGS "")
+  endif()
+
+  separate_arguments(
+    VPR_BASE_ARGS_LIST UNIX_COMMAND "${VPR_BASE_ARGS}"
+    )
+  list(APPEND VPR_BASE_ARGS_LIST --route_chan_width ${ROUTE_CHAN_WIDTH})
+  separate_arguments(
+    VPR_EXTRA_ARGS_LIST UNIX_COMMAND "${VPR_EXTRA_ARGS}"
+    )
+
+  # Setting noisy warnings log file if needed.
+  set(OUT_NOISY_WARNINGS ${OUT_LOCAL}/noisy_warnings.log)
+  string(CONFIGURE ${VPR_ARCH_ARGS} VPR_ARCH_ARGS_EXPANDED)
+  separate_arguments(
+    VPR_ARCH_ARGS_LIST UNIX_COMMAND "${VPR_ARCH_ARGS_EXPANDED}"
+    )
+
+  if(NOT "${ADD_FPGA_TARGET_SDC_FILE}" STREQUAL "")
+    append_file_dependency(VPR_DEPS ${ADD_FPGA_TARGET_SDC_FILE})
+    get_file_location(SDC_LOCATION ${ADD_FPGA_TARGET_SDC_FILE})
+    set(SDC_ARG --sdc_file ${SDC_LOCATION})
+  else()
+    set(SDC_ARG "")
+  endif()
+
+  set(
+    VPR_CMD
+    ${QUIET_CMD} ${VPR}
+    ${DEVICE_MERGED_FILE_LOCATION}
+    ${OUT_EBLIF}
+    --device ${DEVICE_FULL}
+    --read_rr_graph ${OUT_RRBIN_REAL_LOCATION}
+    ${VPR_BASE_ARGS_LIST}
+    ${VPR_ARCH_ARGS_LIST}
+    ${VPR_EXTRA_ARGS_LIST}
+    ${SDC_ARG}
+  )
+
+  get_target_property_required(
+    USE_LOOKAHEAD_CACHE ${DEVICE} ${PACKAGE}_HAS_LOOKAHEAD_CACHE
+  )
+  if(${USE_LOOKAHEAD_CACHE})
+    # If lookahead is cached, use the cache instead of recomputing lookaheads.
+    get_target_property_required(
+      LOOKAHEAD_FILE ${DEVICE} ${PACKAGE}_LOOKAHEAD_FILE
+      )
+    append_file_dependency(VPR_DEPS ${LOOKAHEAD_FILE})
+    get_file_location(LOOKAHEAD_LOCATION ${LOOKAHEAD_FILE})
+    list(APPEND VPR_CMD --read_router_lookahead ${LOOKAHEAD_LOCATION})
+  endif()
+
+  get_target_property_required(
+    USE_PLACE_DELAY_CACHE ${DEVICE} ${PACKAGE}_HAS_PLACE_DELAY_CACHE
+  )
+  if(${USE_PLACE_DELAY_CACHE})
+    get_target_property_required(
+      PLACE_DELAY_FILE ${DEVICE} ${PACKAGE}_PLACE_DELAY_FILE
+      )
+    append_file_dependency(VPR_DEPS ${PLACE_DELAY_FILE})
+    get_file_location(PLACE_DELAY_LOCATION ${PLACE_DELAY_FILE})
+    list(APPEND VPR_CMD --read_placement_delay_lookup ${PLACE_DELAY_LOCATION})
+  endif()
+
+  list(APPEND VPR_DEPS ${VPR} ${QUIET_CMD})
+  append_file_dependency(VPR_DEPS ${OUT_EBLIF_REL})
+
+  # Generate packing.
+  # -------------------------------------------------------------------------
+  set(OUT_NET ${OUT_LOCAL}/${TOP}.net)
+  set(OUT_NET_REL ${OUT_LOCAL_REL}/${TOP}.net)
+
+  add_custom_command(
+    OUTPUT ${OUT_NET} ${OUT_LOCAL}/pack.log
+    DEPENDS ${VPR_DEPS}
+    COMMAND ${VPR_CMD} --pack
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log ${OUT_LOCAL}/pack.log
+    WORKING_DIRECTORY ${OUT_LOCAL}
+  )
+
+  add_output_to_fpga_target(${NAME} NET ${OUT_NET_REL})
+
+  if(NOT "${ADD_FPGA_TARGET_ASSERT_USAGE}" STREQUAL "")
+      set(USAGE_UTIL ${symbiflow-arch-defs_SOURCE_DIR}/utils/report_block_usage.py)
+      add_custom_target(
+          ${NAME}_assert_usage
+          COMMAND ${PYTHON3} ${USAGE_UTIL}
+            --assert_usage ${ADD_FPGA_TARGET_ASSERT_USAGE}
+            ${OUT_LOCAL}/pack.log
+          DEPENDS ${PYTHON3} ${USAGE_UTIL} ${OUT_LOCAL}/pack.log
+          )
+  endif()
+
+  set(ECHO_OUT_NET ${OUT_LOCAL}/echo/${TOP}.net)
+  add_custom_command(
+    OUTPUT ${ECHO_OUT_NET}
+    DEPENDS ${VPR_DEPS}
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}/echo
+    COMMAND cd ${OUT_LOCAL}/echo && ${VPR_CMD} --pack_verbosity 3 --echo_file on --pack
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log ${OUT_LOCAL}/echo/pack.log
+    )
+
+  # Generate placement constraints.
+  # -------------------------------------------------------------------------
+  set(FIX_PINS_ARG "")
+
+  if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
+    get_target_property_required(NO_PINS ${ARCH} NO_PINS)
+    if(${NO_PINS})
+      message(FATAL_ERROR "Arch ${ARCH} does not currently support pin constraints.")
+    endif()
+    get_target_property_required(PLACE_TOOL ${ARCH} PLACE_TOOL)
+    get_target_property_required(PLACE_TOOL_CMD ${ARCH} PLACE_TOOL_CMD)
+
+    get_target_property_required(NO_PLACE_CONSTR ${ARCH} NO_PLACE_CONSTR)
+    if(NOT ${NO_PLACE_CONSTR})
+      get_target_property_required(PLACE_CONSTR_TOOL ${ARCH} PLACE_CONSTR_TOOL)
+      get_target_property_required(PLACE_CONSTR_TOOL_CMD ${ARCH} PLACE_CONSTR_TOOL_CMD)
+    endif()
+
+    get_target_property_required(PYTHON3 env PYTHON3)
+
+
+    # Add complete dependency chain
+    set(IO_DEPS ${VPR_DEPS})
+    if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
+      append_file_dependency(IO_DEPS ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+    endif()
+    append_file_dependency(IO_DEPS ${PINMAP_FILE})
+    append_file_dependency(IO_DEPS ${OUT_NET_REL})
+
+    if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
+      set_target_properties(${NAME} PROPERTIES
+          INPUT_IO_FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
+      set(PCF_INPUT_IO_FILE "--pcf ${INPUT_IO_FILE}")
+    endif()
+
+    # Set variables for the string(CONFIGURE) below.
+    set(OUT_IO ${OUT_LOCAL}/${TOP}_io.place)
+    set(OUT_IO_REL ${OUT_LOCAL_REL}/${TOP}_io.place)
+    set(OUT_CONSTR ${OUT_LOCAL}/${TOP}_constraints.place)
+    set(OUT_CONSTR_REL ${OUT_LOCAL_REL}/${TOP}_constraints.place)
+    set(OUT_NET ${OUT_LOCAL}/${TOP}.net)
+
+    # Generate IO constraints
+    string(CONFIGURE ${PLACE_TOOL_CMD} PLACE_TOOL_CMD_FOR_TARGET)
+    separate_arguments(
+      PLACE_TOOL_CMD_FOR_TARGET_LIST UNIX_COMMAND ${PLACE_TOOL_CMD_FOR_TARGET}
+    )
+
+    add_custom_command(
+      OUTPUT ${OUT_IO}
+      DEPENDS ${IO_DEPS}
+      COMMAND ${PLACE_TOOL_CMD_FOR_TARGET_LIST} --out ${OUT_IO}
+      WORKING_DIRECTORY ${OUT_LOCAL}
+    )
+
+    add_output_to_fpga_target(${NAME} IO_PLACE ${OUT_IO_REL})
+    append_file_dependency(VPR_DEPS ${OUT_IO_REL})
+
+    set(CONSTR_DEPS "")
+    if(NOT ${NO_PLACE_CONSTR})
+      append_file_dependency(CONSTR_DEPS ${OUT_IO_REL})
+
+      get_target_property(PLACE_CONSTR_TOOL_EXTRA_ARGS ${BOARD} PLACE_CONSTR_TOOL_EXTRA_ARGS)
+      if ("${PLACE_CONSTR_TOOL_EXTRA_ARGS}" STREQUAL "PLACE_CONSTR_TOOL_EXTRA_ARGS-NOTFOUND")
+        set(PLACE_CONSTR_TOOL_EXTRA_ARGS "")
       endif()
-      if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
-        add_file_target(FILE ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
-      endif()
-    endif()
-
-    if(NOT "${ADD_FPGA_TARGET_INPUT_XDC_FILE}" STREQUAL "")
-      get_file_location(INPUT_XDC_FILE ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
-      append_file_dependency(YOSYS_IO_DEPS ${ADD_FPGA_TARGET_INPUT_XDC_FILE})
-    endif()
-
-    #
-    # Generate BLIF as start of vpr input.
-    #
-    set(OUT_EBLIF ${OUT_LOCAL}/${TOP}.eblif)
-    set(OUT_EBLIF_REL ${OUT_LOCAL_REL}/${TOP}.eblif)
-    set(OUT_SYNTH_V ${OUT_LOCAL}/${TOP}_synth.v)
-    set(OUT_SYNTH_V_REL ${OUT_LOCAL_REL}/${TOP}_synth.v)
-    set(OUT_FASM_EXTRA ${OUT_LOCAL}/${TOP}_fasm_extra.fasm)
-
-    set(SOURCE_FILES_DEPS "")
-    set(SOURCE_FILES "")
-    foreach(SRC ${ADD_FPGA_TARGET_SOURCES})
-      append_file_location(SOURCE_FILES ${SRC})
-      append_file_dependency(SOURCE_FILES_DEPS ${SRC})
-    endforeach()
-
-    set(CELLS_SIM_DEPS "")
-    get_cells_sim_path(PATH_TO_CELLS_SIM ${ARCH})
-    foreach(CELL ${PATH_TO_CELLS_SIM})
-      get_file_target(CELL_TARGET ${CELL})
-      list(APPEND CELLS_SIM_DEPS ${CELL_TARGET})
-    endforeach()
-
-    set(YOSYS_IO_DEPS "")
-
-    if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
-      get_target_property_required(PINMAP_FILE ${BOARD} PINMAP)
-      get_file_location(PINMAP ${PINMAP_FILE})
-      append_file_dependency(YOSYS_IO_DEPS ${PINMAP_FILE})
-    endif()
-
-    if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
-      get_file_location(INPUT_IO_FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
-      append_file_dependency(YOSYS_IO_DEPS ${ADD_FPGA_TARGET_INPUT_IO_FILE})
-    endif()
-
-    if(NOT ${ADD_FPGA_TARGET_NO_SYNTHESIS})
-      set(COMPLETE_YOSYS_SYNTH_SCRIPT "tcl ${YOSYS_SYNTH_SCRIPT}")
-
-      set(OUT_JSON_SYNTH ${OUT_LOCAL}/${TOP}_synth.json)
-      set(OUT_JSON_SYNTH_REL ${OUT_LOCAL_REL}/${TOP}_synth.json)
-      set(OUT_JSON ${OUT_LOCAL}/${TOP}.json)
-      set(OUT_JSON_REL ${OUT_LOCAL_REL}/${TOP}.json)
-
-      get_target_property(USE_ROI ${DEVICE_TYPE} USE_ROI)
-      if("${USE_ROI}" STREQUAL "NOTFOUND")
-          set(USE_ROI FALSE)
-      endif()
-      # TECHMAP is optional for ARCH. We don't care if this is NOTFOUND
-      # as targets not defining it should not use TECHMAP_PATH ENV variable
-      get_target_property(YOSYS_TECHMAP ${ARCH} YOSYS_TECHMAP)
+
+      # Generate LOC constrains
+      string(CONFIGURE ${PLACE_CONSTR_TOOL_CMD} PLACE_CONSTR_TOOL_CMD_FOR_TARGET)
+      separate_arguments(
+        PLACE_CONSTR_TOOL_CMD_FOR_TARGET_LIST UNIX_COMMAND ${PLACE_CONSTR_TOOL_CMD_FOR_TARGET}
+      )

       add_custom_command(
-        OUTPUT ${OUT_JSON_SYNTH} ${OUT_SYNTH_V} ${OUT_FASM_EXTRA}
-        DEPENDS ${SOURCE_FILES} ${SOURCE_FILES_DEPS} ${INPUT_XDC_FILE} ${CELLS_SIM_DEPS}
-                ${YOSYS} ${QUIET_CMD} ${YOSYS_IO_DEPS}
-                ${YOSYS_SYNTH_SCRIPT}
+        OUTPUT ${OUT_CONSTR}
+        DEPENDS ${CONSTR_DEPS}
         COMMAND
-          ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}
-        COMMAND
-          ${CMAKE_COMMAND} -E env
-            TECHMAP_PATH=${YOSYS_TECHMAP}
-            symbiflow-arch-defs_SOURCE_DIR=${symbiflow-arch-defs_SOURCE_DIR}
-            symbiflow-arch-defs_BINARY_DIR=${symbiflow-arch-defs_BINARY_DIR}
-            OUT_JSON=${OUT_JSON_SYNTH}
-            OUT_SYNTH_V=${OUT_SYNTH_V}
-            OUT_FASM_EXTRA=${OUT_FASM_EXTRA}
-            PART_JSON=${PART_JSON}
-            INPUT_XDC_FILE=${INPUT_XDC_FILE}
-            USE_ROI=${USE_ROI}
-            PCF_FILE=${INPUT_IO_FILE}
-            PINMAP_FILE=${PINMAP}
-            ${ADD_FPGA_TARGET_DEFINES}
-            ${QUIET_CMD} ${YOSYS} -p "${COMPLETE_YOSYS_SYNTH_SCRIPT}" -l ${OUT_JSON_SYNTH}.log ${SOURCE_FILES}
-        COMMAND
-          ${CMAKE_COMMAND} -E touch ${OUT_FASM_EXTRA}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        VERBATIM
-      )
-
-      set(SPLIT_INOUTS ${symbiflow-arch-defs_SOURCE_DIR}/utils/split_inouts.py)
-
-      add_custom_command(
-        OUTPUT ${OUT_JSON}
-        DEPENDS ${OUT_JSON_SYNTH} ${QUIET_CMD} ${SPLIT_INOUTS} ${PYTHON3}
-        COMMAND
-          ${PYTHON3} ${SPLIT_INOUTS} -i ${OUT_JSON_SYNTH} -o ${OUT_JSON}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        VERBATIM
-      )
-
-      add_custom_command(
-        OUTPUT ${OUT_EBLIF}
-        DEPENDS ${OUT_JSON}
-                ${YOSYS} ${QUIET_CMD}
-                ${YOSYS_CONV_SCRIPT}
-        COMMAND
-          ${CMAKE_COMMAND} -E env
-            symbiflow-arch-defs_SOURCE_DIR=${symbiflow-arch-defs_SOURCE_DIR}
-            OUT_EBLIF=${OUT_EBLIF}
-            ${ADD_FPGA_TARGET_DEFINES}
-            ${QUIET_CMD} ${YOSYS} -p "read_json ${OUT_JSON}; tcl ${YOSYS_CONV_SCRIPT}" -l ${OUT_EBLIF}.log
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        VERBATIM
-      )
-
-      add_output_to_fpga_target(${NAME} EBLIF ${OUT_EBLIF_REL})
-      add_output_to_fpga_target(${NAME} SYNTH_V ${OUT_SYNTH_V_REL})
-      add_output_to_fpga_target(${NAME} JSON_SYNTH ${OUT_JSON_SYNTH_REL})
-      add_output_to_fpga_target(${NAME} JSON ${OUT_JSON_REL})
-
+          ${PLACE_CONSTR_TOOL_CMD_FOR_TARGET_LIST} < ${OUT_IO} > ${OUT_CONSTR}
+        WORKING_DIRECTORY ${OUT_LOCAL}
+      )
+
+      add_output_to_fpga_target(${NAME} IO_PLACE ${OUT_CONSTR_REL})
+      append_file_dependency(VPR_DEPS ${OUT_CONSTR_REL})
+
+      set(FIX_PINS_ARG --fix_pins ${OUT_CONSTR})
     else()
-      add_custom_command(
-        OUTPUT ${OUT_EBLIF}
-        DEPENDS ${SOURCE_FILES_DEPS}
-        COMMAND
-          ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}
-        COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_FILES} ${OUT_EBLIF}
-        )
-      add_output_to_fpga_target(${NAME} EBLIF ${OUT_EBLIF_REL})
-    endif()
-
-    add_custom_target(${NAME}_eblif DEPENDS ${OUT_EBLIF})
-
-    # Generate routing and generate HLC.
-    set(OUT_ROUTE ${OUT_LOCAL}/${TOP}.route)
-
-    set(VPR_DEPS "")
-    append_file_dependency(VPR_DEPS ${OUT_EBLIF_REL})
-    list(APPEND VPR_DEPS ${DEFINE_DEVICE_DEVICE_TYPE})
-
-    get_file_location(OUT_RRXML_VIRT_LOCATION ${OUT_RRXML_VIRT})
-    get_file_location(OUT_RRXML_REAL_LOCATION ${OUT_RRXML_REAL})
-    get_file_location(OUT_RRBIN_REAL_LOCATION ${OUT_RRBIN_REAL})
-    get_file_location(DEVICE_MERGED_FILE_LOCATION ${DEVICE_MERGED_FILE})
-
-    foreach(SRC ${DEVICE_MERGED_FILE} ${OUT_RRBIN_REAL})
-      append_file_dependency(VPR_DEPS ${SRC})
-    endforeach()
-
-    get_target_property_required(VPR env VPR)
-
-    get_target_property_required(ROUTE_CHAN_WIDTH ${ARCH} ROUTE_CHAN_WIDTH)
-
-    get_target_property(VPR_ARCH_ARGS ${ARCH} VPR_ARCH_ARGS)
-    if("${VPR_ARCH_ARGS}" STREQUAL "VPR_ARCH_ARGS-NOTFOUND")
-      set(VPR_ARCH_ARGS "")
-    endif()
-
-    separate_arguments(
-      VPR_BASE_ARGS_LIST UNIX_COMMAND "${VPR_BASE_ARGS}"
-      )
-    list(APPEND VPR_BASE_ARGS_LIST --route_chan_width ${ROUTE_CHAN_WIDTH})
-    separate_arguments(
-      VPR_EXTRA_ARGS_LIST UNIX_COMMAND "${VPR_EXTRA_ARGS}"
-      )
-
-    # Setting noisy warnings log file if needed.
-    set(OUT_NOISY_WARNINGS ${OUT_LOCAL}/noisy_warnings.log)
-    string(CONFIGURE ${VPR_ARCH_ARGS} VPR_ARCH_ARGS_EXPANDED)
-    separate_arguments(
-      VPR_ARCH_ARGS_LIST UNIX_COMMAND "${VPR_ARCH_ARGS_EXPANDED}"
-      )
-
-    if(NOT "${ADD_FPGA_TARGET_SDC_FILE}" STREQUAL "")
-      append_file_dependency(VPR_DEPS ${ADD_FPGA_TARGET_SDC_FILE})
-      get_file_location(SDC_LOCATION ${ADD_FPGA_TARGET_SDC_FILE})
-      set(SDC_ARG --sdc_file ${SDC_LOCATION})
-    else()
-      set(SDC_ARG "")
-    endif()
-
+      set(FIX_PINS_ARG --fix_pins ${OUT_IO})
+    endif()
+
+  endif()
+
+  # Generate placement.
+  # -------------------------------------------------------------------------
+  set(OUT_PLACE ${OUT_LOCAL}/${TOP}.place)
+  add_custom_command(
+    OUTPUT ${OUT_PLACE}
+    DEPENDS ${OUT_NET} ${VPR_DEPS}
+    COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --place
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
+      ${OUT_LOCAL}/place.log
+    WORKING_DIRECTORY ${OUT_LOCAL}
+  )
+
+  set(ECHO_OUT_PLACE ${OUT_LOCAL}/echo/${TOP}.place)
+  add_custom_command(
+    OUTPUT ${ECHO_OUT_PLACE}
+    DEPENDS ${ECHO_OUT_NET} ${VPR_DEPS}
+    COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --echo_file on --place
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log
+        ${OUT_LOCAL}/echo/place.log
+    WORKING_DIRECTORY ${OUT_LOCAL}/echo
+  )
+
+  # Generate routing.
+  # -------------------------------------------------------------------------
+  add_custom_command(
+    OUTPUT ${OUT_ROUTE}
+    DEPENDS ${OUT_PLACE} ${VPR_DEPS}
+    COMMAND ${VPR_CMD} --route
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
+        ${OUT_LOCAL}/route.log
+    WORKING_DIRECTORY ${OUT_LOCAL}
+  )
+  add_custom_target(${NAME}_route DEPENDS ${OUT_ROUTE})
+  add_dependencies(all_${BOARD}_route ${NAME}_route)
+
+  set(ECHO_ATOM_NETLIST_ORIG ${OUT_LOCAL}/echo/atom_netlist.orig.echo.blif)
+  set(ECHO_ATOM_NETLIST_CLEANED ${OUT_LOCAL}/echo/atom_netlist.cleaned.echo.blif)
+  add_custom_command(
+    OUTPUT ${ECHO_ATOM_NETLIST_ORIG} ${ECHO_ATOM_NETLIST_CLEANED}
+    DEPENDS ${ECHO_OUT_PLACE} ${VPR_DEPS} ${ECHO_DIRECTORY_TARGET}
+    COMMAND ${VPR_CMD} --echo_file on --route
+    COMMAND
+      ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log
+        ${OUT_LOCAL}/echo/route.log
+    WORKING_DIRECTORY ${OUT_LOCAL}/echo
+  )
+  add_custom_target(${NAME}_route_echo DEPENDS ${ECHO_ATOM_NETLIST_ORIG})
+
+  if(${ADD_FPGA_TARGET_ROUTE_ONLY})
+    return()
+  endif()
+
+  get_target_property_required(USE_FASM ${ARCH} USE_FASM)
+
+  if(${USE_FASM})
+    get_target_property_required(GENFASM env GENFASM)
     set(
-      VPR_CMD
-      ${QUIET_CMD} ${VPR}
+      GENFASM_CMD
+      ${QUIET_CMD} ${GENFASM}
       ${DEVICE_MERGED_FILE_LOCATION}
       ${OUT_EBLIF}
       --device ${DEVICE_FULL}
@@ -1279,304 +1499,75 @@
       ${VPR_BASE_ARGS_LIST}
       ${VPR_ARCH_ARGS_LIST}
       ${VPR_EXTRA_ARGS_LIST}
-      ${SDC_ARG}
-    )
-
-    get_target_property_required(
-      USE_LOOKAHEAD_CACHE ${DEVICE} ${PACKAGE}_HAS_LOOKAHEAD_CACHE
-    )
-    if(${USE_LOOKAHEAD_CACHE})
-      # If lookahead is cached, use the cache instead of recomputing lookaheads.
-      get_target_property_required(
-        LOOKAHEAD_FILE ${DEVICE} ${PACKAGE}_LOOKAHEAD_FILE
-        )
-      append_file_dependency(VPR_DEPS ${LOOKAHEAD_FILE})
-      get_file_location(LOOKAHEAD_LOCATION ${LOOKAHEAD_FILE})
-      list(APPEND VPR_CMD --read_router_lookahead ${LOOKAHEAD_LOCATION})
-    endif()
-
-    get_target_property_required(
-      USE_PLACE_DELAY_CACHE ${DEVICE} ${PACKAGE}_HAS_PLACE_DELAY_CACHE
-    )
-    if(${USE_PLACE_DELAY_CACHE})
-      get_target_property_required(
-        PLACE_DELAY_FILE ${DEVICE} ${PACKAGE}_PLACE_DELAY_FILE
-        )
-      append_file_dependency(VPR_DEPS ${PLACE_DELAY_FILE})
-      get_file_location(PLACE_DELAY_LOCATION ${PLACE_DELAY_FILE})
-      list(APPEND VPR_CMD --read_placement_delay_lookup ${PLACE_DELAY_LOCATION})
-    endif()
-
-    list(APPEND VPR_DEPS ${VPR} ${QUIET_CMD})
-    append_file_dependency(VPR_DEPS ${OUT_EBLIF_REL})
-
-    # Generate packing.
+    )
+  else()
+    get_target_property_required(GENHLC env GENHLC)
+    set(
+      GENHLC_CMD
+      ${QUIET_CMD} ${GENHLC}
+      ${DEVICE_MERGED_FILE_LOCATION}
+      ${OUT_EBLIF}
+      --device ${DEVICE_FULL}
+      --read_rr_graph ${OUT_RRBIN_REAL_LOCATION}
+      ${VPR_BASE_ARGS_LIST}
+      ${VPR_ARCH_ARGS_LIST}
+      ${VPR_EXTRA_ARGS_LIST}
+    )
+  endif()
+
+  if(${USE_FASM})
+    # Generate FASM
     # -------------------------------------------------------------------------
-    set(OUT_NET ${OUT_LOCAL}/${TOP}.net)
-    set(OUT_NET_REL ${OUT_LOCAL_REL}/${TOP}.net)
-
+    set(OUT_FASM ${OUT_LOCAL}/${TOP}.fasm)
+    set(OUT_FASM_CONCATENATED ${OUT_LOCAL}/${TOP}.concat.fasm)
+    set(OUT_FASM_GENFASM ${OUT_LOCAL}/${TOP}.genfasm.fasm)
     add_custom_command(
-      OUTPUT ${OUT_NET} ${OUT_LOCAL}/pack.log
-      DEPENDS ${VPR_DEPS}
-      COMMAND ${VPR_CMD} --pack
-      COMMAND
-        ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log ${OUT_LOCAL}/pack.log
-      WORKING_DIRECTORY ${OUT_LOCAL}
-    )
-
-    add_output_to_fpga_target(${NAME} NET ${OUT_NET_REL})
-
-    if(NOT "${ADD_FPGA_TARGET_ASSERT_USAGE}" STREQUAL "")
-        set(USAGE_UTIL ${symbiflow-arch-defs_SOURCE_DIR}/utils/report_block_usage.py)
-        add_custom_target(
-            ${NAME}_assert_usage
-            COMMAND ${PYTHON3} ${USAGE_UTIL}
-              --assert_usage ${ADD_FPGA_TARGET_ASSERT_USAGE}
-              ${OUT_LOCAL}/pack.log
-            DEPENDS ${PYTHON3} ${USAGE_UTIL} ${OUT_LOCAL}/pack.log
-            )
-    endif()
-
-    set(ECHO_OUT_NET ${OUT_LOCAL}/echo/${TOP}.net)
-    add_custom_command(
-      OUTPUT ${ECHO_OUT_NET}
-      DEPENDS ${VPR_DEPS}
-      COMMAND ${CMAKE_COMMAND} -E make_directory ${OUT_LOCAL}/echo
-      COMMAND cd ${OUT_LOCAL}/echo && ${VPR_CMD} --pack_verbosity 3 --echo_file on --pack
-      COMMAND
-        ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log ${OUT_LOCAL}/echo/pack.log
-      )
-
-    # Generate placement constraints.
-    # -------------------------------------------------------------------------
-    set(FIX_PINS_ARG "")
-
-    if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
-      get_target_property_required(NO_PINS ${ARCH} NO_PINS)
-      if(${NO_PINS})
-        message(FATAL_ERROR "Arch ${ARCH} does not currently support pin constraints.")
-      endif()
-      get_target_property_required(PLACE_TOOL ${ARCH} PLACE_TOOL)
-      get_target_property_required(PLACE_TOOL_CMD ${ARCH} PLACE_TOOL_CMD)
-
-      get_target_property_required(NO_PLACE_CONSTR ${ARCH} NO_PLACE_CONSTR)
-      if(NOT ${NO_PLACE_CONSTR})
-        get_target_property_required(PLACE_CONSTR_TOOL ${ARCH} PLACE_CONSTR_TOOL)
-        get_target_property_required(PLACE_CONSTR_TOOL_CMD ${ARCH} PLACE_CONSTR_TOOL_CMD)
-      endif()
-
-      get_target_property_required(PYTHON3 env PYTHON3)
-
-
-      # Add complete dependency chain
-      set(IO_DEPS ${VPR_DEPS})
-      if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
-        append_file_dependency(IO_DEPS ${ADD_FPGA_TARGET_INPUT_IO_FILE})
-      endif()
-      append_file_dependency(IO_DEPS ${PINMAP_FILE})
-      append_file_dependency(IO_DEPS ${OUT_NET_REL})
-
-      if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "")
-        set_target_properties(${NAME} PROPERTIES
-            INPUT_IO_FILE ${ADD_FPGA_TARGET_INPUT_IO_FILE})
-        set(PCF_INPUT_IO_FILE "--pcf ${INPUT_IO_FILE}")
-      endif()
-
-      # Set variables for the string(CONFIGURE) below.
-      set(OUT_IO ${OUT_LOCAL}/${TOP}_io.place)
-      set(OUT_IO_REL ${OUT_LOCAL_REL}/${TOP}_io.place)
-      set(OUT_CONSTR ${OUT_LOCAL}/${TOP}_constraints.place)
-      set(OUT_CONSTR_REL ${OUT_LOCAL_REL}/${TOP}_constraints.place)
-      set(OUT_NET ${OUT_LOCAL}/${TOP}.net)
-
-      # Generate IO constraints
-      string(CONFIGURE ${PLACE_TOOL_CMD} PLACE_TOOL_CMD_FOR_TARGET)
-      separate_arguments(
-        PLACE_TOOL_CMD_FOR_TARGET_LIST UNIX_COMMAND ${PLACE_TOOL_CMD_FOR_TARGET}
-      )
-
-      add_custom_command(
-        OUTPUT ${OUT_IO}
-        DEPENDS ${IO_DEPS}
-        COMMAND ${PLACE_TOOL_CMD_FOR_TARGET_LIST} --out ${OUT_IO}
-        WORKING_DIRECTORY ${OUT_LOCAL}
-      )
-
-      add_output_to_fpga_target(${NAME} IO_PLACE ${OUT_IO_REL})
-      append_file_dependency(VPR_DEPS ${OUT_IO_REL})
-
-      set(CONSTR_DEPS "")
-      if(NOT ${NO_PLACE_CONSTR})
-        append_file_dependency(CONSTR_DEPS ${OUT_IO_REL})
-
-        get_target_property(PLACE_CONSTR_TOOL_EXTRA_ARGS ${BOARD} PLACE_CONSTR_TOOL_EXTRA_ARGS)
-        if ("${PLACE_CONSTR_TOOL_EXTRA_ARGS}" STREQUAL "PLACE_CONSTR_TOOL_EXTRA_ARGS-NOTFOUND")
-          set(PLACE_CONSTR_TOOL_EXTRA_ARGS "")
-        endif()
-
-        # Generate LOC constrains
-        string(CONFIGURE ${PLACE_CONSTR_TOOL_CMD} PLACE_CONSTR_TOOL_CMD_FOR_TARGET)
-        separate_arguments(
-          PLACE_CONSTR_TOOL_CMD_FOR_TARGET_LIST UNIX_COMMAND ${PLACE_CONSTR_TOOL_CMD_FOR_TARGET}
-        )
-
-        add_custom_command(
-          OUTPUT ${OUT_CONSTR}
-          DEPENDS ${CONSTR_DEPS}
-          COMMAND
-            ${PLACE_CONSTR_TOOL_CMD_FOR_TARGET_LIST} < ${OUT_IO} > ${OUT_CONSTR}
-          WORKING_DIRECTORY ${OUT_LOCAL}
-        )
-
-        add_output_to_fpga_target(${NAME} IO_PLACE ${OUT_CONSTR_REL})
-        append_file_dependency(VPR_DEPS ${OUT_CONSTR_REL})
-
-        set(FIX_PINS_ARG --fix_pins ${OUT_CONSTR})
-      else()
-        set(FIX_PINS_ARG --fix_pins ${OUT_IO})
-      endif()
-
-    endif()
-
-    # Generate placement.
-    # -------------------------------------------------------------------------
-    set(OUT_PLACE ${OUT_LOCAL}/${TOP}.place)
-    add_custom_command(
-      OUTPUT ${OUT_PLACE}
-      DEPENDS ${OUT_NET} ${VPR_DEPS}
-      COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --place
+      OUTPUT ${OUT_FASM}
+      DEPENDS ${OUT_ROUTE} ${OUT_PLACE} ${VPR_DEPS}
+      COMMAND ${GENFASM_CMD}
       COMMAND
         ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
-        ${OUT_LOCAL}/place.log
+          ${OUT_LOCAL}/genhlc.log
+      COMMAND
+        ${CMAKE_COMMAND} -E copy ${OUT_FASM} ${OUT_FASM_GENFASM}
+      COMMAND cat ${OUT_FASM} ${OUT_FASM_EXTRA} > ${OUT_FASM_CONCATENATED}
+      COMMAND
+        ${CMAKE_COMMAND} -E rename ${OUT_FASM_CONCATENATED} ${OUT_FASM}
       WORKING_DIRECTORY ${OUT_LOCAL}
     )
-
-    set(ECHO_OUT_PLACE ${OUT_LOCAL}/echo/${TOP}.place)
+    add_custom_target(${NAME}_fasm DEPENDS ${OUT_FASM})
+
+    set_target_properties(${NAME} PROPERTIES OUT_FASM ${OUT_FASM})
+  else()
+    # Generate HLC
+    # -------------------------------------------------------------------------
+    set(OUT_HLC ${OUT_LOCAL}/${TOP}.hlc)
     add_custom_command(
-      OUTPUT ${ECHO_OUT_PLACE}
-      DEPENDS ${ECHO_OUT_NET} ${VPR_DEPS}
-      COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --echo_file on --place
-      COMMAND
-        ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log
-          ${OUT_LOCAL}/echo/place.log
-      WORKING_DIRECTORY ${OUT_LOCAL}/echo
-    )
-
-    # Generate routing.
-    # -------------------------------------------------------------------------
-    add_custom_command(
-      OUTPUT ${OUT_ROUTE}
-      DEPENDS ${OUT_PLACE} ${VPR_DEPS}
-      COMMAND ${VPR_CMD} --route
+      OUTPUT ${OUT_HLC}
+      DEPENDS ${OUT_ROUTE} ${OUT_PLACE} ${VPR_DEPS}
+      COMMAND ${GENHLC_CMD}
       COMMAND
         ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
-          ${OUT_LOCAL}/route.log
+          ${OUT_LOCAL}/genhlc.log
       WORKING_DIRECTORY ${OUT_LOCAL}
     )
-    add_custom_target(${NAME}_route DEPENDS ${OUT_ROUTE})
-    add_dependencies(all_${BOARD}_route ${NAME}_route)
-
-    set(ECHO_ATOM_NETLIST_ORIG ${OUT_LOCAL}/echo/atom_netlist.orig.echo.blif)
-    set(ECHO_ATOM_NETLIST_CLEANED ${OUT_LOCAL}/echo/atom_netlist.cleaned.echo.blif)
-    add_custom_command(
-      OUTPUT ${ECHO_ATOM_NETLIST_ORIG} ${ECHO_ATOM_NETLIST_CLEANED}
-      DEPENDS ${ECHO_OUT_PLACE} ${VPR_DEPS} ${ECHO_DIRECTORY_TARGET}
-      COMMAND ${VPR_CMD} --echo_file on --route
-      COMMAND
-        ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log
-          ${OUT_LOCAL}/echo/route.log
-      WORKING_DIRECTORY ${OUT_LOCAL}/echo
-    )
-    add_custom_target(${NAME}_route_echo DEPENDS ${ECHO_ATOM_NETLIST_ORIG})
-
-    if(${ADD_FPGA_TARGET_ROUTE_ONLY})
-      return()
-    endif()
-
-    get_target_property_required(USE_FASM ${ARCH} USE_FASM)
-
-    if(${USE_FASM})
-      get_target_property_required(GENFASM env GENFASM)
-      set(
-        GENFASM_CMD
-        ${QUIET_CMD} ${GENFASM}
-        ${DEVICE_MERGED_FILE_LOCATION}
-        ${OUT_EBLIF}
-        --device ${DEVICE_FULL}
-        --read_rr_graph ${OUT_RRBIN_REAL_LOCATION}
-        ${VPR_BASE_ARGS_LIST}
-        ${VPR_ARCH_ARGS_LIST}
-        ${VPR_EXTRA_ARGS_LIST}
-      )
-    else()
-      get_target_property_required(GENHLC env GENHLC)
-      set(
-        GENHLC_CMD
-        ${QUIET_CMD} ${GENHLC}
-        ${DEVICE_MERGED_FILE_LOCATION}
-        ${OUT_EBLIF}
-        --device ${DEVICE_FULL}
-        --read_rr_graph ${OUT_RRBIN_REAL_LOCATION}
-        ${VPR_BASE_ARGS_LIST}
-        ${VPR_ARCH_ARGS_LIST}
-        ${VPR_EXTRA_ARGS_LIST}
-      )
-    endif()
-
-    if(${USE_FASM})
-      # Generate FASM
-      # -------------------------------------------------------------------------
-      set(OUT_FASM ${OUT_LOCAL}/${TOP}.fasm)
-      set(OUT_FASM_CONCATENATED ${OUT_LOCAL}/${TOP}.concat.fasm)
-      set(OUT_FASM_GENFASM ${OUT_LOCAL}/${TOP}.genfasm.fasm)
-      add_custom_command(
-        OUTPUT ${OUT_FASM}
-        DEPENDS ${OUT_ROUTE} ${OUT_PLACE} ${VPR_DEPS}
-        COMMAND ${GENFASM_CMD}
-        COMMAND
-          ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
-            ${OUT_LOCAL}/genhlc.log
-        COMMAND
-          ${CMAKE_COMMAND} -E copy ${OUT_FASM} ${OUT_FASM_GENFASM}
-        COMMAND cat ${OUT_FASM} ${OUT_FASM_EXTRA} > ${OUT_FASM_CONCATENATED}
-        COMMAND
-          ${CMAKE_COMMAND} -E rename ${OUT_FASM_CONCATENATED} ${OUT_FASM}
-        WORKING_DIRECTORY ${OUT_LOCAL}
-      )
-      add_custom_target(${NAME}_fasm DEPENDS ${OUT_FASM})
-
-      set_target_properties(${NAME} PROPERTIES OUT_FASM ${OUT_FASM})
-    else()
-      # Generate HLC
-      # -------------------------------------------------------------------------
-      set(OUT_HLC ${OUT_LOCAL}/${TOP}.hlc)
-      add_custom_command(
-        OUTPUT ${OUT_HLC}
-        DEPENDS ${OUT_ROUTE} ${OUT_PLACE} ${VPR_DEPS}
-        COMMAND ${GENHLC_CMD}
-        COMMAND
-          ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
-            ${OUT_LOCAL}/genhlc.log
-        WORKING_DIRECTORY ${OUT_LOCAL}
-      )
-      add_custom_target(${NAME}_hlc DEPENDS ${OUT_HLC})
-    endif()
-
-    # Generate analysis.
-    #-------------------------------------------------------------------------
-    set(OUT_ANALYSIS ${OUT_LOCAL}/analysis.log)
-    set(OUT_POST_SYNTHESIS_V ${OUT_LOCAL}/top_post_synthesis.v)
-    set(OUT_POST_SYNTHESIS_BLIF ${OUT_LOCAL}/top_post_synthesis.blif)
-    add_custom_command(
-      OUTPUT ${OUT_ANALYSIS} ${OUT_POST_SYNTHESIS_V} ${OUT_POST_SYNTHESIS_BLIF}
-      DEPENDS ${OUT_ROUTE} ${VPR_DEPS}
-      COMMAND ${VPR_CMD} --analysis --gen_post_synthesis_netlist on
-      COMMAND ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
-          ${OUT_LOCAL}/analysis.log
-      WORKING_DIRECTORY ${OUT_LOCAL}
-      )
-    add_custom_target(${NAME}_analysis DEPENDS ${OUT_ANALYSIS})
-  endforeach()
+    add_custom_target(${NAME}_hlc DEPENDS ${OUT_HLC})
+  endif()
+
+  # Generate analysis.
+  #-------------------------------------------------------------------------
+  set(OUT_ANALYSIS ${OUT_LOCAL}/analysis.log)
+  set(OUT_POST_SYNTHESIS_V ${OUT_LOCAL}/top_post_synthesis.v)
+  set(OUT_POST_SYNTHESIS_BLIF ${OUT_LOCAL}/top_post_synthesis.blif)
+  add_custom_command(
+    OUTPUT ${OUT_ANALYSIS} ${OUT_POST_SYNTHESIS_V} ${OUT_POST_SYNTHESIS_BLIF}
+    DEPENDS ${OUT_ROUTE} ${VPR_DEPS}
+    COMMAND ${VPR_CMD} --analysis --gen_post_synthesis_netlist on
+    COMMAND ${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
+        ${OUT_LOCAL}/analysis.log
+    WORKING_DIRECTORY ${OUT_LOCAL}
+    )
+  add_custom_target(${NAME}_analysis DEPENDS ${OUT_ANALYSIS})

   get_target_property_required(NO_BITSTREAM ${ARCH} NO_BITSTREAM)
   if(NOT ${NO_BITSTREAM})


Fix Grunt style tests

Fix Grunt style tests

--- plugin.cmake
+++ plugin.cmake
@@ -14,11 +14,20 @@
 #  limitations under the License.
 ###############################################################################

-add_python_style_test(python_static_analysis_large_image
-                      "${PROJECT_SOURCE_DIR}/plugins/large_image/server")
+add_python_style_test(
+  python_static_analysis_large_image
+  "${PROJECT_SOURCE_DIR}/plugins/large_image/server"
+)

-add_javascript_style_test(jsstyle_large_image_gruntfile "${PROJECT_SOURCE_DIR}/plugins/large_image/Gruntfile.js")
-add_javascript_style_test(jsstyle_large_image_source "${PROJECT_SOURCE_DIR}/plugins/large_image/web_client")
+add_javascript_style_test(
+  jsstyle_large_image_gruntfile
+  "${PROJECT_SOURCE_DIR}/plugins/large_image/Gruntfile.js"
+  JSHINT_EXTRA_CONFIGS "${PROJECT_SOURCE_DIR}/grunt_tasks/.jshintrc"
+)
+add_javascript_style_test(
+  jsstyle_large_image_source
+  "${PROJECT_SOURCE_DIR}/plugins/large_image/web_client"
+)

 add_python_test(example PLUGIN large_image)
 add_web_client_test(example "${PROJECT_SOURCE_DIR}/plugins/large_image/plugin_tests/exampleSpec.js" PLUGIN large_image)


[CI] fix warning during c++11 config

[CI] fix warning during c++11 config

--- CI/config/with_cxx11.cmake
+++ CI/config/with_cxx11.cmake
@@ -1,3 +1,3 @@
 include(default)
 set_option(CMAKE_CXX_STANDARD 11)
-set_option(SICONOS_USE_BOOST_FOR_CXX OFF)
+set_option(SICONOS_USE_BOOST_FOR_CXX11 OFF)


MSVC: missing url hash for boost_regex library

--- CMake/External_boost.cmake
+++ CMake/External_boost.cmake
@@ -33,11 +33,14 @@
     #TODO: find hash for archives properly
     set(BOOST_HEADERS_URL_HASH 1605dc6085cb2dc778ef5ab6c0e59083)
     set(BOOST_GRAPH_URL_HASH c246516ca84a3c79ae8a0b22fceb0344)
+    set(BOOST_REGEX_URL_HASH a3bfc2dc9a3ebe3c050518ecb29d6f8b)
     set(BOOST_UTF_URL_HASH 75971963a74c76d32e01974a8e48be11)
+

    if(MSVC10)
     set(BOOST_HEADERS_URL_HASH 1605dc6085cb2dc778ef5ab6c0e59083)
     set(BOOST_GRAPH_URL_HASH c246516ca84a3c79ae8a0b22fceb0344)
+    set(BOOST_REGEX_URL_HASH a3bfc2dc9a3ebe3c050518ecb29d6f8b)
     set(BOOST_UTF_URL_HASH 75971963a74c76d32e01974a8e48be11)
    else(MSVC80)


From Wang Rui, "This fixes a small problem in the FindFBX file.  In CMake scripts, VS2010 is not marked as MSVC100 but MSVC10. And CMake defines MSVC_VERSION instead of MSVC_VER to indicate the version number. The modification can find fbx sdk for VS2010 automatically now. "

--- CMakeModules/FindFBX.cmake
+++ CMakeModules/FindFBX.cmake
@@ -16,7 +16,7 @@
     SET(FBX_LIBDIR "vs2005")
 ELSEIF(MSVC90)
     SET(FBX_LIBDIR "vs2008")
-ELSEIF(MSVC100 OR MSVC_VER>1600)
+ELSEIF(MSVC10 OR MSVC_VERSION>1600)
     SET(FBX_LIBDIR "vs2010")
 ENDIF()


sorted eigenvalues and -vectors

sorted eigenvalues and -vectors

--- CMakeModules/FindGSL.cmake
+++ CMakeModules/FindGSL.cmake
@@ -25,22 +25,31 @@
 pkg_check_modules(PC_GSL gsl)
 find_path(GSL_INCLUDE_DIR gsl/gsl_linalg.h HINTS ${PC_GSL_INCLUDE_DIRS})
 find_library(GSL_LIBRARY NAMES gsl HINTS ${PC_GSL_LIBRARY_DIRS} )
-find_library(GSLCBLAS_LIBRARY NAMES gslcblas cblas HINTS ${PC_GSL_LIBRARY_DIRS} )

 include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE
 # if all listed variables are TRUE
-find_package_handle_standard_args(GSL DEFAULT_MSG GSL_LIBRARY GSL_INCLUDE_DIR GSLCBLAS_LIBRARY)
+find_package_handle_standard_args(GSL DEFAULT_MSG GSL_LIBRARY GSL_INCLUDE_DIR)
+
+option(GSL_USES_CBLAS "If GSL needs to be linked against cblas" OFF)
+if (GSL_USES_CBLAS)
+  find_library(GSLCBLAS_LIBRARY NAMES gslcblas cblas HINTS ${PC_GSL_LIBRARY_DIRS} )
+  find_package_handle_standard_args(GSL DEFAULT_MSG GSLCBLAS_LIBRARY)
+  if (GSL_FOUND)
+    include(CheckLibraryExists)
+    check_library_exists("${GSLCBLAS_LIBRARY};${MATH_LIBRARIES}" cblas_dsyrk "" FOUND_DSYRK)
+    if(NOT FOUND_DSYRK)
+      message(FATAL_ERROR "Could not find cblas_dsyrk in ${GSLCBLAS_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you are using a static lib (.a) make sure you have specified all dependencies of libcblas in GSLCBLAS_LIBRARY by hand (i.e. -DGSLCBLAS_LIBRARY='/path/to/libcblas.so;/path/to/libm.so')! If your gsl was build against an different version of cblas, specify it in GSLCBLAS_LIBRARY")
+    endif(NOT FOUND_DSYRK)
+  endif(GSL_FOUND)
+else()
+  set(GSLCBLAS_LIBRARY)
+endif (GSL_USES_CBLAS)

 set(GSL_LIBRARIES "${GSL_LIBRARY};${GSLCBLAS_LIBRARY}")
 set(GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )

 if (GSL_FOUND)
-  include(CheckLibraryExists)
-  check_library_exists("${GSLCBLAS_LIBRARY};${MATH_LIBRARIES}" cblas_dsyrk "" FOUND_DSYRK)
-  if(NOT FOUND_DSYRK)
-    message(FATAL_ERROR "Could not find cblas_dsyrk in ${GSLCBLAS_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you are using a static lib (.a) make sure you have specified all dependencies of libcblas in GSLCBLAS_LIBRARY by hand (i.e. -DGSLCBLAS_LIBRARY='/path/to/libcblas.so;/path/to/libm.so')! If your gsl was build against an different version of cblas, specify it in GSLCBLAS_LIBRARY")
-  endif(NOT FOUND_DSYRK)
   #adding MATH_LIBRARIES here to allow static libs, this does not harm us as we are anyway using it
   check_library_exists("${GSL_LIBRARIES};${MATH_LIBRARIES}" gsl_linalg_QR_decomp "" FOUND_QR_DECOMP)
   if(NOT FOUND_QR_DECOMP)


updated FindMKL

updated FindMKL

--- CMakeModules/FindMKL.cmake
+++ CMakeModules/FindMKL.cmake
@@ -1,345 +1,280 @@
-# CMake script to detect Intel(R) Math Kernel Library (MKL)
-#
-# This will try to find Intel MKL libraries, and include path by automatic
-# search through typical install locations and if failed it will
-# examine MKLROOT environment variable.
-# Note, MKLROOT is not set by IPP installer, it should be set manually.
-#
-# Usage example:
-#   set(MKL_USE_STATIC_LIBS ON)
-#   find_package(MKL)
-#   if (MKL_FOUND)
-#      include_directories(${MKL_INCLUDE_DIRS})
-#      add_executable(foo foo.cc)
-#      target_link_libraries(foo ${MKL_LIBRARIES})
-#   endif()
-#
-# Variables used by this module, they can change the default behaviour and
-# need to be set before calling find_package:
-#
-#   MKL_ADDITIONAL_VERSIONS      A list of version numbers to use for searching
-#                                the MKL include directory.
-#
-#   MKL_USE_STATIC_LIBS          Can be set to ON to force the use of the static
-#                                boost libraries. Defaults to OFF.
-#
-#   MKL_FIND_DEBUG               Set this to TRUE to enable debugging output
-#                                of FindMKL.cmake if you are having problems.
-#
-# On return this will define:
-#   MKL_FOUND                   Indicates whether MKL was found (True/False)
-#   MKL_INCLUDE_DIRS            MKL include folder
-#   MKL_LIBRARY_DIRS            MKL libraries folder
-#   MKL_LIBRARIES               MKL libraries names
-#
-# NOTE: this script has only been tested with Intel(R) Parallel Studio XE 2011
-# and may need changes for compatibility with older versions.
-#
-# Adapted from OpenCV IPP detection script
-#   https://code.ros.org/trac/opencv/browser/trunk/opencv/OpenCVFindIPP.cmake
-# Many portions taken from FindBoost.cmake
-
-# TODO:
-# - caller needs to link with libiomp5md.lib or /Qopenmp...
-# - runtime DLLs:
-#   <Composer XE directory> -> C:\Program Files\Intel\ComposerXE-2011
-#     redist\ia32\mkl
-#     redist\intel64\mkl
-
-set(_MKL_IA32 FALSE)
-set(_MKL_INTEL64 FALSE)
-if (CMAKE_SIZEOF_VOID_P EQUAL 4)
-    set(_MKL_IA32 TRUE)
-elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
-    set(_MKL_INTEL64 TRUE)
+# Copyright (c) 2018, ArrayFire
+# All rights reserved.
+#
+# This file is distributed under 3-clause BSD license. The complete license
+# agreement can be obtained at: http://arrayfire.com/licenses/BSD-3-Clause
+#
+# A FindMKL script based on the recommendations by the Intel's Link Line
+# Advisor. It currently only tested on the 2018 version of MKL on Windows,
+# Linux, and OSX but it should work on older versions.
+#
+# To use this module call the mklvars.(sh,bat) script before you call cmake. This
+# script is located in the bin folder of your mkl installation. This will set the
+# MKLROOT environment variable which will be used to find the libraries on your system.
+#
+# Example:
+# set(MKL_THREAD_LAYER "TBB")
+# find_package(MKL)
+#
+# add_executable(myapp main.cpp)
+# target_link_libraries(myapp PRIVATE MKL::MKL)
+#
+# This module bases its behavior based on the following variables:
+#
+# ``MKL_THREAD_LAYER``
+#   The threading layer that needs to be used by the MKL library. This
+#   Defines which library will be used to parallelize the MKL kernels. Possible
+#   options are TBB(Default), GNU OpenMP, Intel OpenMP, Sequential
+#
+# This module provides the following :prop_tgt:'IMPORTED' targets:
+#
+# ``MKL::MKL``
+#   Target used to define and link all MKL libraries required by Intel's Link
+#   Line Advisor. This usually the only thing you need to link against unless
+#   you want to link against the single dynamic library version of MKL
+#   (libmkl_rt.so)
+#
+#  Optional:
+#
+# ``MKL::ThreadLayer{_STATIC}``
+#   Target used to define the threading layer(TBB, OpenMP, etc.) based on
+#   MKL_THREAD_LAYER variable.
+#
+# ``MKL::ThreadingLibrary``
+#   Target used to define the threading library(libtbb, libomp, etc) that the
+#   application will need to link against.
+#
+# ``MKL::Interface``
+#   Target used to determine which interface library to use(32bit int or 64bit
+#   int).
+#
+# ``MKL::Core``
+#   Target for the dynamic library dispatcher
+#
+# ``MKL::RT``
+#   Target for the single dynamic library
+#
+# ``MKL::{mkl_def;mkl_mc;mkl_mc3;mkl_avx;mkl_avx2;mkl_avx512}{_STATIC}``
+#   Targets for MKL kernel libraries.
+
+include(CheckTypeSize)
+
+check_type_size("int" INT_SIZE
+  BUILTIN_TYPES_ONLY LANGUAGE C)
+
+set(MKL_THREAD_LAYER "TBB" CACHE STRING "The thread layer to choose for MKL")
+set_property(CACHE MKL_THREAD_LAYER PROPERTY STRINGS "TBB" "GNU OpenMP" "Intel OpenMP" "Sequential")
+
+if(NOT MKL_THREAD_LAYER STREQUAL MKL_THREAD_LAYER_LAST)
+  unset(MKL::ThreadLayer CACHE)
+  unset(MKL::ThreadingLibrary CACHE)
+  unset(MKL_ThreadLayer_LINK_LIBRARY CACHE)
+  unset(MKL_ThreadLayer_STATIC_LINK_LIBRARY CACHE)
+  unset(MKL_ThreadLayer_DLL_LIBRARY CACHE)
+  unset(MKL_ThreadingLibrary_LINK_LIBRARY CACHE)
+  unset(MKL_ThreadingLibrary_STATIC_LINK_LIBRARY CACHE)
+  unset(MKL_ThreadingLibrary_DLL_LIBRARY CACHE)
+  set(MKL_THREAD_LAYER_LAST ${MKL_THREAD_LAYER} CACHE INTERNAL "" FORCE)
+endif()
+
+find_path(MKL_INCLUDE_DIR
+  NAMES
+    mkl.h
+    mkl_blas.h
+    mkl_cblas.h
+  PATHS
+    /opt/intel
+    /opt/intel/mkl
+    $ENV{MKLROOT}
+    /opt/intel/compilers_and_libraries/linux/mkl
+  PATH_SUFFIXES
+    include
+    IntelSWTools/compilers_and_libraries/windows/mkl/include
+    )
+mark_as_advanced(MKL_INCLUDE_DIR)
+
+find_path(MKL_FFTW_INCLUDE_DIR
+  NAMES
+    fftw3_mkl.h
+  HINTS
+    ${MKL_INCLUDE_DIR}/fftw)
+mark_as_advanced(MKL_FFTW_INCLUDE_DIR)
+
+
+if(WIN32)
+  if(${MSVC_VERSION} GREATER_EQUAL 1900)
+    set(msvc_dir "vc_mt")
+    set(shared_suffix "_dll")
+    set(md_suffix "md")
+  else()
+    message(WARNING "MKL: MS Version not supported for MKL")
+  endif()
+endif()
+
+# Finds and creates libraries for MKL with the MKL:: prefix
+#
+# Parameters:
+#    NAME:         A variable name describing the library
+#    LIBRARY_NAME: The library that needs to be searched
+#
+# Output Libraries:
+#    MKL::${NAME}
+#    MKL::${NAME}_STATIC
+#
+# Output Variables
+#    MKL_INCLUDE_DIR:                Include directory for MKL
+#    MKL_FFTW_INCLUDE_DIR:           Include directory for the MKL FFTW interface
+#    MKL_${NAME}_LINK_LIBRARY:        on Unix: *.so on Windows *.lib
+#    MKL_${NAME}_STATIC_LINK_LIBRARY: on Unix: *.a  on Windows *.lib
+#    MKL_${NAME}_DLL_LIBRARY:         on Unix: ""   on Windows *.dll
+function(find_mkl_library)
+  set(options "")
+  set(single_args NAME LIBRARY_NAME)
+  set(multi_args "")
+
+  cmake_parse_arguments(mkl_args "${options}" "${single_args}" "${multi_args}" ${ARGN})
+
+  add_library(MKL::${mkl_args_NAME}        SHARED IMPORTED)
+  add_library(MKL::${mkl_args_NAME}_STATIC SHARED IMPORTED)
+  find_library(MKL_${mkl_args_NAME}_LINK_LIBRARY
+    NAMES
+      ${mkl_args_LIBRARY_NAME}${shared_suffix}
+      ${mkl_args_LIBRARY_NAME}${md_suffix}
+      lib${mkl_args_LIBRARY_NAME}${md_suffix}
+      ${mkl_args_LIBRARY_NAME}
+    PATHS
+      /opt/intel/mkl/lib
+      /opt/intel/tbb/lib
+      /opt/intel/lib
+      $ENV{MKLROOT}/lib
+      /opt/intel/compilers_and_libraries/linux/mkl/lib
+    PATH_SUFFIXES
+      IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64
+      IntelSWTools/compilers_and_libraries/windows/compiler/lib/intel64
+      IntelSWTools/compilers_and_libraries/windows/tbb/lib/intel64/${msvc_dir}
+      ""
+      intel64
+      intel64/gcc4.7)
+  mark_as_advanced(MKL_${mkl_args_NAME}_LINK_LIBRARY)
+
+  #message(STATUS "NAME: ${mkl_args_NAME} LIBNAME: ${mkl_args_LIBRARY_NAME} MKL_${mkl_args_NAME}_LINK_LIBRARY  ${MKL_${mkl_args_NAME}_LINK_LIBRARY}")
+
+  # The rt library does not have a static library
+  if(NOT ${mkl_args_NAME} STREQUAL "rt")
+    find_library(MKL_${mkl_args_NAME}_STATIC_LINK_LIBRARY
+      NAMES
+        ${CMAKE_STATIC_LIBRARY_PREFIX}${mkl_args_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
+      PATHS
+        /opt/intel/mkl/lib
+        /opt/intel/tbb/lib
+        /opt/intel/lib
+        $ENV{MKLROOT}/lib
+        /opt/intel/compilers_and_libraries/linux/mkl/lib
+      PATH_SUFFIXES
+        ""
+        intel64
+        intel64/gcc4.7
+        IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64
+        IntelSWTools/compilers_and_libraries/windows/compiler/lib/intel64
+        IntelSWTools/compilers_and_libraries/windows/tbb/lib/intel64/${msvc_dir}
+        )
+      mark_as_advanced(MKL_${mkl_args_NAME}_STATIC_LINK_LIBRARY)
+    endif()
+
+    set_target_properties(MKL::${mkl_args_NAME}
+      PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR}"
+        IMPORTED_LOCATION "${MKL_${mkl_args_NAME}_LINK_LIBRARY}"
+        IMPORTED_NO_SONAME TRUE)
+    if(WIN32)
+      find_file(MKL_${mkl_args_NAME}_DLL_LIBRARY
+        NAMES
+          ${CMAKE_SHARED_LIBRARY_PREFIX}${mkl_args_LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
+          ${CMAKE_SHARED_LIBRARY_PREFIX}${mkl_args_LIBRARY_NAME}${md_suffix}${CMAKE_SHARED_LIBRARY_SUFFIX}
+          lib${mkl_args_LIBRARY_NAME}${md_suffix}${CMAKE_SHARED_LIBRARY_SUFFIX}
+        PATH_SUFFIXES
+          IntelSWTools/compilers_and_libraries/windows/redist/intel64/mkl
+          IntelSWTools/compilers_and_libraries/windows/redist/intel64/compiler
+          IntelSWTools/compilers_and_libraries/windows/redist/intel64/tbb/${msvc_dir}
+        NO_SYSTEM_ENVIRONMENT_PATH)
+
+      set_target_properties(MKL::${mkl_args_NAME}
+        PROPERTIES
+          IMPORTED_LOCATION "${MKL_${mkl_args_NAME}_DLL_LIBRARY}"
+          IMPORTED_IMPLIB "${MKL_${mkl_args_NAME}_LINK_LIBRARY}")
+
+      mark_as_advanced(MKL_${mkl_args_NAME}_DLL_LIBRARY)
+    endif()
+endfunction()
+
+
+find_mkl_library(NAME Core LIBRARY_NAME mkl_core)
+find_mkl_library(NAME RT LIBRARY_NAME mkl_rt)
+
+# MKL can link against Intel OpenMP, GNU OpenMP, TBB, and Sequential
+if(MKL_THREAD_LAYER STREQUAL "Intel OpenMP")
+  find_mkl_library(NAME ThreadLayer LIBRARY_NAME mkl_intel_thread)
+  find_mkl_library(NAME ThreadingLibrary LIBRARY_NAME iomp5)
+elseif(MKL_THREAD_LAYER STREQUAL "GNU OpenMP")
+  find_package(OpenMP REQUIRED)
+  find_mkl_library(NAME ThreadLayer LIBRARY_NAME mkl_gnu_thread)
+  add_library(MKL::ThreadingLibrary SHARED IMPORTED)
+  set_target_properties(MKL::ThreadingLibrary
+    PROPERTIES
+      IMPORTED_LOCATION "${OpenMP_gomp_LIBRARY}"
+      INTERFACE_LINK_LIBRARIES OpenMP::OpenMP_CXX)
+elseif(MKL_THREAD_LAYER STREQUAL "TBB")
+  find_mkl_library(NAME ThreadLayer LIBRARY_NAME mkl_tbb_thread)
+  find_mkl_library(NAME ThreadingLibrary LIBRARY_NAME tbb)
+elseif(MKL_THREAD_LAYER STREQUAL "Sequential")
+  find_mkl_library(NAME ThreadLayer LIBRARY_NAME mkl_sequential)
+endif()
+
+if("${INT_SIZE}" EQUAL 4)
+  find_mkl_library(NAME Interface LIBRARY_NAME mkl_intel_lp64)
 else()
-    message(FATAL_ERROR "Unsupported 'void *' size (${SIZEOF_VOID_P})")
-endif()
-
-# Versions should be listed is decreasing order of preference
-set(_MKL_TEST_VERSIONS ${MKL_ADDITIONAL_VERSIONS}
-    "2011"
-    # alternative form: "2011.xxx.y"
-    # (y is the release-update number and xxx is the package number)
-)
-
-if (MKL_FIND_VERSION AND NOT MKL_FIND_QUIETLY)
-    message(WARNING "Requesting a specific version of Intel(R) MKL is not supported")
-endif()
-
-# Use environment variables from Intel build scripts, if available
-if (NOT MKL_ROOT AND NOT $ENV{MKLROOT} STREQUAL "")
-  set(MKL_ROOT $ENV{MKLROOT})
-endif()
-
-if (MKL_ROOT)
-  file(TO_CMAKE_PATH ${MKL_ROOT} MKL_ROOT)
-endif()
-
-if (NOT INTEL_ROOT AND NOT $ENV{INTELROOT} STREQUAL "")
-  set(INTEL_ROOT $ENV{INTELROOT})
-endif()
-
-if (INTEL_ROOT)
-  file(TO_CMAKE_PATH ${INTEL_ROOT} INTEL_ROOT)
-endif()
-
-if (MKL_FIND_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_MKL_TEST_VERSIONS = ${_MKL_TEST_VERSIONS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "MKL_ADDITIONAL_VERSIONS = ${MKL_ADDITIONAL_VERSIONS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "MKL_USE_STATIC_LIBS = ${MKL_USE_STATIC_LIBS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "MKL_ROOT = ${MKL_ROOT}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "INTEL_ROOT = ${INTEL_ROOT}")
-endif()
-
-# Find MKL include directory
-
-set(_MKL_ROOT_SEARCH_DIRS
-  ${MKL_ROOT}
-)
-
-foreach (_MKL_VER ${_MKL_TEST_VERSIONS})
-    if (WIN32)
-        list(APPEND _MKL_ROOT_SEARCH_DIRS "$ENV{ProgramFiles}/Intel/Composer XE/mkl")
-    else()
-        list(APPEND _MKL_ROOT_SEARCH_DIRS "/opt/intel/composerxe-${_MKL_VER}/mkl")
-    endif()
+  find_mkl_library(NAME Interface LIBRARY_NAME mkl_intel_ilp64)
+endif()
+
+set(MKL_RUNTIME_KERNEL_LIBRARIES "" CACHE FILEPATH "MKL kernel libraries targeting different CPU architectures")
+set(MKL_KernelLibraries "mkl_def;mkl_mc;mkl_mc3;mkl_avx;mkl_avx2;mkl_avx512")
+
+foreach(lib ${MKL_KernelLibraries})
+  find_mkl_library(NAME ${lib} LIBRARY_NAME ${lib})
+  if(MKL_${lib}_LINK_LIBRARY OR MKL_${lib}_DLL_LIBRARY)
+    list(APPEND MKL_RUNTIME_KERNEL_LIBRARIES $<TARGET_FILE:MKL::${lib}>)
+  endif()
 endforeach()
-
-if (MKL_FIND_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_MKL_ROOT_SEARCH_DIRS = ${_MKL_ROOT_SEARCH_DIRS}")
-endif()
-
-find_path(MKL_INCLUDE_DIR
-    NAMES mkl.h
-    PATHS ${_MKL_ROOT_SEARCH_DIRS}
-    PATH_SUFFIXES include
-    DOC "The path to Intel(R) MKL header files"
-)
-
-if (MKL_INCLUDE_DIR)
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "location of mkl.h: ${MKL_INCLUDE_DIR}/mkl.h")
-    endif()
-else()
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "unable to find Intel(R) MKL header files. Please set MKLROOT"
-                       " to the root directory containing MKL.")
-    endif()
-endif()
-
-# Find MKL library directory
-
-set(_INTEL_LIBRARY_DIR_SUFFIXES "lib")
-if (_MKL_IA32)
-    list(APPEND _INTEL_LIBRARY_DIR_SUFFIXES "lib/ia32")
-elseif (_MKL_INTEL64)
-    list(APPEND _INTEL_LIBRARY_DIR_SUFFIXES "lib/intel64")
-else()
-    message(FATAL_ERROR "unreachable")
-endif()
-
-set(_MKL_LIBRARY_SEARCH_DIRS ${_MKL_ROOT_SEARCH_DIRS})
-if (MKL_INCLUDE_DIR)
-    list(APPEND _MKL_LIBRARY_SEARCH_DIRS "${MKL_INCLUDE_DIR}/..")
-endif()
-
-if (MKL_FIND_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_INTEL_LIBRARY_DIR_SUFFIXES = ${_INTEL_LIBRARY_DIR_SUFFIXES}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_MKL_LIBRARY_SEARCH_DIRS = ${_MKL_LIBRARY_SEARCH_DIRS}")
-endif()
-
-set(MKL_LIB_PREFIX "mkl_")
-if (MKL_USE_STATIC_LIBS)
-    if (_MKL_IA32)
-        if (WIN32)
-            set(_MKL_LIBRARIES intel_c)
-        else()
-            set(_MKL_LIBRARIES intel)
-        endif()
-    elseif (_MKL_INTEL64)
-        set(_MKL_LIBRARIES intel_lp64)
-    else()
-        message(FATAL_ERROR "unreachable")
-    endif()
-
-    list(APPEND _MKL_LIBRARIES intel_thread)
-    list(APPEND _MKL_LIBRARIES core)
-else()
-    set(_MKL_LIBRARIES rt)
-endif()
-
-set(_MKL_MISSING_LIBRARIES "")
-set(MKL_LIBRARIES "")
-set(MKL_LIBRARY_DIRS "")
-# Find MKL libraries
-foreach (_MKL_LIB_RAW ${_MKL_LIBRARIES})
-    set(_MKL_LIB ${MKL_LIB_PREFIX}${_MKL_LIB_RAW})
-    string(TOUPPER ${_MKL_LIB} _MKL_LIB_UPPER)
-
-    find_library(${_MKL_LIB_UPPER}_LIBRARY
-        NAMES ${_MKL_LIB}
-        PATHS ${_MKL_LIBRARY_SEARCH_DIRS}
-        PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
-        DOC "The path to Intel(R) MKL ${_MKL_LIB_RAW} library"
-    )
-    mark_as_advanced(${_MKL_LIB_UPPER}_LIBRARY)
-
-    if (NOT ${_MKL_LIB_UPPER}_LIBRARY)
-        list(APPEND _MKL_MISSING_LIBRARIES ${_MKL_LIB})
-    else()
-        list(APPEND MKL_LIBRARIES ${${_MKL_LIB_UPPER}_LIBRARY})
-        if (MKL_FIND_DEBUG)
-            message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                           "Found ${_MKL_LIB}: ${${_MKL_LIB_UPPER}_LIBRARY}")
-        endif()
-
-        get_filename_component(_MKL_LIB_PATH "${${_MKL_LIB_UPPER}_LIBRARY}" PATH)
-        list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
-    endif()
-endforeach()
-
-## Find OpenMP, pthread and math libraries
-
-set(_INTEL_LIBRARY_SEARCH_DIRS
-  ${INTEL_ROOT}
-  ${INTEL_ROOT}/compiler
-)
-
-foreach(_MKL_DIR ${_MKL_ROOT_SEARCH_DIRS})
-    list(APPEND _INTEL_LIBRARY_SEARCH_DIRS "${_MKL_DIR}/..")
-    list(APPEND _INTEL_LIBRARY_SEARCH_DIRS "${_MKL_DIR}/../compiler")
-endforeach()
-
-if (MKL_FIND_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_INTEL_LIBRARY_SEARCH_DIRS = ${_INTEL_LIBRARY_SEARCH_DIRS}")
-endif()
-
-if (NOT WIN32)
-    find_library(PTHREAD_LIBRARY pthread DOC "Path to POSIX threads library")
-endif()
-
-set(_IOMP5_LIB iomp5)
-if (WIN32)
-  if (MKL_USE_STATIC_LIBS)
-      list(APPEND _IOMP5_LIB libiomp5mt.lib)
+mark_as_advanced(MKL_RUNTIME_KERNEL_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MKL
+  REQUIRED_VARS MKL_INCLUDE_DIR MKL_Core_LINK_LIBRARY)
+if(NOT WIN32)
+  find_library(M_LIB m)
+  mark_as_advanced(M_LIB)
+endif()
+if(MKL_FOUND)
+  add_library(MKL::MKL SHARED IMPORTED)
+  if(MKL_THREAD_LAYER STREQUAL "Sequential")
+    set_target_properties(MKL::MKL
+      PROPERTIES
+        IMPORTED_LOCATION "${MKL_Core_LINK_LIBRARY}"
+        INTERFACE_LINK_LIBRARIES "MKL::Interface;MKL::ThreadLayer;${CMAKE_DL_LIBS};${M_LIB}"
+        INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR};${MKL_FFTW_INCLUDE_DIR}"
+        IMPORTED_NO_SONAME TRUE)
   else()
-      list(APPEND _IOMP5_LIB libiomp5md.lib)
-  endif()
-endif()
-
-find_library(IOMP5_LIBRARY
-    NAMES ${_IOMP5_LIB}
-    PATHS ${_INTEL_LIBRARY_SEARCH_DIRS}
-    PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
-    DOC "Path to OpenMP runtime library"
-)
-
-if (NOT IOMP5_LIBRARY)
-    # we could instead fallback to default library (via FindOpenMP.cmake)
-    list(APPEND _MKL_MISSING_LIBRARIES IOMP5)
-else()
-    list(APPEND MKL_LIBRARIES ${IOMP5_LIBRARY})
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "Found IOMP5_LIBRARY: ${IOMP5_LIBRARY}")
-    endif()
-
-    get_filename_component(_MKL_LIB_PATH "${IOMP5_LIBRARY}" PATH)
-    list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
-endif()
-
-# Optimized math library (optional)
-set(_MATH_LIB imf)  # linked by default with Intel compiler
-if (WIN32)
-  if (MKL_USE_STATIC_LIBS)
-    list(APPEND _MATH_LIB libmmds.lib)  # assumes (/MD) otherwise libmmt.lib (for /MT)
-  else()
-      list(APPEND _MATH_LIB libmmd.lib)
-  endif()
-endif()
-
-find_library(MATH_LIBRARY
-    NAMES ${_MATH_LIB}
-    PATHS ${_INTEL_LIBRARY_SEARCH_DIRS}
-    PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
-    DOC "Path to optimized math library"
-)
-
-if (NOT MATH_LIBRARY)
-    # we could instead fallback to default library (via FindOpenMP.cmake)
-    list(APPEND _MKL_MISSING_LIBRARIES MATH)
-else()
-    list(APPEND MKL_LIBRARIES ${MATH_LIBRARY})
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "Found MATH_LIBRARY: ${MATH_LIBRARY}")
-    endif()
-
-    get_filename_component(_MKL_LIB_PATH "${MATH_LIBRARY}" PATH)
-    list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
-endif()
-
-# Check all required libraries are available
-list(REMOVE_DUPLICATES MKL_LIBRARY_DIRS)
-
-set(MKL_INCLUDE_DIRS
-    ${MKL_INCLUDE_DIR}
-)
-
-set(MKL_FOUND TRUE)
-if (NOT MKL_INCLUDE_DIR)
-    set(MKL_FOUND FALSE)
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "MKL not found - MKL_INCLUDE_DIR was empty")
-    endif()
-elseif (_MKL_MISSING_LIBRARIES)
-    set(MKL_FOUND FALSE)
-    if (MKL_FIND_DEBUG)
-        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                       "MKL not found - the following libraries are missing: "
-                       "${_MKL_MISSING_LIBRARIES}")
-    endif()
-endif()
-
-if (MKL_FOUND)
-    if (NOT MKL_FIND_QUIETLY OR MKL_FIND_DEBUG)
-        message(STATUS
-            "Intel(R) MKL was found:\n"
-            "  MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}\n"
-            "  MKL_LIBRARY_DIRS: ${MKL_LIBRARY_DIRS}\n"
-            "  MKL_LIBRARIES: ${MKL_LIBRARIES}"
-        )
-    endif()
-    if(NOT TARGET MKL::MKL)
-        add_library(MKL::MKL UNKNOWN IMPORTED)
-        set_target_properties(MKL::MKL PROPERTIES
-            IMPORTED_LOCATION             "${MKL_LIBRARIES}"
-            INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR}")
-    endif()
-else()
-    if (MKL_FIND_REQUIRED)
-        message(SEND_ERROR "Intel(R) MKL could not be found.")
-    else()
-        message(STATUS "Intel(R) MKL could not be found.")
-    endif()
-endif()
-
-mark_as_advanced(
-    MKL_INCLUDE_DIR
-    MKL_INCLUDE_DIRS
-    MKL_LIBRARY_DIRS
-)
-
+    set_target_properties(MKL::MKL
+      PROPERTIES
+        IMPORTED_LOCATION "${MKL_Core_LINK_LIBRARY}"
+        INTERFACE_LINK_LIBRARIES "MKL::Interface;MKL::ThreadLayer;MKL::ThreadingLibrary;${CMAKE_DL_LIBS};${M_LIB}"
+        INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR};${MKL_FFTW_INCLUDE_DIR}"
+        IMPORTED_NO_SONAME TRUE)
+  endif()
+  if(WIN32)
+    set_target_properties(MKL::MKL
+      PROPERTIES
+        IMPORTED_LOCATION "${MKL_Core_DLL_LIBRARY}"
+        IMPORTED_IMPLIB "${MKL_Core_LINK_LIBRARY}")
+  endif()
+endif()


Updating version number

Updating version number

--- CMakeModules/Version.cmake
+++ CMakeModules/Version.cmake
@@ -3,7 +3,7 @@
 #
 SET(AF_VERSION_MAJOR "3")
 SET(AF_VERSION_MINOR "0")
-SET(AF_VERSION_PATCH "1")
+SET(AF_VERSION_PATCH "2")

 SET(AF_VERSION "${AF_VERSION_MAJOR}.${AF_VERSION_MINOR}.${AF_VERSION_PATCH}")
 EXECUTE_PROCESS(


fbcode_builder: fix install_fb_python_library() to work with old CMake versions

Summary:
Update install_fb_python_library() to work with CMake versions older than 3.7.

Previously the code used a generator expression in the directory argument
supplied to `install(DIRECTORY)`.  Support for generators in this parameter
was only added in CMake 3.5, but it was buggy and did not correctly handle
absolute paths until 3.7.

This updates the code to avoid using a generator expression.  This does
require that the corresponding `add_fb_python_library()` statement appear
before the `install_fb_python_library()` statement, but this seems like a
pretty reasonable restriction.

Reviewed By: chadaustin

Differential Revision: D17103597

fbshipit-source-id: 54d6af93a3f530373cfe3137db99436d8484f308

--- build/fbcode_builder/CMake/FBPythonBinary.cmake
+++ build/fbcode_builder/CMake/FBPythonBinary.cmake
@@ -369,10 +369,9 @@

   # Copy the intermediate install directory generated at build time into
   # the desired install location.
-  set(dest_dir "$<TARGET_PROPERTY:${LIB_NAME}.py_lib_install,INSTALL_DIR>")
-  set(
-    build_install_dir
-    "$<TARGET_PROPERTY:${LIB_NAME}.py_lib_install,BUILD_INSTALL_DIR>"
+  get_target_property(dest_dir "${LIB_NAME}.py_lib_install" "INSTALL_DIR")
+  get_target_property(
+    build_install_dir "${LIB_NAME}.py_lib_install" "BUILD_INSTALL_DIR"
   )
   install(
     DIRECTORY "${build_install_dir}/${LIB_NAME}"


HandleLLVMOptions.cmake: Typo, s/proerty/property/

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -362,7 +362,8 @@

 if(MSVC)
   # Remove flags here, for exceptions and RTTI.
-  # Each target property or source proerty should be responsible to control them.
+  # Each target property or source property should be responsible to control
+  # them.
   # CL.EXE complains to override flags like "/GR /GR-".
   string(REGEX REPLACE "(^| ) */EH[-cs]+ *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
   string(REGEX REPLACE "(^| ) */GR-? *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")


Silencing C4141 warnings that were introduced en masse because __forceinline cannot be combined with inline in MSVC without triggering this diagnostic. This is safe to disable because clang will catch instances of the issue with -Wduplicate-decl-specifier, so we are not losing diagnostic coverage.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -281,6 +281,7 @@

   set(msvc_warning_flags
     # Disabled warnings.
+    -wd4141 # Suppress ''modifier' : used more than once' (because of __forceinline combined with inline)
     -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned'
     -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
     -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data'


Re-enabling some more MSVC warnings; all of these compile cleanly with no further changes required.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -169,19 +169,15 @@
     -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned'
     -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
     -wd4181 # Suppress 'qualifier applied to reference type; ignored'
-    -wd4224 # Suppress 'nonstandard extension used : formal parameter 'identifier' was previously defined as a type'
     -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data'
     -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data'
     -wd4275 # Suppress 'An exported class was derived from a class that was not exported.'
-    -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
     -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized'
     -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized'
     -wd4355 # Suppress ''this' : used in base member initializer list'
     -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated'
     -wd4551 # Suppress 'function call missing argument list'
     -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
-    -wd4715 # Suppress ''function' : not all control paths return a value'
-    -wd4722 # Suppress ''function' : destructor never returns, potential memory leak'
     -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'

     # Promoted warnings.


Suppress two warnings from MSVC 2015 that are triggered under /W4. Since we turn off exceptions in the code base, C4577 is moot. C4091 triggers on system headers and is a benign construct.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -307,6 +307,8 @@
     -wd4611 # Suppress 'interaction between '_setjmp' and C++ object destruction is non-portable'
     -wd4805 # Suppress 'unsafe mix of type <type> and type <type> in operation'
     -wd4204 # Suppress 'nonstandard extension used : non-constant aggregate initializer'
+    -wd4577 # Suppress 'noexcept used with no exception handling mode specified; termination on exception is not guaranteed'
+    -wd4091 # Suppress 'typedef: ignored on left of '' when no variable is declared'

 	# Ideally, we'd like this warning to be enabled, but MSVC 2013 doesn't
 	# support the 'aligned' attribute in the way that clang sources requires (for


Fix for ROOT-8480 - CMake: root-config does not get updated

--- cmake/modules/RootConfiguration.cmake
+++ cmake/modules/RootConfiguration.cmake
@@ -670,7 +670,7 @@

 #---Get the value of CMAKE_CXX_FLAGS provided by the user in the command line
 set(usercflags ${CMAKE_CXX_FLAGS-CACHED})
-
+file(REMOVE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/root-config)
 configure_file(${CMAKE_SOURCE_DIR}/config/root-config.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/root-config @ONLY NEWLINE_STYLE UNIX)
 configure_file(${CMAKE_SOURCE_DIR}/config/memprobe.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/memprobe @ONLY NEWLINE_STYLE UNIX)
 configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.sh @ONLY NEWLINE_STYLE UNIX)


disable -fimplicit-templates on clang #6

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -92,14 +92,15 @@
   )
 ## set_cflags_if_supported_named("-Weffc++" -Weffcpp)

-# must append this because mysql sets -fno-implicit-templates and we need to override it
-check_cxx_compiler_flag(-fimplicit-templates HAVE_CXX_-fimplicit-templates)
-if (HAVE_CXX_-fimplicit-templates)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fimplicit-templates")
-endif ()
-
 ## Clang has stricter POD checks.  So, only enable this warning on our other builds (Linux + GCC)
 if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
+  # must append this because mysql sets -fno-implicit-templates and we need to override it
+  # also clang doesn't support it on osx but also doesn't seem to know that
+  check_cxx_compiler_flag(-fimplicit-templates HAVE_CXX_-fimplicit-templates)
+  if (HAVE_CXX_-fimplicit-templates)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fimplicit-templates")
+  endif ()
+
   set_cflags_if_supported(
     -Wpacked
     )


Remove old release date. This is considered the proper 2.0 release.

--- LibFindMacros.cmake
+++ LibFindMacros.cmake
@@ -1,4 +1,4 @@
-# Version 2.0 (2013-04-12)
+# Version 2.0
 # Public Domain, originally written by Lasse Kärkkäinen <tronic>
 # Maintained at https://github.com/Tronic/cmake-modules
 # Please send your improvements as pull requests on Github.


Use new mechanism to set PYTHONPATH for testing

--- plugin.cmake
+++ plugin.cmake
@@ -1,5 +1,3 @@
-set( ENV{PYTHONPATH} ${CMAKE_CURRENT_LIST_DIR} )
-
 add_standard_plugin_tests(NO_SERVER_TESTS NO_CLIENT_TESTS)
 add_python_test(analysis PLUGIN minerva BIND_SERVER)
 add_python_test(dataset PLUGIN minerva BIND_SERVER)
@@ -23,6 +21,7 @@
     PLUGIN minerva
     ENABLEDPLUGINS "gravatar" "jobs" "database_assetstore" "girder_ktile"
     TEST_MODULE "plugin_tests.web_client_test"
+    TEST_PYTHONPATH "${CMAKE_CURRENT_LIST_DIR}"
 )
 set_property(TEST web_client_minerva.minerva PROPERTY LABELS minerva_client)


[deps] Added argument host_id to MakePackageTarget.cmake

--- deps/deps-lib/MakePackageTarget.cmake
+++ deps/deps-lib/MakePackageTarget.cmake
@@ -11,7 +11,7 @@
 #   called 'xpto-Linux-gcc4.zip' if we are in Linux with gcc 4.x.y
 #

-function(make_package_target name)
+function(make_package_target name, host_id)

     # package target
     set(CPACK_GENERATOR "ZIP")
@@ -28,7 +28,7 @@

     # deploy target
     add_custom_target(deploy
-        COMMAND ${Java_JAVA_EXECUTABLE} -jar ${DEPS_JAR} deploy ${DEPS_ZIP_NAME} ${HOST_SPECS_TOOLS}
+        COMMAND ${Java_JAVA_EXECUTABLE} -jar ${DEPS_JAR} deploy ${DEPS_ZIP_NAME} ${host_id}
         WORKING_DIRECTORY ${DEPS_JAR_DIR}
         COMMENT "Deploying ${DEPS_ZIP_NAME}"
         )
@@ -36,7 +36,7 @@

     # upload target
     add_custom_target(upload
-        COMMAND ${Java_JAVA_EXECUTABLE} -jar ${DEPS_JAR} deploy ${DEPS_ZIP_NAME} ${HOST_SPECS_TOOLS}
+        COMMAND ${Java_JAVA_EXECUTABLE} -jar ${DEPS_JAR} deploy ${DEPS_ZIP_NAME} ${host_id}
         WORKING_DIRECTORY ${DEPS_JAR_DIR}
         COMMENT "Uploading ${DEPS_ZIP_NAME}"
         )


Make sure to find CONAN_BUILD_INFO from scratch every time

Former-commit-id: ef07ffcfcf7f678ebecc71a9372db0ae226e661b

--- cmake-modules/SetupDependenciesConan.cmake
+++ cmake-modules/SetupDependenciesConan.cmake
@@ -58,7 +58,8 @@

-
+    unset(CONAN_BUILD_INFO)
+    unset(CONAN_BUILD_INFO CACHE)
     find_file(CONAN_BUILD_INFO
             conanbuildinfo.cmake
             HINTS ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}


[CMake] plugins handle export.

[CMake] plugins handle export.

--- cmake-modules/hpp-corbaserver-plugin.cmake
+++ cmake-modules/hpp-corbaserver-plugin.cmake
@@ -20,7 +20,8 @@
   SET(multiValueArgs
     SOURCES
     LINK_DEPENDENCIES
-    PKG_CONFIG_DEPENDENCIES)
+    PKG_CONFIG_DEPENDENCIES
+    EXPORT)
   CMAKE_PARSE_ARGUMENTS(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
   IF(PLUGIN_EXCLUDE_FROM_ALL)
     SET(_options ${_options} EXCLUDE_FROM_ALL)
@@ -34,6 +35,8 @@
   ENDFOREACH()

   IF(NOT PLUGIN_EXCLUDE_FROM_ALL)
-    INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION lib/hppPlugins)
+    INSTALL(TARGETS ${PLUGIN_NAME}
+      EXPORT ${PLUGIN_EXPORT}
+      DESTINATION lib/hppPlugins)
   ENDIF()
 ENDMACRO()


range-v3 port: Pass -Wa,-mbig-obj to gcc on Cygwin.

--- cmake/modules/Findtext_view_range_v3.cmake
+++ cmake/modules/Findtext_view_range_v3.cmake
@@ -34,6 +34,10 @@
   set(text_view_range_v3_COMPILE_OPTIONS
       ${text_view_range_v3_COMPILE_OPTIONS} -Wall -Werror -Wpedantic)
 endif()
+if(("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xGNU") AND CYGWIN)
+  set(text_view_range_v3_COMPILE_OPTIONS
+      ${text_view_range_v3_COMPILE_OPTIONS} -Wa,-mbig-obj)
+endif()
 set_property(GLOBAL PROPERTY text_view_range_v3_COMPILE_OPTIONS ${text_view_range_v3_COMPILE_OPTIONS})

 set(text_view_range_v3_DEFINITIONS


Fix HAVE_GMTIME and HAVE_GMTIME_R declarations

Fix for systems, that do not have `gm_time` or `gm_time_r` funtions.

Bug found under MinGW 32-bit for Windows, it doesn't have `gmtime_r` and
compilation breaks with:

```common.c.obj: undefined reference to 'gmtime_r'```

--- src/config.h.cmake
+++ src/config.h.cmake
@@ -67,11 +67,11 @@
 /* Define to 1 if you have the `gettimeofday' function. */
 #cmakedefine01 HAVE_GETTIMEOFDAY

-/* Define to 1 if you have the `gmtime' function. */
-#cmakedefine01 HAVE_GMTIME
-
-/* Define to 1 if you have the `gmtime_r' function. */
-#cmakedefine01 HAVE_GMTIME_R
+/* Define if you have the `gmtime' function. */
+#cmakedefine HAVE_GMTIME
+
+/* Define if you have the `gmtime_r' function. */
+#cmakedefine HAVE_GMTIME_R

 /* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine01 HAVE_INTTYPES_H


download eigen using wget or curl

download eigen using wget or curl

--- modules/LookUpEigen3.cmake
+++ modules/LookUpEigen3.cmake
@@ -7,8 +7,33 @@
     )
 endif()

-if(NOT Eigen3_HG_REPOSITORY)
-    set(Eigen3_HG_REPOSITORY https://bitbucket.org/eigen/eigen/)
+if(NOT Eigen3_HG_REPOSITORY AND NOT Eigen3_URL)
+  # Can't trust cmake to download file. It will fail bizarely if not compiled
+  # with SSL
+  set(file_found FALSE)
+  if(EXISTS "${EXTERNAL_ROOT}/eigen.tgz")
+      file(MD5 "${EXTERNAL_ROOT}/eigen.tgz" file_md5)
+      if(file_md5 EQUAL "4d0d77e06fef87b4fcd2c9b72cc8dc55")
+          set(file_found TRUE)
+      endif()
+  endif()
+  if(NOT file_found)
+      find_package(Wget)
+      if(WGET_FOUND)
+          execute_process(COMMAND ${WGET_EXECUTABLE}
+            http://bitbucket.org/eigen/eigen/get/3.2.4.tar.gz
+            -O ${EXTERNAL_ROOT}/eigen.tgz
+          )
+      else()
+          find_program(CURL_EXECUTABLE curl)
+          execute_process(COMMAND ${CURL_EXECUTABLE}
+            -L http://bitbucket.org/eigen/eigen/get/3.2.4.tar.gz
+            -o ${EXTERNAL_ROOT}/eigen.tgz
+          )
+      endif()
+  endif()
+  set(Eigen3_URL "${EXTERNAL_ROOT}/eigen.tgz")
+  set(Eigen3_MD5 4d0d77e06fef87b4fcd2c9b72cc8dc55)
 endif()
 if(NOT Eigen3_BUILD_TYPE)
     set(Eigen3_BUILD_TYPE Release)