From 39e4e76179a6943a422cf3b45e716e538224b421 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 20 Nov 2023 16:51:28 +0200 Subject: [PATCH 1/8] Update recipes/qwt/all/conanfile.py PR #21196 Co-authored-by: Jordan Williams qwt: use a more specific license identifier --- recipes/qwt/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 631bed2233c8a..e18a91d17ac4d 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -12,7 +12,7 @@ class QwtConan(ConanFile): name = "qwt" - license = "LGPL-2.1-or-later" + license = "LGPL-2.1+ WITH Qwt-exception-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://qwt.sourceforge.io/" topics = ("chart", "data-visualization", "graph", "plot", "qt") From f997c1a3e9833796cb5f62816238dfbb8ed06c86 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Sun, 20 Aug 2023 17:27:36 +1000 Subject: [PATCH 2/8] Added patch to fix Qt6 builds & reorder exsiting patches --- recipes/qwt/all/conandata.yml | 6 +- ...support.patch => 0001-cmake-support.patch} | 0 ...h.patch => 0002-cmake-support-patch.patch} | 0 ...error-with-Qt6-which-requires-CPP-17.patch | 64 +++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) rename recipes/qwt/all/patches/{cmake-support.patch => 0001-cmake-support.patch} (100%) rename recipes/qwt/all/patches/{cmake-support-patch.patch => 0002-cmake-support-patch.patch} (100%) create mode 100644 recipes/qwt/all/patches/0003-Fix-Build-error-with-Qt6-which-requires-CPP-17.patch diff --git a/recipes/qwt/all/conandata.yml b/recipes/qwt/all/conandata.yml index 31f56157576c0..7a05962ab45f3 100644 --- a/recipes/qwt/all/conandata.yml +++ b/recipes/qwt/all/conandata.yml @@ -4,6 +4,8 @@ sources: sha256: "3e9632a9be6a883db5c496e42ce74cbbf8da02cc3328faa89e2c43e434a2eb76" patches: "6.2.0": - - patch_file: "patches/cmake-support.patch" + - patch_file: "patches/0001-cmake-support.patch" patch_source: "https://github.com/MehdiChinoune/qwt/blob/cmake/CMakeLists.txt" - - patch_file: "patches/cmake-support-patch.patch" + - patch_file: "patches/0002-cmake-support-patch.patch" + - patch_file: "patches/0003-Fix-Build-error-with-Qt6-which-requires-CPP-17.patch" + patch_source: "https://github.com/ashley-b/qwt/commit/75aa20749186a263fd6942a764731826d5bac137" diff --git a/recipes/qwt/all/patches/cmake-support.patch b/recipes/qwt/all/patches/0001-cmake-support.patch similarity index 100% rename from recipes/qwt/all/patches/cmake-support.patch rename to recipes/qwt/all/patches/0001-cmake-support.patch diff --git a/recipes/qwt/all/patches/cmake-support-patch.patch b/recipes/qwt/all/patches/0002-cmake-support-patch.patch similarity index 100% rename from recipes/qwt/all/patches/cmake-support-patch.patch rename to recipes/qwt/all/patches/0002-cmake-support-patch.patch diff --git a/recipes/qwt/all/patches/0003-Fix-Build-error-with-Qt6-which-requires-CPP-17.patch b/recipes/qwt/all/patches/0003-Fix-Build-error-with-Qt6-which-requires-CPP-17.patch new file mode 100644 index 0000000000000..9ab336dd938e7 --- /dev/null +++ b/recipes/qwt/all/patches/0003-Fix-Build-error-with-Qt6-which-requires-CPP-17.patch @@ -0,0 +1,64 @@ +From fc8e1ba33ca4db5a9b07072734025dcd9ad53d58 Mon Sep 17 00:00:00 2001 +From: Ashley Brighthope +Date: Mon, 6 Mar 2023 19:19:40 +1100 +Subject: [PATCH] Fix: Build error with Qt6, which requires C++17 + +Removed enforced C++ version of 11 to be a minimum version of C++ 11 +--- + CMakeLists.txt | 4 ---- + designer/CMakeLists.txt | 6 ++++++ + src/CMakeLists.txt | 6 ++++++ + 3 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b42d510..469fa28 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,10 +7,6 @@ project(Qwt + LANGUAGES CXX + ) + +-set(CMAKE_CXX_STANDARD 11) +-set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +-set(CMAKE_CXX_EXTENSIONS OFF) +- + if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /permissive-") + else() +diff --git a/designer/CMakeLists.txt b/designer/CMakeLists.txt +index aa81efd..98db4b3 100644 +--- a/designer/CMakeLists.txt ++++ b/designer/CMakeLists.txt +@@ -18,6 +18,12 @@ else() + target_link_libraries(qwt_designer_plugin PRIVATE qwt) + endif() + ++if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) ++ target_compile_features(qwt_designer_plugin PUBLIC cxx_std_17) ++else() ++ target_compile_features(qwt_designer_plugin PUBLIC cxx_std_11) ++endif() ++ + target_link_libraries(qwt_designer_plugin PUBLIC Qt${QT_VERSION_MAJOR}::Designer) + + set_target_properties(qwt_designer_plugin PROPERTIES +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d25655a..2714b4f 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -285,6 +285,12 @@ endif() + + add_library(qwt_objects OBJECT ${SOURCES} ${HEADERS}) + ++if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) ++ target_compile_features(qwt_objects PUBLIC cxx_std_17) ++else() ++ target_compile_features(qwt_objects PUBLIC cxx_std_11) ++endif() ++ + target_include_directories(qwt_objects INTERFACE + $ + $ +-- +2.43.0 + From 4db7b8a9360d3544264e5173813e5267d9f49c4d Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Thu, 20 Jul 2023 23:30:37 +1000 Subject: [PATCH 3/8] Added version range for Qt 5 to 6 --- recipes/qwt/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index e18a91d17ac4d..8ae14c64867d3 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -63,7 +63,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) + self.requires("qt/[>=5.15.11 <7]", transitive_headers=True, transitive_libs=True) def validate(self): if hasattr(self, "settings_build") and cross_building(self): From b4c1d6b5c6f61af29bc1392e5dc48ed246cabad4 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Sun, 6 Aug 2023 15:22:52 +1000 Subject: [PATCH 4/8] Updated test_package and test_v1_package to work with both QT 5 & 6 --- recipes/qwt/all/test_package/CMakeLists.txt | 18 +++++++++++++++--- recipes/qwt/all/test_package/conanfile.py | 9 +++++++-- recipes/qwt/all/test_v1_package/conanfile.py | 1 + 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/recipes/qwt/all/test_package/CMakeLists.txt b/recipes/qwt/all/test_package/CMakeLists.txt index 162eed68d6d65..d5a8d01533449 100644 --- a/recipes/qwt/all/test_package/CMakeLists.txt +++ b/recipes/qwt/all/test_package/CMakeLists.txt @@ -2,11 +2,23 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) find_package(qwt REQUIRED CONFIG) -find_package(Qt5 REQUIRED Core CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE qwt::qwt Qt5::Core) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(QT_VERSION VERSION_GREATER_EQUAL "6.0.0") + find_package(Qt6 REQUIRED COMPONENTS Core CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core) + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +elseif(QT_VERSION VERSION_GREATER_EQUAL "5.0.0") + find_package(Qt5 COMPONENTS Core REQUIRED CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core) + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +else() + message(FATAL_ERROR "Qt < 5 is not supported by this recipe") +endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE qwt::qwt) + if(NOT WIN32) # Must compile with "-fPIC" since Qt was built with -reduce-relocations. target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) diff --git a/recipes/qwt/all/test_package/conanfile.py b/recipes/qwt/all/test_package/conanfile.py index 0a6bc68712d90..b6d943f1299fb 100644 --- a/recipes/qwt/all/test_package/conanfile.py +++ b/recipes/qwt/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,6 +15,11 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QT_VERSION"] = self.dependencies["qt"].ref.version + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/qwt/all/test_v1_package/conanfile.py b/recipes/qwt/all/test_v1_package/conanfile.py index 38f4483872d47..01fb26698dd0b 100644 --- a/recipes/qwt/all/test_v1_package/conanfile.py +++ b/recipes/qwt/all/test_v1_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["QT_VERSION"] = self.deps_cpp_info["qt"].version cmake.configure() cmake.build() From 5e1249050fe333d095a5e625078b93ab0238bd45 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Fri, 8 Mar 2024 10:41:29 +1100 Subject: [PATCH 5/8] Improved virtual environment setup --- recipes/qwt/all/conanfile.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 8ae14c64867d3..2d2a028e38c75 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -86,12 +86,8 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - if self._is_legacy_one_profile: - env = VirtualRunEnv(self) - env.generate(scope="build") - else: - env = VirtualBuildEnv(self) - env.generate() + VirtualBuildEnv(self).generate() + VirtualRunEnv(self).generate(scope="build") tc = CMakeToolchain(self) tc.variables["QWT_DLL"] = self.options.shared From 1ab3b7ef7e4b3d8f55c435e2b61109e7ecc7bcf9 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Mon, 25 Mar 2024 19:12:49 +1100 Subject: [PATCH 6/8] Switch to fixed version for Qt requirement --- recipes/qwt/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 2d2a028e38c75..2437af58c4d2b 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -63,7 +63,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/[>=5.15.11 <7]", transitive_headers=True, transitive_libs=True) + self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) def validate(self): if hasattr(self, "settings_build") and cross_building(self): From dc099c430851354609fcf9cd7ef11e74645eb9d2 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Mon, 25 Mar 2024 19:13:13 +1100 Subject: [PATCH 7/8] Added check for Qt version --- recipes/qwt/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 2437af58c4d2b..e8a240189ee17 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -66,6 +66,9 @@ def requirements(self): self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) def validate(self): + qt_version = Version(self.dependencies["qt"].ref.version) + if not 5 <= qt_version.major <= 6: + raise ConanInvalidConfiguration(f"{self.name} doesn't support Qt/{qt_version}. Allowed Qt version are 5 or 6") if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Qwt recipe does not support cross-compilation yet") qt_options = self.dependencies["qt"].options From bd5d392fdd6be13eeaa7220e84cfe89d58c96341 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Tue, 1 Oct 2024 15:16:32 +1000 Subject: [PATCH 8/8] Force qwt to use given version of Qt --- recipes/qwt/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index e8a240189ee17..5a6b76d4f1501 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -93,6 +93,7 @@ def generate(self): VirtualRunEnv(self).generate(scope="build") tc = CMakeToolchain(self) + tc.variables["QWT_QT_VERSION_MAJOR"] = Version(self.dependencies["qt"].ref.version).major tc.variables["QWT_DLL"] = self.options.shared tc.variables["QWT_STATIC"] = not self.options.shared tc.variables["QWT_PLOT"] = self.options.plot