!4 Fix FindTBB version detection with TBB >= 2021.1.1

From: @yaqiangchen 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2024-11-13 01:41:05 +00:00 committed by Gitee
commit e2be91e02f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 4 deletions

View File

@ -0,0 +1,40 @@
From 9aa52c6ff74358d1b91542221e0545bb61bdedcc Sun May 15 00:00:00 2001
From: Alexs Mayorga <amayorga@cproperties.com>
Date: Sun, 15 May 2021 10:47:19 +0800
Subject: [PATCH] Fix FindTBB version detection with TBB >= 2021.1.1
---
cmake/FindTBB.cmake | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake
index 5ae7b61..10e540d 100644
--- a/cmake/FindTBB.cmake
+++ b/cmake/FindTBB.cmake
@@ -429,10 +429,23 @@ findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
#=============================================================================
#parse all the version numbers from tbb
if(NOT TBB_VERSION)
+ set(TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1
+ "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
+ set(TBB_VERSION_FILE_AFTER_TBB_2021_1
+ "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
+
+ if (EXISTS "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
+ set(TBB_VERSION_FILE "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
+ elseif (EXISTS "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
+ set(TBB_VERSION_FILE "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
+ else()
+ message(FATAL_ERROR "Found TBB installation: ${TBB_INCLUDE_DIR} "
+ "missing version header.")
+ endif()
#only read the start of the file
file(STRINGS
- "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
+ "${TBB_VERSION_FILE}"
TBB_VERSION_CONTENTS
REGEX "VERSION")
--
2.43.0

View File

@ -1,12 +1,13 @@
Name: ceres-solver
Version: 2.0.0
Release: 1
Release: 2
Summary: A non-linear least squares minimizer
License: MIT and Apache-2.0
URL: http://ceres-solver.org/
Source0: http://%{name}.org/%{name}-%{version}.tar.gz
Patch0: Fix-FindTBB-version-detection-with-TBB-2021.1.1.patch
%global blaslib openblas
@ -49,11 +50,9 @@ developing applications that use %{name}.
-DGFLAGS_INCLUDE_DIR=%{_includedir}
%make_build
%install
%make_install
%files
%doc README.md
%license LICENSE
@ -64,7 +63,9 @@ developing applications that use %{name}.
%{_libdir}/*.so
%{_libdir}/cmake/Ceres
%changelog
* Tue Nov 12 2024 chenyaqiang <chengyaqiang@huawei.com> - 2.0.0-2
- Sync 941ea13475913 to fix not found tbb version
* Fri Mar 18 2022 tanyulong <tanyulong@kylin0s.cn> - 2.0.0-1
- init package for openEuler