3rdparty: TBB version 2018u1 => 2019u8

- make it configurable via OPENCV_TBB_RELEASE + OPENCV_TBB_RELEASE_MD5
- remove legacy support
pull/14926/head
Alexander Alekhin 5 years ago committed by Alexander Alekhin
parent bc79f477dd
commit 43e457c883
  1. 40
      3rdparty/tbb/CMakeLists.txt
  2. 41
      3rdparty/tbb/android_additional.h
  3. 11
      3rdparty/tbb/arm_linux_stub.cpp

@ -5,19 +5,14 @@ if (WIN32 AND NOT ARM)
message(FATAL_ERROR "BUILD_TBB option supports Windows on ARM only!\nUse regular official TBB build instead of the BUILD_TBB option!")
endif()
set(tbb_filename "2018_U1.tar.gz")
set(tbb_subdir "tbb-2018_U1")
set(tbb_md5 "b2f2fa09adf44a22f4024049907f774b")
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4702
-Wshadow
-Wunused-parameter
-Wmissing-prototypes # MacOSX
)
ocv_update(OPENCV_TBB_RELEASE "2019_U8")
ocv_update(OPENCV_TBB_RELEASE_MD5 "7c371d0f62726154d2c568a85697a0ad")
ocv_update(OPENCV_TBB_FILENAME "${OPENCV_TBB_RELEASE}.tar.gz")
ocv_update(OPENCV_TBB_SUBDIR "tbb-${OPENCV_TBB_RELEASE}")
set(tbb_src_dir "${OpenCV_BINARY_DIR}/3rdparty/tbb")
ocv_download(FILENAME ${tbb_filename}
HASH ${tbb_md5}
ocv_download(FILENAME ${OPENCV_TBB_FILENAME}
HASH ${OPENCV_TBB_RELEASE_MD5}
URL
"${OPENCV_TBB_URL}"
"$ENV{OPENCV_TBB_URL}"
@ -29,7 +24,7 @@ ocv_download(FILENAME ${tbb_filename}
if(NOT res)
return()
endif()
set(tbb_src_dir "${tbb_src_dir}/${tbb_subdir}")
set(tbb_src_dir "${tbb_src_dir}/${OPENCV_TBB_SUBDIR}")
ocv_include_directories("${tbb_src_dir}/include"
"${tbb_src_dir}/src/"
@ -82,18 +77,19 @@ endif()
if(ANDROID_COMPILER_IS_CLANG)
add_definitions(-D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-prototypes)
endif()
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs})
ocv_warnings_disable(CMAKE_CXX_FLAGS
/wd4702
-Wshadow
-Wunused-parameter
-Wclass-memaccess # TBB 2018 under GCC 8+
-Wimplicit-fallthrough # TBB 2018 under GCC 7+
-Wmissing-prototypes # MacOSX, Android/Clang
-Wundef -Wmissing-declarations # TBB 2019
)
if (ARM AND NOT WIN32)
if (NOT ANDROID)
set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/arm_linux_stub.cpp")
endif()
set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
endif()
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs})
set(tbb_version_file "version_string.ver")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}.cmakein" "${CMAKE_CURRENT_BINARY_DIR}/${tbb_version_file}" @ONLY)
@ -122,8 +118,6 @@ else()
target_link_libraries(tbb c m dl)
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
# filter out flags that are not handled well by the TBB code
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
string(REPLACE "-Werror=non-virtual-dtor" "" ${var} "${${var}}")

@ -1,41 +0,0 @@
#include <cstdio>
static inline int getPossibleCPUs()
{
FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r");
if(!cpuPossible)
return 1;
char buf[2000]; //big enough for 1000 CPUs in worst possible configuration
char* pbuf = fgets(buf, sizeof(buf), cpuPossible);
fclose(cpuPossible);
if(!pbuf)
return 1;
//parse string of form "0-1,3,5-7,10,13-15"
int cpusAvailable = 0;
while(*pbuf)
{
const char* pos = pbuf;
bool range = false;
while(*pbuf && *pbuf != ',')
{
if(*pbuf == '-') range = true;
++pbuf;
}
if(*pbuf) *pbuf++ = 0;
if(!range)
++cpusAvailable;
else
{
int rstart = 0, rend = 0;
sscanf(pos, "%d-%d", &rstart, &rend);
cpusAvailable += rend - rstart + 1;
}
}
return cpusAvailable ? cpusAvailable : 1;
}
#define __TBB_HardwareConcurrency() getPossibleCPUs()

@ -1,11 +0,0 @@
#include "tbb/tbb_misc.h"
namespace tbb {
namespace internal {
void affinity_helper::protect_affinity_mask(bool) {}
affinity_helper::~affinity_helper() {}
void destroy_process_mask() {}
}
}
Loading…
Cancel
Save