diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 948067d576e19..05e8a3e45cfa1 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake -from conan.tools.files import copy, get, apply_conandata_patches, rmdir +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rmdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class DrogonConan(ConanFile): name = "drogon" @@ -46,8 +46,7 @@ class DrogonConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,7 +54,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["trantor"].shared = True if not self.options.with_orm: del self.options.with_postgres @@ -66,26 +65,39 @@ def configure(self): elif not self.options.with_postgres: del self.options.with_postgres_batch + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "1.8.2" else 17 + @property def _compilers_minimum_version(self): - return { - "Visual Studio": "15" if Version(self.version) < "1.8.2" else "16", - "msvc": "191" if Version(self.version) < "1.8.2" else "192", - "gcc": "6", - "clang": "5", - "apple-clang": "10", - } + if Version(self.version) < "1.8.2": + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "clang": "5", + "apple-clang": "10", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: if Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def requirements(self): self.requires("trantor/1.5.8") @@ -97,7 +109,7 @@ def requirements(self): if self.options.with_profile: self.requires("coz/cci.20210322") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("with_postgres"): @@ -154,7 +166,7 @@ def package_info(self): if self.options.with_ctl: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) self.cpp_info.set_property("cmake_file_name", "Drogon") diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index 196b33faabaf7..cf16e9b501eaa 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -8,7 +8,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon) # drogon uses string_view when MSVC_VERSION is greater than 1900. # https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 -if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) +if((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) OR Drogon_VERSION VERSION_GREATER_EQUAL "1.8.2") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)