%undefine __cmake_in_source_build %global tests 1 %global appname QCoro %global qt5_build_dir release-qt5 %global qt6_build_dir release-qt6 %global _description %{expand: The QCoro library provides set of tools to make use of the C++20 coroutines in connection with certain asynchronous Qt actions. The major benefit of using coroutines with Qt types is that it allows writing asynchronous code as if it were synchronous and, most importantly, while the coroutine is co_awaiting, the Qt event loop runs as usual, meaning that your application remains responsive.} Name: qcoro Version: 0.4.0 Release: 1%{?dist} License: MIT Summary: C++ Coroutines for Qt URL: https://github.com/danvratil/%{name} Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz BuildRequires: cmake(Qt5Core) BuildRequires: cmake(Qt5DBus) BuildRequires: cmake(Qt5Widgets) BuildRequires: cmake(Qt6Core) BuildRequires: cmake(Qt6DBus) BuildRequires: cmake(Qt6Widgets) BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: ninja-build %if 0%{?tests} BuildRequires: cmake(Qt5Concurrent) BuildRequires: cmake(Qt5Test) BuildRequires: cmake(Qt6Concurrent) BuildRequires: cmake(Qt6Test) BuildRequires: dbus-x11 %endif %description %_description %package qt5 Summary: %{summary} 5 Provides: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name} < %{?epoch:%{epoch}:}%{version}-%{release} %package qt6 Summary: %{summary} 6 %package qt5-devel Summary: Development files for %{appname} (Qt 5 version) Requires: %{name}-qt5%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: %{name}-devel = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name}-devel < %{?epoch:%{epoch}:}%{version}-%{release} %package qt6-devel Summary: Development files for %{appname} (Qt 6 version) Requires: %{name}-qt6%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description qt5 %_description %description qt6 %_description %description qt5-devel %_description %description qt6-devel %_description %prep %autosetup -p1 sed -e '/-Werror/d' -i CMakeLists.txt %build # Creating directories for separate builds... mkdir {%{qt5_build_dir},%{qt6_build_dir}} # Building Qt 5 version... pushd %{qt5_build_dir} %cmake -G Ninja \ -S'..' \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_QT_VERSION:STRING=5 \ %if 0%{?tests} -DBUILD_TESTING:BOOL=ON \ -DQCORO_BUILD_EXAMPLES:BOOL=ON \ %else -DBUILD_TESTING:BOOL=OFF \ -DQCORO_BUILD_EXAMPLES:BOOL=OFF \ %endif -DQCORO_ENABLE_ASAN:BOOL=OFF \ -DQCORO_WITH_QTDBUS:BOOL=ON \ -DQCORO_WITH_QTNETWORK:BOOL=ON %cmake_build popd # Building Qt 6 version... pushd %{qt6_build_dir} %cmake -G Ninja \ -S'..' \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_QT_VERSION:STRING=6 \ %if 0%{?tests} -DBUILD_TESTING:BOOL=ON \ -DQCORO_BUILD_EXAMPLES:BOOL=ON \ %else -DBUILD_TESTING:BOOL=OFF \ -DQCORO_BUILD_EXAMPLES:BOOL=OFF \ %endif -DQCORO_ENABLE_ASAN:BOOL=OFF \ -DQCORO_WITH_QTDBUS:BOOL=ON \ -DQCORO_WITH_QTNETWORK:BOOL=ON %cmake_build popd %install # Installing Qt 5 version... pushd %{qt5_build_dir} %cmake_install popd # Installing Qt 6 version... pushd %{qt6_build_dir} %cmake_install popd %if 0%{?tests} %check # Performing tests against Qt 5 version... pushd %{qt5_build_dir} %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' popd # Performing tests against Qt 6 version... pushd %{qt6_build_dir} %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' popd %endif %files qt5 %doc README.md %license LICENSES/* %{_libdir}/lib%{appname}5*.so.0* %files qt6 %doc README.md %license LICENSES/* %{_libdir}/lib%{appname}6*.so.0* %files qt5-devel %{_includedir}/%{name}5/ %{_libdir}/cmake/%{appname}5*/ %{_libdir}/lib%{appname}5*.so %files qt6-devel %{_includedir}/%{name}6/ %{_libdir}/cmake/%{appname}6*/ %{_libdir}/lib%{appname}6*.so %changelog * Sun Jan 09 2022 Vitaly Zaitsev - 0.4.0-1 - Updated to version 0.4.0. - Separated Qt 5 and Qt 6 versions into a different subpackages. * Mon Oct 25 2021 Vitaly Zaitsev - 0.3.0-1 - Updated to version 0.3.0. * Sat Oct 02 2021 Vitaly Zaitsev - 0.2.0-1 - Initial SPEC release.