From 0a922dd626b0b525a1d0adc7a64f28b9fa36c711 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 16:38:06 +0200 Subject: [PATCH 01/13] Update qcustomplot recipe to be compatible with Conan 2 --- recipes/qcustomplot/all/conanfile.py | 9 ++++----- recipes/qcustomplot/all/test_package/CMakeLists.txt | 6 +++--- recipes/qcustomplot/all/test_package/conanfile.py | 6 ++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 067cd911c84e9..17078ce35f91b 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -11,6 +11,7 @@ class QCustomPlotConan(ConanFile): name = "qcustomplot" + package_type = "library" description = "QCustomPlot is a Qt C++ widget for plotting and data visualization." license = "GPL-3.0-only" topics = ("chart", "data-visualization", "graph", "plot", "qt") @@ -39,15 +40,12 @@ def config_options(self): def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - # FIXME: we shouldn't have to force shared in qt, but config file - # generated by conan in qt static is likely broken, or maybe env vars. - self.options["qt"].shared = True def requirements(self): if Version(self.version) >= "2.0.0": - self.requires("qt/6.4.1") + self.requires("qt/[~6]", transitive_headers=True, transitive_libs=True) else: - self.requires("qt/5.15.7") + self.requires("qt/[~5]", transitive_headers=True, transitive_libs=True) if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") @@ -105,5 +103,6 @@ def package_info(self): self.cpp_info.defines.append("QCUSTOMPLOT_USE_LIBRARY") if self.options.with_opengl: self.cpp_info.defines.append("QCUSTOMPLOT_USE_OPENGL") + self.cpp_info.requires.append("qt::qtOpenGL") if self.settings.os == "Windows": self.cpp_info.requires.append("opengl::opengl") diff --git a/recipes/qcustomplot/all/test_package/CMakeLists.txt b/recipes/qcustomplot/all/test_package/CMakeLists.txt index 0c4ecbcbc5832..8f6e581c79261 100644 --- a/recipes/qcustomplot/all/test_package/CMakeLists.txt +++ b/recipes/qcustomplot/all/test_package/CMakeLists.txt @@ -4,15 +4,15 @@ project(test_package LANGUAGES CXX) add_executable(${PROJECT_NAME} test_package.cpp) find_package(qcustomplot REQUIRED CONFIG) -target_link_libraries(${PROJECT_NAME} PRIVATE qcustomplot::qcustomplot) +target_link_libraries(${PROJECT_NAME} PUBLIC qcustomplot::qcustomplot) if(QT_VERSION VERSION_GREATER_EQUAL "6.0.0") find_package(Qt6 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets) + target_link_libraries(${PROJECT_NAME} PUBLIC Qt6::Core Qt6::Widgets) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) elseif(QT_VERSION VERSION_GREATER_EQUAL "5.0.0") find_package(Qt5 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets) + target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Core Qt5::Widgets) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) else() message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") diff --git a/recipes/qcustomplot/all/test_package/conanfile.py b/recipes/qcustomplot/all/test_package/conanfile.py index 82919b2651add..f9013fcba5ef1 100644 --- a/recipes/qcustomplot/all/test_package/conanfile.py +++ b/recipes/qcustomplot/all/test_package/conanfile.py @@ -26,7 +26,5 @@ def build(self): cmake.build() def test(self): - # can't run in Linux agents (headless) - if can_run(self) and self.settings.os != "Linux": - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun") + # gui app, doesn't really make sense to run it + pass From 64370d3f11f21d6c6f91eb25d891ec8d3ac740a2 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 17:16:03 +0200 Subject: [PATCH 02/13] simplify test --- .../all/test_package/test_package.cpp | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/recipes/qcustomplot/all/test_package/test_package.cpp b/recipes/qcustomplot/all/test_package/test_package.cpp index d8704b43d7898..4cd0aa83fdaac 100644 --- a/recipes/qcustomplot/all/test_package/test_package.cpp +++ b/recipes/qcustomplot/all/test_package/test_package.cpp @@ -1,27 +1,9 @@ -#include +// Checks that qcustomplot can be included but not much more. -#include -#include -#include +#include int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QMainWindow window; - QCustomPlot customPlot; - window.setCentralWidget(&customPlot); - - QVector x(101), y(101); - for (int i = 0; i < 101; ++i) { - x[i] = i / 50.0 - 1; - y[i] = x[i] * x[i]; - } - customPlot.addGraph(); - customPlot.graph(0)->setData(x, y); - customPlot.xAxis->setLabel("x"); - customPlot.yAxis->setLabel("y"); - customPlot.rescaleAxes(); - window.setGeometry(100, 100, 500, 400); return 0; } From 95ca555072b9205374d2a39b0b0f716fc9c81029 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 17:16:11 +0200 Subject: [PATCH 03/13] change qt dependency --- recipes/qcustomplot/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 17078ce35f91b..959e00e8825f1 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -43,7 +43,7 @@ def configure(self): def requirements(self): if Version(self.version) >= "2.0.0": - self.requires("qt/[~6]", transitive_headers=True, transitive_libs=True) + self.requires("qt/[~6.4]", transitive_headers=True, transitive_libs=True) else: self.requires("qt/[~5]", transitive_headers=True, transitive_libs=True) if self.options.with_opengl and self.settings.os == "Windows": From a353cbf6082f6acb83652abcbd22a825e06aa4b9 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 18:11:44 +0200 Subject: [PATCH 04/13] Remove support for version one Very old, last 1.3.2 is from 2015. --- recipes/qcustomplot/all/conandata.yml | 3 --- recipes/qcustomplot/all/conanfile.py | 15 ++++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/recipes/qcustomplot/all/conandata.yml b/recipes/qcustomplot/all/conandata.yml index 9655ef7e13aab..9b9ecc2f4a023 100644 --- a/recipes/qcustomplot/all/conandata.yml +++ b/recipes/qcustomplot/all/conandata.yml @@ -5,9 +5,6 @@ sources: "2.1.0": url: "https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot-source.tar.gz" sha256: "357b78be0f52b2d01c17ec3e2e1271255761810af7e8a9476cef51fccf1a0f44" - "1.3.2": - url: "https://www.qcustomplot.com/release/1.3.2/QCustomPlot.tar.gz" - sha256: "ea2ed5712c2020b25f40eacabd0926ef71a7f07e2a3771c32d53ace1f47123eb" patches: "2.1.0": - patch_file: "patches/0001-fix-for-qt6.2.patch" diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 959e00e8825f1..1084226db02ee 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -42,10 +42,8 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - if Version(self.version) >= "2.0.0": - self.requires("qt/[~6.4]", transitive_headers=True, transitive_libs=True) - else: - self.requires("qt/[~5]", transitive_headers=True, transitive_libs=True) + self.requires("qt/[~6.4]", transitive_headers=True, transitive_libs=True) + if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") @@ -78,11 +76,10 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) >= "2.0.0": - # allow static qcustomplot with shared qt, and vice versa - replace_in_file(self, os.path.join(self.source_folder, "qcustomplot.h"), - "#if defined(QT_STATIC_BUILD)", - "#if 0" if self.options.shared else "#if 1") + # allow static qcustomplot with shared qt, and vice versa + replace_in_file(self, os.path.join(self.source_folder, "qcustomplot.h"), + "#if defined(QT_STATIC_BUILD)", + "#if 0" if self.options.shared else "#if 1") def build(self): self._patch_sources() From f657661a11cfc27623c0ab9ee713e03ddb534307 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 19:44:37 +0200 Subject: [PATCH 05/13] remove version range --- recipes/qcustomplot/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 1084226db02ee..d5636297ba24c 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -42,7 +42,7 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("qt/[~6.4]", transitive_headers=True, transitive_libs=True) + self.requires("qt/6.4.2", transitive_headers=True, transitive_libs=True) if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") From e55e71e177a9196e35930f8ceb40c32bb29d502b Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 19:53:25 +0200 Subject: [PATCH 06/13] Revert "simplify test" This reverts commit 64370d3f11f21d6c6f91eb25d891ec8d3ac740a2. --- .../all/test_package/test_package.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/recipes/qcustomplot/all/test_package/test_package.cpp b/recipes/qcustomplot/all/test_package/test_package.cpp index 4cd0aa83fdaac..d8704b43d7898 100644 --- a/recipes/qcustomplot/all/test_package/test_package.cpp +++ b/recipes/qcustomplot/all/test_package/test_package.cpp @@ -1,9 +1,27 @@ -// Checks that qcustomplot can be included but not much more. - #include +#include +#include +#include + int main(int argc, char *argv[]) { + QApplication app(argc, argv); + QMainWindow window; + QCustomPlot customPlot; + window.setCentralWidget(&customPlot); + + QVector x(101), y(101); + for (int i = 0; i < 101; ++i) { + x[i] = i / 50.0 - 1; + y[i] = x[i] * x[i]; + } + customPlot.addGraph(); + customPlot.graph(0)->setData(x, y); + customPlot.xAxis->setLabel("x"); + customPlot.yAxis->setLabel("y"); + customPlot.rescaleAxes(); + window.setGeometry(100, 100, 500, 400); return 0; } From b6c57a11be0df059376e9932aca9d881586e3cc5 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 19:55:31 +0200 Subject: [PATCH 07/13] In test, logic from main to dummy function not executed. --- .../qcustomplot/all/test_package/conanfile.py | 5 +++-- .../all/test_package/test_package.cpp | 16 +++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/recipes/qcustomplot/all/test_package/conanfile.py b/recipes/qcustomplot/all/test_package/conanfile.py index f9013fcba5ef1..01ef4a7d73540 100644 --- a/recipes/qcustomplot/all/test_package/conanfile.py +++ b/recipes/qcustomplot/all/test_package/conanfile.py @@ -26,5 +26,6 @@ def build(self): cmake.build() def test(self): - # gui app, doesn't really make sense to run it - pass + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qcustomplot/all/test_package/test_package.cpp b/recipes/qcustomplot/all/test_package/test_package.cpp index d8704b43d7898..551320cf6a7a8 100644 --- a/recipes/qcustomplot/all/test_package/test_package.cpp +++ b/recipes/qcustomplot/all/test_package/test_package.cpp @@ -1,18 +1,14 @@ #include -#include -#include #include -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QMainWindow window; - +void dummy() +{ QCustomPlot customPlot; - window.setCentralWidget(&customPlot); QVector x(101), y(101); - for (int i = 0; i < 101; ++i) { + for (int i = 0; i < 101; ++i) + { x[i] = i / 50.0 - 1; y[i] = x[i] * x[i]; } @@ -21,7 +17,9 @@ int main(int argc, char *argv[]) { customPlot.xAxis->setLabel("x"); customPlot.yAxis->setLabel("y"); customPlot.rescaleAxes(); +} - window.setGeometry(100, 100, 500, 400); +int main(int argc, char *argv[]) +{ return 0; } From 7b1ff74d49ce5582e9527b15028fbc68915e81a8 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 20:03:19 +0200 Subject: [PATCH 08/13] fix warning about patch --- recipes/qcustomplot/all/conandata.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/qcustomplot/all/conandata.yml b/recipes/qcustomplot/all/conandata.yml index 9b9ecc2f4a023..4be40ee82bd4e 100644 --- a/recipes/qcustomplot/all/conandata.yml +++ b/recipes/qcustomplot/all/conandata.yml @@ -8,3 +8,6 @@ sources: patches: "2.1.0": - patch_file: "patches/0001-fix-for-qt6.2.patch" + patch_description: "Fix needed to compile with Qt 6.2" + patch_type: "bugfix" + patch_source: "https://www.qcustomplot.com/index.php/support/forum/2380" From 61d67c80fdc4402450e2310790911a72cd98cde3 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 20:14:00 +0200 Subject: [PATCH 09/13] actually remove 1.3.2 --- recipes/qcustomplot/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/qcustomplot/config.yml b/recipes/qcustomplot/config.yml index a7d0cc4f0654b..f8979f3883e4a 100644 --- a/recipes/qcustomplot/config.yml +++ b/recipes/qcustomplot/config.yml @@ -3,5 +3,3 @@ versions: folder: all "2.1.0": folder: all - "1.3.2": - folder: all From 28fa3865b84287caf50c83c22ed04708ef13a816 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Thu, 18 Apr 2024 21:06:21 +0200 Subject: [PATCH 10/13] test disable macos --- recipes/qcustomplot/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index d5636297ba24c..1aa5b5db7103d 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -48,6 +48,8 @@ def requirements(self): self.requires("opengl/system") def validate(self): + if self.settings.os == "Macos": + raise ConanInvalidConfiguration(f"{self.ref} Macos not supported at this moment") if self.info.settings.compiler.cppstd: min_cppstd = "11" if Version(self.dependencies["qt"].ref.version) < "6.0.0" else "17" check_min_cppstd(self, min_cppstd) From f821f4b7baf6932396a36c60f0ed8d46200ef576 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Fri, 19 Apr 2024 07:50:58 +0200 Subject: [PATCH 11/13] add virtual build env and tool requirement --- recipes/qcustomplot/all/conanfile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 1aa5b5db7103d..5c887f96b7688 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -2,6 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, get, export_conandata_patches, replace_in_file from conan.tools.scm import Version import os @@ -47,6 +48,9 @@ def requirements(self): if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") + def build_requirements(self): + self.tool_requires("qt/6.4.2") + def validate(self): if self.settings.os == "Macos": raise ConanInvalidConfiguration(f"{self.ref} Macos not supported at this moment") @@ -66,6 +70,9 @@ def source(self): destination=self.source_folder, strip_root=True) def generate(self): + be = VirtualBuildEnv(self) + be.generate() + tc = CMakeToolchain(self) tc.variables["QCUSTOMPLOT_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["QCUSTOMPLOT_VERSION"] = self.version From ac6167b313cafc7f8b4cf0abe2518ffbed289e7e Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Fri, 19 Apr 2024 09:05:08 +0200 Subject: [PATCH 12/13] VirtualRunEnv instead --- recipes/qcustomplot/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 5c887f96b7688..7e23770c76117 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.env import VirtualBuildEnv +from conan.tools.env import VirtualRunEnv from conan.tools.files import apply_conandata_patches, copy, get, export_conandata_patches, replace_in_file from conan.tools.scm import Version import os @@ -70,8 +70,7 @@ def source(self): destination=self.source_folder, strip_root=True) def generate(self): - be = VirtualBuildEnv(self) - be.generate() + VirtualRunEnv(self).generate(scope="build") tc = CMakeToolchain(self) tc.variables["QCUSTOMPLOT_SRC_DIR"] = self.source_folder.replace("\\", "/") From 0c60d26530d70e020cac75947ffc9b58a1e1c1f5 Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Fri, 19 Apr 2024 11:34:00 +0200 Subject: [PATCH 13/13] Use --- recipes/qcustomplot/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index 7e23770c76117..b105254f28ed0 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -7,8 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" - +required_conan_version = ">=1.56.0 <2 || >=2.0.6" class QCustomPlotConan(ConanFile): name = "qcustomplot" @@ -49,7 +48,7 @@ def requirements(self): self.requires("opengl/system") def build_requirements(self): - self.tool_requires("qt/6.4.2") + self.tool_requires("qt/") def validate(self): if self.settings.os == "Macos":