Implemented out of source build.

This commit is contained in:
Vitaly Zaitsev 2020-07-08 13:59:57 +02:00
parent cdcfe58baa
commit c52e6c758b
No known key found for this signature in database
GPG Key ID: BF99FC6DD45AB90A

View File

@ -1,3 +1,5 @@
%undefine __cmake_in_source_build
%bcond_without doc %bcond_without doc
Name: fmt Name: fmt
Version: 7.0.1 Version: 7.0.1
@ -18,6 +20,7 @@ Patch8: doc-build-use-python3.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: ninja-build
%if 0%{?rhel} && 0%{?rhel} <= 7 %if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: cmake3 BuildRequires: cmake3
%else %else
@ -70,15 +73,14 @@ This package contains documentation for developer documentation for %{name}.
%prep %prep
%autosetup -p1 %autosetup -p1
mkdir build
%build %build
pushd build
%if 0%{?rhel} && 0%{?rhel} <= 7 %if 0%{?rhel} && 0%{?rhel} <= 7
%cmake3 .. \ %cmake3 \
%else %else
%cmake .. \ %cmake \
%endif %endif
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DFMT_CMAKE_DIR=%{_datadir}/cmake/%{name} \ -DFMT_CMAKE_DIR=%{_datadir}/cmake/%{name} \
@ -86,19 +88,17 @@ pushd build
%if %{with doc} %if %{with doc}
# Remove --clean-css since that plugin isn't available # Remove --clean-css since that plugin isn't available
sed -i "s/'--clean-css',//" ../doc/build.py sed -i "s/'--clean-css',//" doc/build.py
%make_build all doc %cmake_build --target all --target doc
# Remove temporary build products # Remove temporary build products
rm -rf ../build/doc/html/{.buildinfo,.doctrees,objects.inv} rm -rf %{_vpath_builddir}/doc/html/{.buildinfo,.doctrees,objects.inv}
%endif %endif
%install %install
%make_install -C build %cmake_install
%check %check
pushd build %ctest
ctest -VV %{?_smp_mflags}
popd
%files %files
%license LICENSE.rst %license LICENSE.rst