From 64aba482ce1f61b7746b052373907c7d3a15aefd Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 19 Feb 2024 23:30:15 +0900 Subject: [PATCH] (#22764) libcoro: add version 0.11.1 * libcoro: add version 0.11 * relax compiler checks * update to version 0.11.1 Signed-off-by: Uilian Ries * require newer compilers Signed-off-by: Uilian Ries * update config Signed-off-by: Uilian Ries * Update recipes/libcoro/all/conanfile.py * fix library name on Windows Signed-off-by: Uilian Ries * some options are not available on Windows Signed-off-by: Uilian Ries * typo Signed-off-by: Uilian Ries * disable shared Signed-off-by: Uilian Ries * set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS * revert CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS * manage shared option Signed-off-by: Uilian Ries --------- Signed-off-by: Uilian Ries Co-authored-by: Uilian Ries --- recipes/libcoro/all/conandata.yml | 15 ++----- recipes/libcoro/all/conanfile.py | 42 +++++++++++++------ .../patches/0.10-0001-allow-shared-lib.patch | 13 ------ .../patches/0.7-0001-allow-shared-lib.patch | 9 ---- .../patches/0.8-0001-allow-shared-lib.patch | 13 ------ .../patches/0.9-0001-allow-shared-lib.patch | 13 ------ recipes/libcoro/config.yml | 2 + 7 files changed, 35 insertions(+), 72 deletions(-) delete mode 100644 recipes/libcoro/all/patches/0.10-0001-allow-shared-lib.patch delete mode 100644 recipes/libcoro/all/patches/0.7-0001-allow-shared-lib.patch delete mode 100644 recipes/libcoro/all/patches/0.8-0001-allow-shared-lib.patch delete mode 100644 recipes/libcoro/all/patches/0.9-0001-allow-shared-lib.patch diff --git a/recipes/libcoro/all/conandata.yml b/recipes/libcoro/all/conandata.yml index 2ae02b6941d0a..1587140b431f7 100644 --- a/recipes/libcoro/all/conandata.yml +++ b/recipes/libcoro/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.11.1": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.11.1.tar.gz" + sha256: "c7eb1bf133519ec0e0bc2e3e018ac4d1447a143e5e7385dab19204277d7c7671" "0.10": url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.10.tar.gz" sha256: "0e952e72012925b75910f80772f3642dac631644578dbbc0db4fee047badc745" @@ -13,17 +16,11 @@ sources: sha256: "ce1f3f1c4fa21b53d1cd195a29bd5a2313e53aa35637b402db04207d02316e51" patches: "0.10": - - patch_file: "patches/0.10-0001-allow-shared-lib.patch" - patch_type: "conan" - patch_description: "Allow to build the library as a shared library" - patch_file: "patches/0.10-0002-disable-git-config.patch" patch_type: "official" patch_description: "Comment out invocation of git config command" patch_source: "https://github.com/jbaldwin/libcoro/pull/234" "0.9": - - patch_file: "patches/0.9-0001-allow-shared-lib.patch" - patch_type: "conan" - patch_description: "Allow to build the library as a shared library" - patch_file: "patches/0.9-0002-disable-git-config.patch" patch_type: "conan" patch_description: "Comment out invocation of git config command" @@ -32,16 +29,10 @@ patches: patch_source: "https://github.com/jbaldwin/libcoro/pull/169" patch_description: "include std headers" "0.8": - - patch_file: "patches/0.8-0001-allow-shared-lib.patch" - patch_type: "conan" - patch_description: "Allow to build the library as a shared library" - patch_file: "patches/0.8-0002-disable-git-config.patch" patch_type: "conan" patch_description: "Comment out invocation of git config command" "0.7": - - patch_file: "patches/0.7-0001-allow-shared-lib.patch" - patch_type: "conan" - patch_description: "Allow to build the library as a shared library" - patch_file: "patches/0.7-0002-disable-git-config.patch" patch_type: "conan" patch_description: "Comment out invocation of git config command" diff --git a/recipes/libcoro/all/conanfile.py b/recipes/libcoro/all/conanfile.py index 7873b320afe48..60b120e4f9dc5 100644 --- a/recipes/libcoro/all/conanfile.py +++ b/recipes/libcoro/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd +from conan.tools.microsoft import is_msvc from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version @@ -40,8 +41,12 @@ def _min_cppstd(self): @property def _minimum_compilers_version(self): return { - "gcc": "10.2.1", - } + "gcc": "10.2.1", + "clang": "16.0.0", + "apple-clang": "16", + "Visual Studio": "16", + "msvc": "192", + } def export_sources(self): export_conandata_patches(self) @@ -54,10 +59,15 @@ def config_options(self): if Version(self.version) < "0.9": del self.options.with_ssl del self.options.with_threading + if is_msvc(self) or self.settings.os == "Emscripten": + self.options.rm_safe("with_networking") + self.options.rm_safe("with_ssl") def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + if Version(self.version) < "0.11": + self.package_type = "static-library" def layout(self): cmake_layout(self, src_folder="src") @@ -71,10 +81,11 @@ def requirements(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: - raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") - if self.settings.compiler != "gcc": - raise ConanInvalidConfiguration(f"The Conan recipe {self.ref} only supports GCC for now. Contributions are welcome!") + if Version(self.version) < "0.10": + if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration(f"The Conan recipe {self.ref} only supports GCC for now. Contributions are welcome!") minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if minimum_version and Version(self.settings.compiler.version) < minimum_version: @@ -82,6 +93,9 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) + if Version(self.version) < "0.11" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} Only supports shared linking for versions >=0.11") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -91,10 +105,14 @@ def generate(self): tc.variables["LIBCORO_BUILD_EXAMPLES"] = False if Version(self.version) >= "0.8": tc.variables["LIBCORO_EXTERNAL_DEPENDENCIES"] = True - tc.variables["LIBCORO_FEATURE_NETWORKING"] = self.options.with_networking + tc.variables["LIBCORO_FEATURE_NETWORKING"] = self.options.get_safe("with_networking") if Version(self.version) >= "0.9": tc.variables["LIBCORO_FEATURE_THREADING"] = self.options.with_threading - tc.variables["LIBCORO_FEATURE_SSL"] = self.options.with_ssl + tc.variables["LIBCORO_FEATURE_SSL"] = self.options.get_safe("with_ssl", False) + if Version(self.version) >= "0.11": + tc.variables["LIBCORO_RUN_GITCONFIG"] = False + tc.variables["LIBCORO_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["LIBCORO_FEATURE_TLS"] = self.options.get_safe("with_ssl", False) tc.generate() deps = CMakeDeps(self) deps.generate() @@ -115,16 +133,16 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "libcoro") self.cpp_info.set_property("cmake_target_name", "libcoro::libcoro") if Version(self.version) >= "0.8": - self.cpp_info.libs = ["coro"] + self.cpp_info.libs = ["libcoro"] if is_msvc(self) else ["coro"] else: self.cpp_info.libs = ["libcoro"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] if Version(self.version) >= "0.9": - if self.options.with_networking: + if self.options.get_safe("with_networking"): self.cpp_info.defines.append("LIBCORO_FEATURE_NETWORKING") - if self.options.with_ssl: - self.cpp_info.defines.append("LIBCORO_FEATURE_SSL") + if self.options.get_safe("with_ssl"): + self.cpp_info.defines.extend(["LIBCORO_FEATURE_SSL", "LIBCORO_FEATURE_TLS"]) if self.options.with_threading: self.cpp_info.defines.append("LIBCORO_FEATURE_THREADING") diff --git a/recipes/libcoro/all/patches/0.10-0001-allow-shared-lib.patch b/recipes/libcoro/all/patches/0.10-0001-allow-shared-lib.patch deleted file mode 100644 index 8eb0ed04c1cfc..0000000000000 --- a/recipes/libcoro/all/patches/0.10-0001-allow-shared-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b749c11..7398569 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -123,7 +123,7 @@ if(DEFINED EMSCRIPTEN) - add_link_options(-sEXIT_RUNTIME) - endif() - --add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) -+add_library(${PROJECT_NAME} ${LIBCORO_SOURCE_FILES}) - set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX PREFIX "") - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) - target_include_directories(${PROJECT_NAME} PUBLIC include) diff --git a/recipes/libcoro/all/patches/0.7-0001-allow-shared-lib.patch b/recipes/libcoro/all/patches/0.7-0001-allow-shared-lib.patch deleted file mode 100644 index 9c3ca8de19231..0000000000000 --- a/recipes/libcoro/all/patches/0.7-0001-allow-shared-lib.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -69,4 +69,4 @@ - ) - --add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) -+add_library(${PROJECT_NAME} ${LIBCORO_SOURCE_FILES}) - set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) diff --git a/recipes/libcoro/all/patches/0.8-0001-allow-shared-lib.patch b/recipes/libcoro/all/patches/0.8-0001-allow-shared-lib.patch deleted file mode 100644 index 0481b258f7f9a..0000000000000 --- a/recipes/libcoro/all/patches/0.8-0001-allow-shared-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f37206b..8221a5d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -91,7 +91,7 @@ if(LIBCORO_FEATURE_NETWORKING) - ) - endif() - --add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) -+add_library(${PROJECT_NAME} ${LIBCORO_SOURCE_FILES}) - set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX PREFIX "") - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) - target_include_directories(${PROJECT_NAME} PUBLIC inc) diff --git a/recipes/libcoro/all/patches/0.9-0001-allow-shared-lib.patch b/recipes/libcoro/all/patches/0.9-0001-allow-shared-lib.patch deleted file mode 100644 index 4838c6103aa0f..0000000000000 --- a/recipes/libcoro/all/patches/0.9-0001-allow-shared-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ef0eea4..4c342e3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -110,7 +110,7 @@ if(LIBCORO_FEATURE_NETWORKING) - endif() - endif() - --add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) -+add_library(${PROJECT_NAME} ${LIBCORO_SOURCE_FILES}) - set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX PREFIX "") - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) - target_include_directories(${PROJECT_NAME} PUBLIC inc) diff --git a/recipes/libcoro/config.yml b/recipes/libcoro/config.yml index 5808152f9189f..a682e35c6d452 100644 --- a/recipes/libcoro/config.yml +++ b/recipes/libcoro/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.1": + folder: all "0.10": folder: all "0.9":