]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Update module to find oneapi tbb
authorMatthias Maier <tamiko@43-1.org>
Tue, 16 Nov 2021 18:44:44 +0000 (12:44 -0600)
committerMatthias Maier <tamiko@43-1.org>
Thu, 9 Dec 2021 03:30:32 +0000 (21:30 -0600)
cmake/modules/FindTBB.cmake

index ebc3b99cb1f798bcbf8edb1ae44ed9382bb99dc9..43ceafbb1ab78eba363e8b1f1ee84c25573b27af 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.