From 3c5106618a61c9f8c53ee7893ec4e45e55eb374b Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 20 Feb 2020 22:04:04 -0100 Subject: [PATCH 1/3] Upadte version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aec3ae06a..7b4af784a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ option(USE_TBB OFF) if( USE_TBB ) if( WIN32 ) include( cmake/TBBGet.cmake ) - tbb_get( TBB_ROOT tbb_root RELEASE_TAG "2019_U2" CONFIG_DIR TBB_DIR ) + tbb_get( TBB_ROOT tbb_root RELEASE_TAG "2020_U1" CONFIG_DIR TBB_DIR ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(SYSTEM_BIT "intel64") From 1e6a64625207ecacfd3b9e9024d2356310ebba53 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 20 Feb 2020 22:36:30 -0100 Subject: [PATCH 2/3] Upadte version 2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b4af784a..d1754e301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ option(USE_TBB OFF) if( USE_TBB ) if( WIN32 ) include( cmake/TBBGet.cmake ) - tbb_get( TBB_ROOT tbb_root RELEASE_TAG "2020_U1" CONFIG_DIR TBB_DIR ) + tbb_get( TBB_ROOT tbb_root RELEASE_TAG "v2020.1" CONFIG_DIR TBB_DIR ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(SYSTEM_BIT "intel64") From daf54597a263fa1cd162d524a6773e46f541d13f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 20 Feb 2020 22:42:38 -0100 Subject: [PATCH 3/3] Update version 3 --- cmake/FindTBB.cmake | 100 ++++++++++++++++++++++++++++++-------------- cmake/TBBGet.cmake | 8 +--- 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake index 9a4d5319f..497048d45 100644 --- a/cmake/FindTBB.cmake +++ b/cmake/FindTBB.cmake @@ -68,46 +68,84 @@ # FindTBB helper functions and macros # +#==================================================== +# 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() + + #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() + + 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}") + + #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() + #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) - # skip if already processed during this run - if (NOT ${PREFIX}_FOUND) - 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 () + 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 () - if (NOT TARGET "TBB::${TARGET_NAME}") - add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + 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 - INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") - if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${${PREFIX}_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${${PREFIX}_LIBRARY_DEBUG}" - IMPORTED_LOCATION_RELEASE "${${PREFIX}_LIBRARY_RELEASE}") - elseif (${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${${PREFIX}_LIBRARY_RELEASE}") - elseif (${PREFIX}_LIBRARY_DEBUG) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${${PREFIX}_LIBRARY_DEBUG}") - endif () + IMPORTED_LOCATION "${real_release}") + elseif (${PREFIX}_LIBRARY_DEBUG) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_debug}") endif () - - #mark the following variables as internal variables - mark_as_advanced(${PREFIX}_INCLUDE_DIR - ${PREFIX}_LIBRARY - ${PREFIX}_LIBRARY_DEBUG - ${PREFIX}_LIBRARY_RELEASE) endif () + + #mark the following variables as internal variables + mark_as_advanced(${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE) endmacro() #=============================================== diff --git a/cmake/TBBGet.cmake b/cmake/TBBGet.cmake index 5cb93af56..230edcab5 100644 --- a/cmake/TBBGet.cmake +++ b/cmake/TBBGet.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Intel Corporation +# Copyright (c) 2017-2020 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,10 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# -# -# include(CMakeParseArguments) @@ -202,7 +198,7 @@ function(_tbb_get_url) return() endif() - string(REGEX REPLACE ".*(https.*oss_${tbb_lib_archive_suffix}).*" "\\1" tbb_bin_url "${tbb_release_info}") + string(REGEX REPLACE ".*(https.*${tbb_lib_archive_suffix}).*" "\\1" tbb_bin_url "${tbb_release_info}") set(${tbb_get_url_URL} ${tbb_bin_url} PARENT_SCOPE) endif()