[packages/OpenCASCADE] fix build with tbb 2021.4

atler atler at pld-linux.org
Mon Dec 20 15:46:53 CET 2021


commit 549a1d9bad7447415d2c041593b5ec55bcf167a6
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Dec 20 15:46:11 2021 +0100

    fix build with tbb 2021.4

 OpenCASCADE-tbb.patch | 33 +++++++++++++++++++++++++++++++++
 OpenCASCADE.spec      |  5 ++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
---
diff --git a/OpenCASCADE.spec b/OpenCASCADE.spec
index bc5512c..e238679 100644
--- a/OpenCASCADE.spec
+++ b/OpenCASCADE.spec
@@ -42,6 +42,7 @@ Source0:	https://github.com/tpaviot/oce/releases/download/official-upstream-pack
 # Source0-md5:	eb62af12f173b7ce32209701cdd877ea
 Patch0:		%{name}-cmake.patch
 Patch1:		%{name}-inspector-data.patch
+Patch2:		%{name}-tbb.patch
 URL:		https://www.opencascade.com/open-cascade-technology/
 %{?with_freeimage:BuildRequires:	FreeImage-devel}
 BuildRequires:	OpenGL-GLU-devel
@@ -60,7 +61,7 @@ BuildRequires:	libstdc++-devel >= 6:4.7
 BuildRequires:	libtool
 BuildRequires:	rapidjson-devel
 BuildRequires:	rpmbuild(macros) >= 1.752
-%{?with_tbb:BuildRequires:	tbb-devel}
+%{?with_tbb:BuildRequires:	tbb-devel >= 2021.4}
 BuildRequires:	tcl-devel
 BuildRequires:	tk-devel
 %{?with_vtk:BuildRequires:	vtk-devel}
@@ -77,6 +78,7 @@ BuildRequires:	qt5-build >= 5
 BuildRequires:	qt5-linguist >= 5
 %endif
 Requires:	%{name}-libs = %{version}-%{release}
+%{?with_tbb:Requires:	tbb >= 2021.4}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_noautocompressdoc	*.chm
@@ -216,6 +218,7 @@ Przykłady do OpenCASCADE.
 %setup -q -n opencascade-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %{__sed} -i -e '/set (CMAKE_CONFIGURATION_TYPES/ { s/INTERNAL/STRING/;s/ FORCE// }' CMakeLists.txt
 
diff --git a/OpenCASCADE-tbb.patch b/OpenCASCADE-tbb.patch
new file mode 100644
index 0000000..999c118
--- /dev/null
+++ b/OpenCASCADE-tbb.patch
@@ -0,0 +1,33 @@
+diff -u -r opencascade-7.5.0.orig/src/OSD/OSD_Parallel_TBB.cxx opencascade-7.5.0/src/OSD/OSD_Parallel_TBB.cxx
+--- opencascade-7.5.0.orig/src/OSD/OSD_Parallel_TBB.cxx	2020-11-03 15:50:04.000000000 +0100
++++ opencascade-7.5.0/src/OSD/OSD_Parallel_TBB.cxx	2021-12-20 15:02:25.028915774 +0100
+@@ -25,7 +25,7 @@
+ #include <tbb/parallel_for.h>
+ #include <tbb/parallel_for_each.h>
+ #include <tbb/blocked_range.h>
+-#include <tbb/task_scheduler_init.h>
++#include <tbb/global_control.h>
+ Standard_ENABLE_DEPRECATION_WARNINGS
+ 
+ //=======================================================================
+@@ -38,19 +38,12 @@
+                                     const FunctorInterface& theFunctor,
+                                     Standard_Integer theNbItems)
+ {
+-  try
+-  {
+     const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
+     const Standard_Integer aNbThreads = theNbItems > 0 ?
+       aThreadPool->NbDefaultThreadsToLaunch() : -1;
+ 
+-    tbb::task_scheduler_init aScheduler (aNbThreads);
++    tbb::global_control(tbb::global_control::max_allowed_parallelism, aNbThreads);
+     tbb::parallel_for_each (theBegin, theEnd, theFunctor);
+-  }
+-  catch (tbb::captured_exception& anException)
+-  {
+-    throw Standard_ProgramError (anException.what());
+-  }
+ }
+ 
+ #endif /* HAVE_TBB */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/OpenCASCADE.git/commitdiff/d1a4f035b4444c317a7bfa1724de85984b8001a8



More information about the pld-cvs-commit mailing list