diff --git a/recipes/qcoro/all/CMakeLists.txt b/recipes/qcoro/all/CMakeLists.txt deleted file mode 100644 index 434aea21733de..0000000000000 --- a/recipes/qcoro/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/qcoro/all/conandata.yml b/recipes/qcoro/all/conandata.yml index f303943d3a6a1..4ba418ce8f5c5 100644 --- a/recipes/qcoro/all/conandata.yml +++ b/recipes/qcoro/all/conandata.yml @@ -2,3 +2,10 @@ sources: "0.4.0": url: "https://github.com/danvratil/qcoro/archive/refs/tags/v0.4.0.tar.gz" sha256: "0e68b3f0ce7bf521ffbdd731464d2d60d8d7a39a749b551ed26855a1707d86d1" + "0.8.0": + url: "https://github.com/danvratil/qcoro/archive/refs/tags/v0.8.0.tar.gz" + sha256: "28F90D817F42352084242F7A1FF090C5CFF92359E4DBECEA8F04D39EBCF630F8" +patches: + "0.8.0": + - patch_file: "patches/0001-Make-how-Qt-packages-are-found-more-convinient.patch" + - patch_file: "patches/0002-Fix-debug-build-against-MSVC2022.patch" diff --git a/recipes/qcoro/all/conanfile.py b/recipes/qcoro/all/conanfile.py index 75c84c084c061..9c9f54ab57c69 100644 --- a/recipes/qcoro/all/conanfile.py +++ b/recipes/qcoro/all/conanfile.py @@ -1,5 +1,10 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import tools +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version import os required_conan_version = ">=1.33.0" @@ -23,17 +28,10 @@ class QCoroConan(ConanFile): "fPIC": True, "asan": False, } - generators = "cmake", "cmake_find_package_multi" - exports_sources = ["CMakeLists.txt"] _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) @property def _compilers_minimum_version(self): @@ -55,10 +53,13 @@ def configure(self): del self.options.fPIC def build_requirements(self): - self.build_requires("cmake/3.23.2") + self.build_requires("cmake/3.26.4") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/6.3.1") + self.requires("qt/6.5.0") def validate(self): if self.settings.compiler.cppstd: @@ -70,7 +71,7 @@ def lazy_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - #Special check for clang that can only be linked to libc++ + # Special check for clang that can only be linked to libc++ if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++": raise ConanInvalidConfiguration("imagl requires some C++20 features, which are available in libc++ for clang compiler.") @@ -85,31 +86,36 @@ def lazy_lt_semver(v1, v2): print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - - self._cmake.definitions["QCORO_BUILD_EXAMPLES"] = False - self._cmake.definitions["QCORO_ENABLE_ASAN"] = self.options.asan - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["QCORO_WITH_QTDBUS"] = self.options["qt"].with_dbus - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_QT_VERSION"] = Version(self.deps_cpp_info["qt"].version).major + tc.variables["QCORO_BUILD_EXAMPLES"] = False + tc.variables["QCORO_DISABLE_DEPRECATED_TASK_H"] = True + tc.variables["QCORO_ENABLE_ASAN"] = self.options.asan + tc.variables["BUILD_TESTING"] = False + tc.variables["QCORO_WITH_QTDBUS"] = self.options["qt"].with_dbus + tc.variables["QCORO_WITH_QTQUICK"] = False + tc.variables["QCORO_WITH_QML"] = False + tc.variables["QCORO_WITH_QTWEBSOCKETS"] = False + tc.variables["QCORO_EXCEPTION_MESSAGE_PRINT"] = True + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("*", dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + self.copy("*", dst="licenses", src=os.path.join(self.source_folder, "LICENSES")) + cmake = CMake(self) cmake.install() for mask in ["Find*.cmake", "*Config*.cmake", "*-config.cmake", "*Targets*.cmake"]: diff --git a/recipes/qcoro/all/patches/0001-Make-how-Qt-packages-are-found-more-convinient.patch b/recipes/qcoro/all/patches/0001-Make-how-Qt-packages-are-found-more-convinient.patch new file mode 100644 index 0000000000000..eac234c1234e9 --- /dev/null +++ b/recipes/qcoro/all/patches/0001-Make-how-Qt-packages-are-found-more-convinient.patch @@ -0,0 +1,39 @@ +From 49b27a7dd26044a027a56fdc1247da154da3c01c Mon Sep 17 00:00:00 2001 +From: Paul T +Date: Thu, 6 Apr 2023 15:16:41 -0400 +Subject: [PATCH] Make how Qt packages are found more convinient + +This change allows users to specify `Qt5_DIR` or `Qt6_DIR` and then the rest of the components are automatically found. Prior to this, since `find_package()` was called for each component of Qt, CMake configuring would fail with each component not found. So you would have to specify all the paths at once. +--- + cmake/QCoroFindQt.cmake | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +diff --git a/cmake/QCoroFindQt.cmake b/cmake/QCoroFindQt.cmake +index 9bda234..9951b02 100644 +--- a/cmake/QCoroFindQt.cmake ++++ b/cmake/QCoroFindQt.cmake +@@ -12,17 +12,11 @@ macro(qcoro_find_qt) + set(ARGS_QT_VERSION 5) + endif() + endif() ++ ++ list(APPEND REQUIRED_QT_COMPONENTS "${ARGS_QT${ARGS_QT_VERSION}_COMPONENTS}") ++ list(FILTER REQUIRED_QT_COMPONENTS EXCLUDE REGEX "Private$$") + +- foreach (component IN LISTS ARGS_COMPONENTS ARGS_QT${ARGS_QT_VERSION}_COMPONENTS) +- message(STATUS "Qt component: ${component}") +- if ("${component}" MATCHES "Private$$") +- string(REPLACE "Private" "" base_component "${component}") +- find_package(Qt${ARGS_QT_VERSION}${base_component} REQUIRED COMPONENTS Private) +- else() +- find_package(Qt${ARGS_QT_VERSION}${component} REQUIRED) +- endif() +- endforeach() ++ find_package(Qt${ARGS_QT_VERSION} REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS}) + + set(${ARGS_FOUND_VER_VAR} ${ARGS_QT_VERSION}) + endmacro() +- +-- +2.39.2 + diff --git a/recipes/qcoro/all/patches/0002-Fix-debug-build-against-MSVC2022.patch b/recipes/qcoro/all/patches/0002-Fix-debug-build-against-MSVC2022.patch new file mode 100644 index 0000000000000..ce835b0430e42 --- /dev/null +++ b/recipes/qcoro/all/patches/0002-Fix-debug-build-against-MSVC2022.patch @@ -0,0 +1,44 @@ +From 1e6c27128c452a631ac486cb8f8d02d4bc1167aa Mon Sep 17 00:00:00 2001 +From: Robert Griebl +Date: Mon, 6 Mar 2023 13:27:24 +0100 +Subject: [PATCH] Fix debug build against MSVC2022 + +Due to the level-4 warnings and warnings-are-errors in debug builds, +we are running into warnings in Qt's private headers and an unused +warning for the "args" pack in invokeCb() +--- + qcoro/qcorotask.h | 2 +- + qcoro/qml/qcoroqmltask.cpp | 3 +++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/qcoro/qcorotask.h b/qcoro/qcorotask.h +index 26f3e7b..1d1e87a 100644 +--- a/qcoro/qcorotask.h ++++ b/qcoro/qcorotask.h +@@ -581,7 +581,7 @@ public: + + private: + template +- auto invokeCb(ThenCallback &&callback, Args && ... args) { ++ auto invokeCb(ThenCallback &&callback, [[maybe_unused]] Args && ... args) { + if constexpr (std::is_invocable_v) { + return callback(std::forward(args) ...); + } else { +diff --git a/qcoro/qml/qcoroqmltask.cpp b/qcoro/qml/qcoroqmltask.cpp +index 48136d6..f859cae 100644 +--- a/qcoro/qml/qcoroqmltask.cpp ++++ b/qcoro/qml/qcoroqmltask.cpp +@@ -9,7 +9,10 @@ + #include + + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) ++QT_WARNING_PUSH ++QT_WARNING_DISABLE_MSVC(4458 4201) + #include ++QT_WARNING_POP + #endif + + Q_DECLARE_LOGGING_CATEGORY(qcoroqml) +-- +2.39.2 + diff --git a/recipes/qcoro/all/test_package/conanfile.py b/recipes/qcoro/all/test_package/conanfile.py index 93bd98dd9415a..299712f3db228 100644 --- a/recipes/qcoro/all/test_package/conanfile.py +++ b/recipes/qcoro/all/test_package/conanfile.py @@ -9,7 +9,7 @@ class TestPackageConan(ConanFile): generators = "cmake", "cmake_find_package" def build_requirements(self): - self.build_requires("cmake/3.23.2") + self.build_requires("cmake/3.26.4") def build(self): cmake = CMake(self) diff --git a/recipes/qcoro/config.yml b/recipes/qcoro/config.yml index af29e78bd9b25..329cdf9d2b167 100644 --- a/recipes/qcoro/config.yml +++ b/recipes/qcoro/config.yml @@ -1,3 +1,5 @@ versions: "0.4.0": folder: all + "0.8.0": + folder: all