Name:           ceres-solver
Version:        2.0.0
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

ExcludeArch: ppc64

BuildRequires:  cmake >= 2.8.0
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  eigen3-static >= 3.2.1
BuildRequires:  suitesparse-devel >= 3.4.0-9
BuildRequires:  tbb-devel
BuildRequires:  %{blaslib}-devel
BuildRequires:  gflags-devel >= 2.2.1
BuildRequires:  glog-devel >= 0.3.1

%description

Ceres Solver is an open source C++ library for modeling and solving
large, complicated optimization problems.

%package        devel
Summary:        A non-linear least squares minimizer
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       eigen3-devel
Requires:       gflags-devel
Requires:       glog-devel

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%autosetup -p1

%build
%cmake . \
  -DCXSPARSE_INCLUDE_DIR:PATH=%{_includedir}/suitesparse \
  -DBLAS_LIBRARIES=-l%{blaslib} \
  -DGFLAGS_INCLUDE_DIR=%{_includedir}
%make_build

%install
%make_install

%files
%doc README.md
%license LICENSE
%{_libdir}/*.so.*

%files devel
%{_includedir}/*
%{_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
