From 3d234972e6dda87fb7131337a8604d2dd2646205 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Mon, 28 Nov 2022 10:30:26 +0100 Subject: [PATCH] Add Qt6 build, drop Qt4 build --- CMakeLists.txt | 32 ++++++++++++++ qcustomplot.pro | 14 ------ qcustomplot.spec | 111 +++++++++++++++++++++++++---------------------- 3 files changed, 90 insertions(+), 67 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 qcustomplot.pro diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..808cca9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 2.8) +project(qcustomplot) + +set(SO_VER "" CACHE STRING "SO version") +set(QT_VER "6" CACHE STRING "Target Qt version") + +set(QCUSTOMPLOT_LIB_VERSION ${SO_VER}.0) +set(QCUSTOMPLOT_SO_VERSION ${SO_VER}) + +FIND_PACKAGE(Qt${QT_VER}Core REQUIRED) +FIND_PACKAGE(Qt${QT_VER}Gui REQUIRED) +FIND_PACKAGE(Qt${QT_VER}Widgets REQUIRED) +FIND_PACKAGE(Qt${QT_VER}PrintSupport REQUIRED) + +# Library +add_library(qcustomplot SHARED qcustomplot.cpp qcustomplot.h) +set_target_properties(qcustomplot PROPERTIES VERSION ${QCUSTOMPLOT_LIB_VERSION} SOVERSION ${QCUSTOMPLOT_SO_VERSION}) +if (${QT_VER} GREATER "4") +set_target_properties(qcustomplot PROPERTIES OUTPUT_NAME qcustomplot-qt${QT_VER}) +endif() +target_link_libraries(qcustomplot Qt${QT_VER}::Core Qt${QT_VER}::Gui Qt${QT_VER}::Widgets Qt${QT_VER}::PrintSupport) + +install(TARGETS qcustomplot + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} +) + +# Headers +install(FILES qcustomplot.h + DESTINATION include +) diff --git a/qcustomplot.pro b/qcustomplot.pro deleted file mode 100644 index e0c1054..0000000 --- a/qcustomplot.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = lib -VERSION = $$SOVERSION -TARGET = qcustomplot$$QTSUFFIX -QT = core gui widgets printsupport - -SOURCES = qcustomplot.cpp -HEADERS = qcustomplot.h - -target.path = $$LIBDIR -INSTALLS += target - -header.path = /usr/include -header.files = qcustomplot.h -INSTALLS += header \ No newline at end of file diff --git a/qcustomplot.spec b/qcustomplot.spec index 45c8ab7..da03e00 100644 --- a/qcustomplot.spec +++ b/qcustomplot.spec @@ -6,18 +6,19 @@ Name: qcustomplot Version: 2.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Qt widget for plotting and data visualization License: GPL-3.0-or-later URL: http://www.qcustomplot.com/ Source0: http://www.qcustomplot.com/release/%{version}%{?pre:-%pre}/QCustomPlot.tar.gz -Source1: %{name}.pro +Source1: CMakeLists.txt +BuildRequires: cmake +BuildRequires: ninja-build BuildRequires: gcc-c++ -BuildRequires: make -BuildRequires: qt4-devel BuildRequires: qt5-qtbase-devel +BuildRequires: qt6-qtbase-devel %description @@ -29,15 +30,6 @@ visualization applications. This package contains the Qt4 version. -%package devel -Summary: Development files for %{name} (Qt4) -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description devel -The %{name}-devel package contains libraries and header files for -developing applications that use %{name} (Qt4). - - %package qt5 Summary: Qt widget for plotting and data visualization Requires: %{name}-qt5%{?_isa} = %{version}-%{release} @@ -57,7 +49,29 @@ Requires: %{name}-qt5%{?_isa} = %{version}-%{release} %description qt5-devel The %{name}-devel package contains libraries and header files for -developing applications that use %{name} (Qt5). +developing applications that use %{name} (Qt5). + + +%package qt6 +Summary: Qt widget for plotting and data visualization +Requires: %{name}-qt5%{?_isa} = %{version}-%{release} + +%description qt6 +QCustomPlot is a Qt C++ widget for plotting and data visualization. +This plotting library focuses on making good looking, publication quality 2D +plots, graphs and charts, as well as offering high performance for realtime +visualization applications. + +This package contains the Qt6 version. + + +%package qt6-devel +Summary: Development files for %{name} (Qt6) +Requires: %{name}-qt5%{?_isa} = %{version}-%{release} + +%description qt6-devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name} (Qt6). %package doc @@ -75,28 +89,27 @@ cp -a %{SOURCE1} . %build -mkdir qt4 -( -cd qt4 -LDFLAGS="%{__global_ldflags} -Wl,--as-needed" %qmake_qt4 SOVERSION=%{so_ver} LIBDIR=%{_libdir} .. -%make_build -) +%define _vpath_builddir %{_target_platform}-qt5 +%cmake -DQT_VER=5 -DSO_VER=%{so_ver} +%cmake_build -mkdir qt5 -( -cd qt5 -LDFLAGS="%{__global_ldflags} -Wl,--as-needed" %qmake_qt5 SOVERSION=%{so_ver} QTSUFFIX=-qt5 LIBDIR=%{_libdir} .. -%make_build -) +%define _vpath_builddir %{_target_platform}-qt6 +%cmake -DQT_VER=6 -DSO_VER=%{so_ver} +%cmake_build %install -make -C qt4 INSTALL_ROOT=%{buildroot} install -make -C qt5 INSTALL_ROOT=%{buildroot} install +%define _vpath_builddir %{_target_platform}-qt5 +%cmake_install + +%define _vpath_builddir %{_target_platform}-qt6 +%cmake_install + +# pkg-config files +for qtver in -qt5 -qt6; do -# pkg-config file install -d %{buildroot}%{_libdir}/pkgconfig/ -cat > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc < %{buildroot}%{_libdir}/pkgconfig/%{name}$qtver.pc < %{buildroot}%{_libdir}/pkgconfig/%{name}-qt5.pc < - 2.1.1-2 +- Add Qt6 build, drop Qt4 build + * Wed Nov 09 2022 Sandro Mani - 2.1.1-1 - Update to 2.1.1