Blob Blame History Raw
%global pretty_name HighFive

%global _description %{expand:
HighFive is a modern header-only C++11 friendly interface for libhdf5.

HighFive supports STL vector/string, Boost::UBLAS, Boost::Multi-array, Eigen
and Xtensor. It handles C++ from/to HDF5 with automatic type mapping. HighFive
does not require additional libraries (see dependencies) and supports both HDF5
thread safety and Parallel HDF5 (contrary to the official hdf5 cpp)

It integrates nicely with other CMake projects by defining (and exporting) a
HighFive target.

- Simple C++-ish minimalist interface
- No other dependency than libhdf5
- Zero overhead
- Support C++11

Feature support:
- create/read/write files, datasets, attributes, groups, dataspaces.
- automatic memory management / ref counting
- automatic conversion of std::vector and nested std::vector from/to any
  dataset with basic types
- automatic conversion of std::string to/from variable length string dataset
- selection() / slice support
- parallel Read/Write operations from several nodes with Parallel HDF5
- Advanced types: Compound, Enum, Arrays of Fixed-length strings, References
  etc... (see ChangeLog)

%bcond_without tests
%bcond_without docs

# Header only, so no debuginfo is generated
%global debug_package %{nil}

Name:           highfive
Version:        2.3.1
Release:        %autorelease
Summary:        Header-only C++ HDF5 interface

License:        Boost

# Does not build on 32 bit architectures
# Issue filed upstream:
# Partially patched, fixing i686; see upstream bug for armv7hl status. We can
# work around this by disabling OpenCV on armv7hl until a patch is available.
Patch0:         0001-fix-32bit-arches-use-explicit-casts.patch
Patch1:         0001-Fix-compiling-invalid-reinterpret_cast-on-32-bit.patch
Patch2:         27a8f06d58a0bdb5c31a84fd8a653a9433f06082.patch

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  git-core
BuildRequires:  hdf5-devel
# Technically optional, enabled by default
BuildRequires:  boost-devel
# Our choice vs. make
BuildRequires:  ninja-build

# Optional but included in Fedora, so we use these
BuildRequires:  cmake(eigen3)
BuildRequires:  cmake(xtensor)
%ifnarch %{arm32}
BuildRequires:  cmake(opencv)
# The -static versions are required by guidelines for tracking header-only
# libraries
BuildRequires:  eigen3-static
BuildRequires:  xtensor-static

%if %{with docs}
BuildRequires:  doxygen

%description %_description

%package        devel
Summary:        Development files for %{name}
Provides:       %{name}%{?_isa} = %{version}-%{release}
Provides:       %{name}-static%{?_isa} = %{version}-%{release}
# Unarched version is needed since arched BuildRequires must not be used
Provides:       %{name}-static = %{version}-%{release}

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

%if %{with docs}
%package        doc
Summary:        Documentation for %{name}
BuildArch:      noarch

%description    doc
Documentation for %{name}

%autosetup -n %{pretty_name}-%{version} -S git -p1

%if %{with tests}
# The unit tests intentionally test deprecated APIs; silence these warnings so
# we are more likely to notice any real problems.
CXXFLAGS="${CXXFLAGS} -Wno-deprecated-declarations"
%cmake \
%ifnarch %{arm32}
    -DHIGHFIVE_UNIT_TESTS:BOOL=%{?with_tests:TRUE}%{?!with_tests:FALSE} \
    -DHIGHFIVE_BUILD_DOCS:BOOL=%{?with_docs:TRUE}%{?!with_docs:FALSE} \
%if %{with docs}
%cmake_build --target doc

# Move the CMake configurations to the correct location
[ ! -d '%{buildroot}/%{_libdir}/cmake/%{pretty_name}' ]
install -d '%{buildroot}/%{_libdir}/cmake'
mv -v '%{buildroot}/%{_datadir}/%{pretty_name}/CMake' \

%if %{with tests}

%files devel
%license LICENSE

%if %{with docs}
%files doc
%license LICENSE
%doc %{_vpath_builddir}/doc/html