[arch-commits] Commit in vtr/trunk (PKGBUILD vtr-tbb-2021.patch)

Antonio Rojas arojas at gemini.archlinux.org
Fri Nov 26 17:40:25 UTC 2021


    Date: Friday, November 26, 2021 @ 17:40:25
  Author: arojas
Revision: 1054869

Use upstream tbb cmake module

Modified:
  vtr/trunk/PKGBUILD
  vtr/trunk/vtr-tbb-2021.patch

--------------------+
 PKGBUILD           |    6 
 vtr-tbb-2021.patch |  773 ---------------------------------------------------
 2 files changed, 4 insertions(+), 775 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-11-26 17:28:53 UTC (rev 1054868)
+++ PKGBUILD	2021-11-26 17:40:25 UTC (rev 1054869)
@@ -3,7 +3,7 @@
 pkgname=vtr
 _pkgname=vtr-verilog-to-routing
 pkgver=8.0.0
-pkgrel=3
+pkgrel=4
 pkgdesc='Verilog to Routing -- Open Source CAD Flow for FPGA Research'
 arch=(x86_64)
 url='https://verilogtorouting.org'
@@ -15,7 +15,7 @@
          vtr-gcc11.patch
          https://github.com/verilog-to-routing/vtr-verilog-to-routing/commit/ea49c34f.patch)
 sha512sums=('9fc75f8451185fef65b01d37bafcc8c13e04632cdb66d0d49df7f942b40b8178a1e4610b83b88eb32b48077eeda4bd0061b8bb390e61573a1d85153fdc7ba1de'
-            '34675a9d391d153c149fcbf90b007b9d132a6befb53c18c7275004a68938618f3ee0ebc4da0041ecb21461371fb0806c35ce34601dd5d8c00de14bda521a8736'
+            'f2f063b7bbb2201ca61791c86aa33de9e7d04f474b6344ac28996af61afed432fc957c452998ae8c688177634dd46e15d4e6f261572890975dfcf239f4c8ab25'
             '0fb17c1912533763f5f9338cada6315df7198c5c3992bf966c768e5fa96d74d9e1c3cec4327a636ee11e0eefe328c01f96377efb68b85253b926050511843314'
             '8ea64218b0c85b301bbfde263cdabfefc8f6ba53bc4d63664b31f5fd07c2d158296855731b321e456fa6e2df16c1859ed331c5a7d3ea6fe2e069854535babcdc')
 
@@ -23,6 +23,8 @@
   patch -d $_pkgname-$pkgver -p1 < vtr-tbb-2021.patch # Fix build with TBB 2021 (cmake config taken from prusa-slicer)
   patch -d $_pkgname-$pkgver -p1 < ea49c34f.patch # Fix build with GCC 11
   patch -d $_pkgname-$pkgver -p1 < vtr-gcc11.patch # Fix build with GCC 11
+  rm $_pkgname-$pkgver/cmake/modules/FindTBB.cmake # Use upstream cmake module
+  rm $_pkgname-$pkgver/libs/EXTERNAL/libtatum/cmake/modules/FindTBB.cmake
 }
 
 build() {

Modified: vtr-tbb-2021.patch
===================================================================
--- vtr-tbb-2021.patch	2021-11-26 17:28:53 UTC (rev 1054868)
+++ vtr-tbb-2021.patch	2021-11-26 17:40:25 UTC (rev 1054869)
@@ -1,776 +1,3 @@
-diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake
-index 0a1a5bb77..14667b928 100644
---- a/cmake/modules/FindTBB.cmake
-+++ b/cmake/modules/FindTBB.cmake
-@@ -1,303 +1,495 @@
--# The MIT License (MIT)
-+# - Find ThreadingBuildingBlocks include dirs and libraries
-+# Use this module by invoking find_package with the form:
-+#  find_package(TBB
-+#    [REQUIRED]             # Fail with error if TBB is not found
-+#    )                      #
-+# Once done, this will define
- #
--# Copyright (c) 2015 Justus Calvin
--# 
--# Permission is hereby granted, free of charge, to any person obtaining a copy
--# of this software and associated documentation files (the "Software"), to deal
--# in the Software without restriction, including without limitation the rights
--# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--# copies of the Software, and to permit persons to whom the Software is
--# furnished to do so, subject to the following conditions:
--# 
--# The above copyright notice and this permission notice shall be included in all
--# copies or substantial portions of the Software.
--# 
--# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
--# SOFTWARE.
--
-+#  TBB_FOUND - system has TBB
-+#  TBB_INCLUDE_DIRS - the TBB include directories
-+#  TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
-+#                  malloc proxy
-+#  TBB::tbb - imported target for the TBB library
- #
--# FindTBB
--# -------
-+#  TBB_VERSION_MAJOR - Major Product Version Number
-+#  TBB_VERSION_MINOR - Minor Product Version Number
-+#  TBB_INTERFACE_VERSION - Engineering Focused Version Number
-+#  TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
-+#                                     still supported. This uses the engineering
-+#                                     focused interface version numbers.
- #
--# Find TBB include directories and libraries.
-+#  TBB_MALLOC_FOUND - system has TBB malloc library
-+#  TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
-+#  TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
-+#  TBB::malloc - imported target for the TBB malloc library
- #
--# Usage:
-+#  TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
-+#  TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
-+#  TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
-+#  TBB::malloc_proxy - imported target for the TBB malloc proxy library
- #
--#  find_package(TBB [major[.minor]] [EXACT]
--#               [QUIET] [REQUIRED]
--#               [[COMPONENTS] [components...]]
--#               [OPTIONAL_COMPONENTS components...]) 
- #
--# where the allowed components are tbbmalloc and tbb_preview. Users may modify 
--# the behavior of this module with the following variables:
-+# This module reads hints about search locations from variables:
-+#  ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
-+#  ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
-+#  ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
-+#                         libraries. Should be specified with ENV TBB_ROOT
-+#                         and optionally...
-+#  ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
- #
--# * TBB_ROOT_DIR          - The base directory the of TBB installation.
--# * TBB_INCLUDE_DIR       - The directory that contains the TBB headers files.
--# * TBB_LIBRARY           - The directory that contains the TBB library files.
--# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library. 
--#                           These libraries, if specified, override the 
--#                           corresponding library search results, where <library>
--#                           may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
--#                           tbb_preview, or tbb_preview_debug.
--# * TBB_USE_DEBUG_BUILD   - The debug version of tbb libraries, if present, will
--#                           be used instead of the release version.
- #
--# Users may modify the behavior of this module with the following environment
--# variables:
-+# Modified by Robert Maynard from the original OGRE source
- #
--# * TBB_INSTALL_DIR 
--# * TBBROOT
--# * LIBRARY_PATH
-+#-------------------------------------------------------------------
-+# This file is part of the CMake build system for OGRE
-+#     (Object-oriented Graphics Rendering Engine)
-+# For the latest info, see http://www.ogre3d.org/
- #
--# This module will set the following variables:
-+# The contents of this file are placed in the public domain. Feel
-+# free to make use of it in any way you like.
-+#-------------------------------------------------------------------
- #
--# * TBB_FOUND             - Set to false, or undefined, if we haven’t found, or
--#                           don’t want to use TBB.
--# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
--#                           not available.
--# * TBB_VERSION           - The full version string
--# * TBB_VERSION_MAJOR     - The major version
--# * TBB_VERSION_MINOR     - The minor version
--# * TBB_INTERFACE_VERSION - The interface version number defined in 
--#                           tbb/tbb_stddef.h.
--# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of 
--#                           <library>, where <library> may be tbb, tbb_debug,
--#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
--#                           tbb_preview_debug.
--# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of 
--#                           <library>, where <library> may be tbb, tbb_debug,
--#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
--#                           tbb_preview_debug.
-+# =========================================================================
-+# Taken from Copyright.txt in the root of the VTK source tree as per
-+# instructions to substitute the full license in place of the summary
-+# reference when distributing outside of VTK
-+# =========================================================================
- #
--# The following varibles should be used to build and link with TBB:
-+#  Program:   Visualization Toolkit
-+#  Module:    Copyright.txt
- #
--# * TBB_INCLUDE_DIRS        - The include directory for TBB.
--# * TBB_LIBRARIES           - The libraries to link against to use TBB.
--# * TBB_LIBRARIES_RELEASE   - The release libraries to link against to use TBB.
--# * TBB_LIBRARIES_DEBUG     - The debug libraries to link against to use TBB.
--# * TBB_DEFINITIONS         - Definitions to use when compiling code that uses
--#                             TBB.
--# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
--#                             uses TBB.
--# * TBB_DEFINITIONS_DEBUG   - Definitions to use when compiling debug code that
--#                             uses TBB.
-+# Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
-+# All rights reserved.
- #
--# This module will also create the "tbb" target that may be used when building
--# executables and libraries.
--
--include(FindPackageHandleStandardArgs)
--
--if(NOT TBB_FOUND)
--
--  ##################################
--  # Check the build type
--  ##################################
--  
--  if(NOT DEFINED TBB_USE_DEBUG_BUILD)
--    if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)")
--      set(TBB_BUILD_TYPE DEBUG)
--    else()
--      set(TBB_BUILD_TYPE RELEASE)
--    endif()
--  elseif(TBB_USE_DEBUG_BUILD)
--    set(TBB_BUILD_TYPE DEBUG)
--  else()
--    set(TBB_BUILD_TYPE RELEASE)
--  endif()
--  
--  ##################################
--  # Set the TBB search directories
--  ##################################
--  
--  # Define search paths based on user input and environment variables
--  set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
--  
--  # Define the search directories based on the current platform
--  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
--    set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
--                               "C:/Program Files (x86)/Intel/TBB")
--
--    # Set the target architecture
--    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
--      set(TBB_ARCHITECTURE "intel64")
--    else()
--      set(TBB_ARCHITECTURE "ia32")
--    endif()
--
--    # Set the TBB search library path search suffix based on the version of VC
--    if(WINDOWS_STORE)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
--    elseif(MSVC14)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
--    elseif(MSVC12)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
--    elseif(MSVC11)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
--    elseif(MSVC10)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
--    endif()
--
--    # Add the library path search suffix for the VC independent version of TBB
--    list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
--
--  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
--    # OS X
--    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
--    
--    # TODO: Check to see which C++ library is being used by the compiler.
--    if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
--      # The default C++ library on OS X 10.9 and later is libc++
--      set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
--    else()
--      set(TBB_LIB_PATH_SUFFIX "lib")
--    endif()
--  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
--    # Linux
--    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
--    
--    # TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
--    #       <arch>/gcc4.1. For now, assume that the compiler is more recent than
--    #       gcc 4.4.x or later.
--    if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
--      set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
--    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
--      set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
--    endif()
-+# Redistribution and use in source and binary forms, with or without
-+# modification, are permitted provided that the following conditions are met:
-+#
-+# * Redistributions of source code must retain the above copyright notice,
-+#   this list of conditions and the following disclaimer.
-+#
-+# * Redistributions in binary form must reproduce the above copyright notice,
-+#   this list of conditions and the following disclaimer in the documentation
-+#   and/or other materials provided with the distribution.
-+#
-+# * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
-+#   of any contributors may be used to endorse or promote products derived
-+#   from this software without specific prior written permission.
-+#
-+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
-+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+#
-+# =========================================================================*/
-+
-+#=============================================================================
-+#  FindTBB helper functions and macros
-+#
-+
-+# Use TBBConfig.cmake if possible.
-+
-+set(_tbb_find_quiet)
-+if (TBB_FIND_QUIETLY)
-+  set(_tbb_find_quiet QUIET)
-+endif ()
-+set(_tbb_find_components)
-+set(_tbb_find_optional_components)
-+foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS)
-+  if (TBB_FIND_REQUIRED_${_tbb_find_component})
-+    list(APPEND _tbb_find_components "${_tbb_find_component}")
-+  else ()
-+    list(APPEND _tbb_find_optional_components "${_tbb_find_component}")
-+  endif ()
-+endforeach ()
-+unset(_tbb_find_component)
-+find_package(TBB CONFIG ${_tbb_find_quiet}
-+  COMPONENTS ${_tbb_find_components}
-+  OPTIONAL_COMPONENTS ${_tbb_find_optional_components})
-+unset(_tbb_find_quiet)
-+unset(_tbb_find_components)
-+unset(_tbb_find_optional_components)
-+if (TBB_FOUND)
-+  return ()
-+endif ()
-+
-+#====================================================
-+# Fix the library path in case it is a linker script
-+#====================================================
-+function(tbb_extract_real_library library real_library)
-+  if(NOT UNIX OR NOT EXISTS ${library})
-+    set(${real_library} "${library}" PARENT_SCOPE)
-+    return()
-   endif()
--  
--  ##################################
--  # Find the TBB include dir
--  ##################################
--  
--  find_path(TBB_INCLUDE_DIRS tbb/tbb.h
--      HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
--      PATHS ${TBB_DEFAULT_SEARCH_DIR}
--      PATH_SUFFIXES include)
--
--  ##################################
--  # Set version strings
--  ##################################
--
--  if(TBB_INCLUDE_DIRS)
--    file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
--    string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
--        TBB_VERSION_MAJOR "${_tbb_version_file}")
--    string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
--        TBB_VERSION_MINOR "${_tbb_version_file}")
--    string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
--        TBB_INTERFACE_VERSION "${_tbb_version_file}")
--    set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
-+
-+  #Read in the first 4 bytes and see if they are the ELF magic number
-+  set(_elf_magic "7f454c46")
-+  file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
-+  if(_hex_data STREQUAL _elf_magic)
-+    #we have opened a elf binary so this is what
-+    #we should link to
-+    set(${real_library} "${library}" PARENT_SCOPE)
-+    return()
-   endif()
- 
--  ##################################
--  # Find TBB components
--  ##################################
-+  file(READ ${library} _data OFFSET 0 LIMIT 1024)
-+  if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
-+    #extract out the .so name from REGEX MATCH command
-+    set(_proper_so_name "${CMAKE_MATCH_1}")
- 
--  if(TBB_VERSION VERSION_LESS 4.3)
--    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
-+    #construct path to the real .so which is presumed to be in the same directory
-+    #as the input file
-+    get_filename_component(_so_dir "${library}" DIRECTORY)
-+    set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
-   else()
--    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
-+    #unable to determine what this library is so just hope everything works
-+    #and pass it unmodified.
-+    set(${real_library} "${library}" PARENT_SCOPE)
-   endif()
-+endfunction()
-+
-+#===============================================
-+# Do the final processing for the package find.
-+#===============================================
-+macro(findpkg_finish PREFIX TARGET_NAME)
-+  if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
-+    set(${PREFIX}_FOUND TRUE)
-+    set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
-+    set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
-+  else ()
-+    if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
-+      message(FATAL_ERROR "Required library ${PREFIX} not found.")
-+    endif ()
-+  endif ()
- 
--  # Find each component
--  foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
--    if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
--
--      # Search for the libraries
--      find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
--          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
--          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
--          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
--
--      find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
--          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
--          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
--          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
--
--      if(TBB_${_comp}_LIBRARY_DEBUG)
--        list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
--      endif()
--      if(TBB_${_comp}_LIBRARY_RELEASE)
--        list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
--      endif()
--      if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
--        set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
--      endif()
--
--      if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
--        set(TBB_${_comp}_FOUND TRUE)
--      else()
--        set(TBB_${_comp}_FOUND FALSE)
--      endif()
--
--      # Mark internal variables as advanced
--      mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
--      mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
--      mark_as_advanced(TBB_${_comp}_LIBRARY)
--
--    endif()
-+  if (NOT TARGET "TBB::${TARGET_NAME}")
-+    if (${PREFIX}_LIBRARY_RELEASE)
-+      tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
-+    endif ()
-+    if (${PREFIX}_LIBRARY_DEBUG)
-+      tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
-+    endif ()
-+    add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
-+    set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-+      INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
-+    if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
-+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-+        IMPORTED_LOCATION "${real_release}"
-+        IMPORTED_LOCATION_DEBUG "${real_debug}"
-+        IMPORTED_LOCATION_RELEASE "${real_release}")
-+    elseif (${PREFIX}_LIBRARY_RELEASE)
-+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-+        IMPORTED_LOCATION "${real_release}")
-+    elseif (${PREFIX}_LIBRARY_DEBUG)
-+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-+        IMPORTED_LOCATION "${real_debug}")
-+    endif ()
-+  endif ()
-+
-+  #mark the following variables as internal variables
-+  mark_as_advanced(${PREFIX}_INCLUDE_DIR
-+                   ${PREFIX}_LIBRARY
-+                   ${PREFIX}_LIBRARY_DEBUG
-+                   ${PREFIX}_LIBRARY_RELEASE)
-+endmacro()
-+
-+#===============================================
-+# Generate debug names from given release names
-+#===============================================
-+macro(get_debug_names PREFIX)
-+  foreach(i ${${PREFIX}})
-+    set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
-   endforeach()
-+endmacro()
-+
-+#===============================================
-+# See if we have env vars to help us find tbb
-+#===============================================
-+macro(getenv_path VAR)
-+   set(ENV_${VAR} $ENV{${VAR}})
-+   # replace won't work if var is blank
-+   if (ENV_${VAR})
-+     string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
-+   endif ()
-+endmacro()
-+
-+#===============================================
-+# Couple a set of release AND debug libraries
-+#===============================================
-+macro(make_library_set PREFIX)
-+  if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
-+    set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
-+  elseif (${PREFIX}_RELEASE)
-+    set(${PREFIX} ${${PREFIX}_RELEASE})
-+  elseif (${PREFIX}_DEBUG)
-+    set(${PREFIX} ${${PREFIX}_DEBUG})
-+  endif ()
-+endmacro()
-+
-+#===============================================
-+# Ensure that the release & debug libraries found are from the same installation.
-+#===============================================
-+macro(find_tbb_library_verifying_release_debug_locations PREFIX)
-+  find_library(${PREFIX}_RELEASE
-+    NAMES ${${PREFIX}_NAMES}
-+    HINTS ${TBB_LIB_SEARCH_PATH})
-+  if (${PREFIX}_RELEASE)
-+    # To avoid finding a mismatched set of release & debug libraries from
-+    # different installations if the first found does not have debug libraries
-+    # by forcing the search for debug to only occur within the detected release
-+    # library directory (if found).  Although this would break detection if the
-+    # release & debug libraries were shipped in different directories, this is
-+    # not the case in the official TBB releases for any platform.
-+    get_filename_component(
-+      FOUND_RELEASE_LIB_DIR "${${PREFIX}_RELEASE}" DIRECTORY)
-+    find_library(${PREFIX}_DEBUG
-+      NAMES ${${PREFIX}_NAMES_DEBUG}
-+      HINTS ${FOUND_RELEASE_LIB_DIR}
-+      NO_DEFAULT_PATH)
-+  else()
-+    find_library(${PREFIX}_DEBUG
-+      NAMES ${${PREFIX}_NAMES_DEBUG}
-+      HINTS ${TBB_LIB_SEARCH_PATH})
-+  endif()
-+endmacro()
-+
-+#=============================================================================
-+#  Now to actually find TBB
-+#
-+
-+# Get path, convert backslashes as ${ENV_${var}}
-+getenv_path(TBB_ROOT)
-+
-+# initialize search paths
-+set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
-+set(TBB_INC_SEARCH_PATH "")
-+set(TBB_LIB_SEARCH_PATH "")
-+
-+
-+# If user built from sources
-+set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
-+if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
-+  getenv_path(TBB_BUILD_DIR)
-+  if (NOT ENV_TBB_BUILD_DIR)
-+    set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
-+  endif ()
-+
-+  # include directory under ${ENV_TBB_ROOT}/include
-+  list(APPEND TBB_LIB_SEARCH_PATH
-+    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
-+    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
-+endif ()
-+
- 
--  ##################################
--  # Set compile flags and libraries
--  ##################################
--
--  set(TBB_DEFINITIONS_RELEASE "")
--  set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
--    
--  if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
--    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
--    set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
--  elseif(TBB_LIBRARIES_RELEASE)
--    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
--    set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
--  elseif(TBB_LIBRARIES_DEBUG)
--    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
--    set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
-+# For Windows, let's assume that the user might be using the precompiled
-+# TBB packages from the main website. These use a rather awkward directory
-+# structure (at least for automatically finding the right files) depending
-+# on platform and compiler, but we'll do our best to accommodate it.
-+# Not adding the same effort for the precompiled linux builds, though. Those
-+# have different versions for CC compiler versions and linux kernels which
-+# will never adequately match the user's setup, so there is no feasible way
-+# to detect the "best" version to use. The user will have to manually
-+# select the right files. (Chances are the distributions are shipping their
-+# custom version of tbb, anyway, so the problem is probably nonexistent.)
-+if (WIN32 AND MSVC)
-+  set(COMPILER_PREFIX "vc7.1")
-+  if (MSVC_VERSION EQUAL 1400)
-+    set(COMPILER_PREFIX "vc8")
-+  elseif(MSVC_VERSION EQUAL 1500)
-+    set(COMPILER_PREFIX "vc9")
-+  elseif(MSVC_VERSION EQUAL 1600)
-+    set(COMPILER_PREFIX "vc10")
-+  elseif(MSVC_VERSION EQUAL 1700)
-+    set(COMPILER_PREFIX "vc11")
-+  elseif(MSVC_VERSION EQUAL 1800)
-+    set(COMPILER_PREFIX "vc12")
-+  elseif(MSVC_VERSION GREATER_EQUAL 1900)
-+    set(COMPILER_PREFIX "vc14")
-+  endif ()
-+
-+  # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
-+  foreach (dir IN LISTS TBB_PREFIX_PATH)
-+    if (CMAKE_CL_64)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
-+    else ()
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
-+    endif ()
-+  endforeach ()
-+endif ()
-+
-+# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
-+# and above and AppleClang
-+if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
-+    NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
-+  set (USE_LIBCXX OFF)
-+  cmake_policy(GET CMP0025 POLICY_VAR)
-+
-+  if (POLICY_VAR STREQUAL "NEW")
-+    if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
-+      set (USE_LIBCXX ON)
-+    endif ()
-+  else ()
-+    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-+      set (USE_LIBCXX ON)
-+    endif ()
-+  endif ()
-+
-+  if (USE_LIBCXX)
-+    foreach (dir IN LISTS TBB_PREFIX_PATH)
-+      list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
-+    endforeach ()
-+  endif ()
-+endif ()
-+
-+# check compiler ABI
-+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-+  set(COMPILER_PREFIX)
-+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
-+    list(APPEND COMPILER_PREFIX "gcc4.8")
-+  endif()
-+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
-+    list(APPEND COMPILER_PREFIX "gcc4.7")
-+  endif()
-+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
-+    list(APPEND COMPILER_PREFIX "gcc4.4")
-+  endif()
-+  list(APPEND COMPILER_PREFIX "gcc4.1")
-+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-+  set(COMPILER_PREFIX)
-+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
-+    list(APPEND COMPILER_PREFIX "gcc4.8")
-   endif()
-+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
-+    list(APPEND COMPILER_PREFIX "gcc4.7")
-+  endif()
-+  list(APPEND COMPILER_PREFIX "gcc4.4")
-+else() # Assume compatibility with 4.4 for other compilers
-+  list(APPEND COMPILER_PREFIX "gcc4.4")
-+endif ()
-+
-+# if platform architecture is explicitly specified
-+set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
-+if (TBB_ARCH_PLATFORM)
-+  foreach (dir IN LISTS TBB_PREFIX_PATH)
-+    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
-+    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
-+  endforeach ()
-+endif ()
-+
-+foreach (dir IN LISTS TBB_PREFIX_PATH)
-+  foreach (prefix IN LISTS COMPILER_PREFIX)
-+    if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
-+    else ()
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
-+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
-+    endif ()
-+  endforeach()
-+endforeach ()
-+
-+# add general search paths
-+foreach (dir IN LISTS TBB_PREFIX_PATH)
-+  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
-+    ${dir}/Libs)
-+  list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
-+    ${dir}/include/tbb)
-+endforeach ()
-+
-+set(TBB_LIBRARY_NAMES tbb)
-+get_debug_names(TBB_LIBRARY_NAMES)
-+
-+find_path(TBB_INCLUDE_DIR
-+          NAMES tbb/tbb.h
-+          HINTS ${TBB_INC_SEARCH_PATH})
-+find_tbb_library_verifying_release_debug_locations(TBB_LIBRARY)
-+make_library_set(TBB_LIBRARY)
- 
--  find_package_handle_standard_args(TBB 
--      REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
--      HANDLE_COMPONENTS
--      VERSION_VAR TBB_VERSION)
--
--  ##################################
--  # Create targets
--  ##################################
--
--  if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
--    add_library(tbb SHARED IMPORTED)
--    set_target_properties(tbb PROPERTIES
--          INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
--          IMPORTED_LOCATION              ${TBB_LIBRARIES})
--    if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
--      set_target_properties(tbb PROPERTIES
--          INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
--          IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
--          IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
--          IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
--          IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
--          )
--    elseif(TBB_LIBRARIES_RELEASE)
--      set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
--    else()
--      set_target_properties(tbb PROPERTIES
--          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
--          IMPORTED_LOCATION              ${TBB_LIBRARIES_DEBUG}
--          )
--    endif()
-+findpkg_finish(TBB tbb)
-+
-+#if we haven't found TBB no point on going any further
-+if (NOT TBB_FOUND)
-+  return()
-+endif ()
-+
-+#=============================================================================
-+# Look for TBB's malloc package
-+set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
-+get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
-+
-+find_path(TBB_MALLOC_INCLUDE_DIR
-+          NAMES tbb/tbb.h
-+          HINTS ${TBB_INC_SEARCH_PATH})
-+find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_LIBRARY)
-+make_library_set(TBB_MALLOC_LIBRARY)
-+
-+findpkg_finish(TBB_MALLOC tbbmalloc)
-+
-+#=============================================================================
-+# Look for TBB's malloc proxy package
-+set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
-+get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
-+
-+find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
-+          NAMES tbb/tbbmalloc_proxy.h
-+          HINTS ${TBB_INC_SEARCH_PATH})
-+find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_PROXY_LIBRARY)
-+make_library_set(TBB_MALLOC_PROXY_LIBRARY)
-+
-+findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
-+
-+
-+#=============================================================================
-+#parse all the version numbers from tbb
-+if(NOT TBB_VERSION)
-+  set(TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1
-+    "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
-+  set(TBB_VERSION_FILE_AFTER_TBB_2021_1
-+    "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
-+
-+  if (EXISTS "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
-+    set(TBB_VERSION_FILE "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
-+  elseif (EXISTS "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
-+    set(TBB_VERSION_FILE "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
-+  else()
-+    message(FATAL_ERROR "Found TBB installation: ${TBB_INCLUDE_DIR} "
-+      "missing version header.")
-   endif()
- 
--  mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
-+ #only read the start of the file
-+ file(STRINGS
-+      "${TBB_VERSION_FILE}"
-+      TBB_VERSION_CONTENTS
-+      REGEX "VERSION")
-+
-+  string(REGEX REPLACE
-+    ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
-+    TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
- 
--  unset(TBB_ARCHITECTURE)
--  unset(TBB_BUILD_TYPE)
--  unset(TBB_LIB_PATH_SUFFIX)
--  unset(TBB_DEFAULT_SEARCH_DIR)
-+  string(REGEX REPLACE
-+    ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
-+    TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
-+
-+  string(REGEX REPLACE
-+        ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
-+        TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
-+
-+  string(REGEX REPLACE
-+        ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
-+        TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
- 
- endif()
-+
 diff --git a/vpr/src/base/vpr_api.cpp b/vpr/src/base/vpr_api.cpp
 index d08a57644..a1aad588e 100644
 --- a/vpr/src/base/vpr_api.cpp



More information about the arch-commits mailing list