From: Matthias Maier Date: Tue, 16 Nov 2021 18:44:44 +0000 (-0600) Subject: CMake: Update module to find oneapi tbb X-Git-Tag: v9.4.0-rc1~754^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97d3ec43079e8765f200980c8b2c6083600b2dcc;p=dealii.git CMake: Update module to find oneapi tbb --- diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index ebc3b99cb1..43ceafbb1a 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -56,6 +56,10 @@ ELSE() SET(_libraries TBB_LIBRARY) ENDIF() +# +# Check for old TBB header layout: +# + DEAL_II_FIND_PATH(TBB_INCLUDE_DIR tbb/tbb_stddef.h HINTS ${TBB_DIR} @@ -76,6 +80,34 @@ IF(EXISTS ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h) SET(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}" ) + +ELSE() + + # + # Check for new oneAPI TBB header layout: + # + + DEAL_II_FIND_PATH(TBB_INCLUDE_DIR oneapi/tbb/version.h + HINTS + ${TBB_DIR} + PATH_SUFFIXES include include/tbb tbb + ) + + IF(EXISTS ${TBB_INCLUDE_DIR}/oneapi/tbb/version.h) + FILE(STRINGS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h" TBB_VERSION_MAJOR_STRING + REGEX "#define.*TBB_VERSION_MAJOR") + STRING(REGEX REPLACE "^.*TBB_VERSION_MAJOR +([0-9]+).*" "\\1" + TBB_VERSION_MAJOR "${TBB_VERSION_MAJOR_STRING}" + ) + FILE(STRINGS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h" TBB_VERSION_MINOR_STRING + REGEX "#define.*TBB_VERSION_MINOR") + STRING(REGEX REPLACE "^.*TBB_VERSION_MINOR +([0-9]+).*" "\\1" + TBB_VERSION_MINOR "${TBB_VERSION_MINOR_STRING}" + ) + SET(TBB_VERSION + "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}" + ) + ENDIF() ENDIF() DEAL_II_PACKAGE_HANDLE(TBB