From 2a8ab79ab767769e6770d4750900a3a56bb8419a Mon Sep 17 00:00:00 2001 From: idealvin Date: Sun, 3 Oct 2021 18:25:08 +0800 Subject: [PATCH 01/30] add package co --- recipes/co/all/CMakeLists.txt | 7 ++ recipes/co/all/conandata.yml | 4 + recipes/co/all/conanfile.py | 86 ++++++++++++++++++++++ recipes/co/all/test_package/CMakeLists.txt | 8 ++ recipes/co/all/test_package/conanfile.py | 17 +++++ recipes/co/all/test_package/test_package.c | 80 ++++++++++++++++++++ recipes/co/config.yml | 3 + 7 files changed, 205 insertions(+) create mode 100644 recipes/co/all/CMakeLists.txt create mode 100644 recipes/co/all/conandata.yml create mode 100644 recipes/co/all/conanfile.py create mode 100644 recipes/co/all/test_package/CMakeLists.txt create mode 100644 recipes/co/all/test_package/conanfile.py create mode 100644 recipes/co/all/test_package/test_package.c create mode 100644 recipes/co/config.yml diff --git a/recipes/co/all/CMakeLists.txt b/recipes/co/all/CMakeLists.txt new file mode 100644 index 0000000000000..bd4164cb5c1c7 --- /dev/null +++ b/recipes/co/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.10) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/co/all/conandata.yml b/recipes/co/all/conandata.yml new file mode 100644 index 0000000000000..fcfcc7f2cc474 --- /dev/null +++ b/recipes/co/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.0.2": + url: "https://github.com/idealvin/co/archive/refs/tags/v2.0.2.tar.gz" + sha256: "b5fecc4e0556e33ae11ac2b7c80e37add6cc9d32942e48ce65593f09aa3ef35b" \ No newline at end of file diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py new file mode 100644 index 0000000000000..2033af25d1415 --- /dev/null +++ b/recipes/co/all/conanfile.py @@ -0,0 +1,86 @@ +import os +from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.33.0" + + +class CoConan(ConanFile): + name = "co" + description = "A go-style coroutine library in C++11 and more." + topics = ("conan", "co", "coroutine", "c++11") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/idealvin/co" + license = "MIT" + exports_sources = ["CMakeLists.txt"] + generators = "cmake" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libcurl": [True, False], + "with_openssl": [True, False], + "static_vs_crt": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libcurl": False, + "with_openssl": False, + "static_vs_crt": True, + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + if self.options.with_openssl: + self.requires("openssl/1.1.0") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + strip_root=True, destination=self._source_subfolder) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared + if not self.options.shared + self._cmake.definitions["FPIC"] = self.options.fPIC + self._cmake.definitions["STATIC_VS_CRT"] = self.options.static_vs_crt + self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl + self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.names["cmake_find_package"] = "CO" + self.cpp_info.names["cmake_find_package_multi"] = "CO" diff --git a/recipes/co/all/test_package/CMakeLists.txt b/recipes/co/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b9b613cbb24a --- /dev/null +++ b/recipes/co/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/co/all/test_package/conanfile.py b/recipes/co/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ea57a464900be --- /dev/null +++ b/recipes/co/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/co/all/test_package/test_package.c b/recipes/co/all/test_package/test_package.c new file mode 100644 index 0000000000000..11578ead7a9fb --- /dev/null +++ b/recipes/co/all/test_package/test_package.c @@ -0,0 +1,80 @@ +#include +#include + +#include +#include +#include + +unsigned long szip_decoding(int bits_per_pixel, char *in, long size, char *out, long out_size, long buffer_size) { + int bytes_per_pixel; + int err; + sz_stream d_stream; + + strcpy((char*)out, "garbage"); + + d_stream.hidden = 0; + + d_stream.next_in = in; + d_stream.next_out = out; + + d_stream.avail_in = 0; + d_stream.avail_out = 0; + + d_stream.total_in = 0; + d_stream.total_out = 0; + + d_stream.options_mask = SZ_RAW_OPTION_MASK | SZ_NN_OPTION_MASK | SZ_MSB_OPTION_MASK; + d_stream.bits_per_pixel = bits_per_pixel; + d_stream.pixels_per_block = 8; + d_stream.pixels_per_scanline = 16; + + bytes_per_pixel = (bits_per_pixel + 7)/8; + if (bytes_per_pixel == 3) bytes_per_pixel = 4; + + d_stream.image_pixels = out_size/bytes_per_pixel; + + err = SZ_DecompressInit(&d_stream); + if (err != SZ_OK) { + fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); + exit(0); + } + + while (d_stream.total_in < size) { + d_stream.avail_in = d_stream.avail_out = buffer_size; + if (d_stream.avail_in + d_stream.total_in > size) + d_stream.avail_in = size - d_stream.total_in; + + err = SZ_Decompress(&d_stream, SZ_NO_FLUSH); + if (err == SZ_STREAM_END) break; + + if (err != SZ_OK) { + fprintf(stderr, "SZ_Decompress error: %d\n", err); + exit(0); + } + } + + while (d_stream.total_out < out_size) { + d_stream.avail_out = buffer_size; + err = SZ_Decompress(&d_stream, SZ_FINISH); + if (err == SZ_STREAM_END) break; + + if (err != SZ_OK) { + fprintf(stderr, "SZ_Decompress error: %d\n", err); + exit(0); + } + } + + err = SZ_DecompressEnd(&d_stream); + if (err != SZ_OK) { + fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); + exit(0); + } + + return d_stream.total_out; +} + +int main() { + char *out = (char *) malloc(1024*1024L); + unsigned long size = szip_decoding(8, NULL, 0, out, 0, 1); + return 0; +} diff --git a/recipes/co/config.yml b/recipes/co/config.yml new file mode 100644 index 0000000000000..5df97e2cc232e --- /dev/null +++ b/recipes/co/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.2": + folder: all From 16583bf39fbaea11757b82402b85ca258884dc37 Mon Sep 17 00:00:00 2001 From: idealvin Date: Sun, 3 Oct 2021 19:01:27 +0800 Subject: [PATCH 02/30] update test package for co --- recipes/co/all/test_package/CMakeLists.txt | 5 +- recipes/co/all/test_package/test_package.c | 80 --------------------- recipes/co/all/test_package/test_package.cc | 7 ++ 3 files changed, 10 insertions(+), 82 deletions(-) delete mode 100644 recipes/co/all/test_package/test_package.c create mode 100644 recipes/co/all/test_package/test_package.cc diff --git a/recipes/co/all/test_package/CMakeLists.txt b/recipes/co/all/test_package/CMakeLists.txt index 7b9b613cbb24a..aebddd76b5b21 100644 --- a/recipes/co/all/test_package/CMakeLists.txt +++ b/recipes/co/all/test_package/CMakeLists.txt @@ -1,8 +1,9 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) +set(CMAKE_CXX_STANDARD 11) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_executable(${PROJECT_NAME} test_package.c) +add_executable(${PROJECT_NAME} test_package.cc) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/co/all/test_package/test_package.c b/recipes/co/all/test_package/test_package.c deleted file mode 100644 index 11578ead7a9fb..0000000000000 --- a/recipes/co/all/test_package/test_package.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include - -#include -#include -#include - -unsigned long szip_decoding(int bits_per_pixel, char *in, long size, char *out, long out_size, long buffer_size) { - int bytes_per_pixel; - int err; - sz_stream d_stream; - - strcpy((char*)out, "garbage"); - - d_stream.hidden = 0; - - d_stream.next_in = in; - d_stream.next_out = out; - - d_stream.avail_in = 0; - d_stream.avail_out = 0; - - d_stream.total_in = 0; - d_stream.total_out = 0; - - d_stream.options_mask = SZ_RAW_OPTION_MASK | SZ_NN_OPTION_MASK | SZ_MSB_OPTION_MASK; - d_stream.bits_per_pixel = bits_per_pixel; - d_stream.pixels_per_block = 8; - d_stream.pixels_per_scanline = 16; - - bytes_per_pixel = (bits_per_pixel + 7)/8; - if (bytes_per_pixel == 3) bytes_per_pixel = 4; - - d_stream.image_pixels = out_size/bytes_per_pixel; - - err = SZ_DecompressInit(&d_stream); - if (err != SZ_OK) { - fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); - exit(0); - } - - while (d_stream.total_in < size) { - d_stream.avail_in = d_stream.avail_out = buffer_size; - if (d_stream.avail_in + d_stream.total_in > size) - d_stream.avail_in = size - d_stream.total_in; - - err = SZ_Decompress(&d_stream, SZ_NO_FLUSH); - if (err == SZ_STREAM_END) break; - - if (err != SZ_OK) { - fprintf(stderr, "SZ_Decompress error: %d\n", err); - exit(0); - } - } - - while (d_stream.total_out < out_size) { - d_stream.avail_out = buffer_size; - err = SZ_Decompress(&d_stream, SZ_FINISH); - if (err == SZ_STREAM_END) break; - - if (err != SZ_OK) { - fprintf(stderr, "SZ_Decompress error: %d\n", err); - exit(0); - } - } - - err = SZ_DecompressEnd(&d_stream); - if (err != SZ_OK) { - fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); - exit(0); - } - - return d_stream.total_out; -} - -int main() { - char *out = (char *) malloc(1024*1024L); - unsigned long size = szip_decoding(8, NULL, 0, out, 0, 1); - return 0; -} diff --git a/recipes/co/all/test_package/test_package.cc b/recipes/co/all/test_package/test_package.cc new file mode 100644 index 0000000000000..065f84840aa88 --- /dev/null +++ b/recipes/co/all/test_package/test_package.cc @@ -0,0 +1,7 @@ +#include "co/str.h" +#include + +int main(int argc, char** argv) { + std::cout << str::from(123) << std::endl; + return 0; +} From be79f6bd1e3af894dda5fb0cfd6e1ea34f8d0e27 Mon Sep 17 00:00:00 2001 From: idealvin Date: Tue, 5 Oct 2021 19:23:16 +0800 Subject: [PATCH 03/30] fix typo --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 2033af25d1415..9ea6bc73899ea 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -67,7 +67,7 @@ def _configure_cmake(self): return self._cmake self._cmake = CMake(self) self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - if not self.options.shared + if not self.options.shared: self._cmake.definitions["FPIC"] = self.options.fPIC self._cmake.definitions["STATIC_VS_CRT"] = self.options.static_vs_crt self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl From c9d93629232a4798c2f5ddffb8a7b994377b4f2c Mon Sep 17 00:00:00 2001 From: idealvin Date: Thu, 7 Oct 2021 19:32:02 +0800 Subject: [PATCH 04/30] add patch file and fix ci error --- recipes/co/all/conandata.yml | 6 +++++- recipes/co/all/patches/001-install-dll.patch | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 recipes/co/all/patches/001-install-dll.patch diff --git a/recipes/co/all/conandata.yml b/recipes/co/all/conandata.yml index fcfcc7f2cc474..9e3f30dfa8bb6 100644 --- a/recipes/co/all/conandata.yml +++ b/recipes/co/all/conandata.yml @@ -1,4 +1,8 @@ sources: "2.0.2": url: "https://github.com/idealvin/co/archive/refs/tags/v2.0.2.tar.gz" - sha256: "b5fecc4e0556e33ae11ac2b7c80e37add6cc9d32942e48ce65593f09aa3ef35b" \ No newline at end of file + sha256: "b5fecc4e0556e33ae11ac2b7c80e37add6cc9d32942e48ce65593f09aa3ef35b" +patches: + "2.0.2": + - patch_file: "patches/001-install-dll.patch" + base_path: "source_subfolder" diff --git a/recipes/co/all/patches/001-install-dll.patch b/recipes/co/all/patches/001-install-dll.patch new file mode 100644 index 0000000000000..9332f3296762e --- /dev/null +++ b/recipes/co/all/patches/001-install-dll.patch @@ -0,0 +1,10 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9e03c9a..499b550 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -112,4 +112,5 @@ install( + TARGETS co + LIBRARY DESTINATION lib # shared lib installed to ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION lib # static lib installed to ${CMAKE_INSTALL_PREFIX}/lib ++ RUNTIME DESTINATION bin + ) From 0fd268bfd2d55c73ecfea873700d06e44ba4785d Mon Sep 17 00:00:00 2001 From: idealvin Date: Thu, 7 Oct 2021 20:03:23 +0800 Subject: [PATCH 05/30] remove topic conan --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 9ea6bc73899ea..28d4b8fbd01de 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -7,7 +7,7 @@ class CoConan(ConanFile): name = "co" description = "A go-style coroutine library in C++11 and more." - topics = ("conan", "co", "coroutine", "c++11") + topics = ("co", "coroutine", "c++11") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/idealvin/co" license = "MIT" From 13f93714ed87b285a90596b7e8822f7d2c12dd11 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:45:50 +0800 Subject: [PATCH 06/30] Update recipes/co/all/test_package/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/test_package/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/co/all/test_package/conanfile.py b/recipes/co/all/test_package/conanfile.py index ea57a464900be..4903f1a7e8fa0 100644 --- a/recipes/co/all/test_package/conanfile.py +++ b/recipes/co/all/test_package/conanfile.py @@ -1,6 +1,5 @@ -import os - from conans import ConanFile, CMake, tools +import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" From cfd6c40ca04e70d52ac35020b39eb6ddb24c7506 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:46:01 +0800 Subject: [PATCH 07/30] Update recipes/co/all/test_package/test_package.cc Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/test_package/test_package.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/test_package/test_package.cc b/recipes/co/all/test_package/test_package.cc index 065f84840aa88..46b92d23f6830 100644 --- a/recipes/co/all/test_package/test_package.cc +++ b/recipes/co/all/test_package/test_package.cc @@ -1,7 +1,7 @@ #include "co/str.h" #include -int main(int argc, char** argv) { +int main() { std::cout << str::from(123) << std::endl; return 0; } From ceca037677fa9d4f2fe8a71a29d1d3f6e16565b2 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:46:15 +0800 Subject: [PATCH 08/30] Update recipes/co/all/test_package/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/test_package/conanfile.py b/recipes/co/all/test_package/conanfile.py index 4903f1a7e8fa0..fdb9f346a1da9 100644 --- a/recipes/co/all/test_package/conanfile.py +++ b/recipes/co/all/test_package/conanfile.py @@ -11,6 +11,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 29eb58a73f87104a16a34b2cddaab23354e8c342 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:46:47 +0800 Subject: [PATCH 09/30] Update recipes/co/all/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 28d4b8fbd01de..87ce4ccabaff6 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -6,11 +6,11 @@ class CoConan(ConanFile): name = "co" - description = "A go-style coroutine library in C++11 and more." - topics = ("co", "coroutine", "c++11") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/idealvin/co" license = "MIT" + description = "A go-style coroutine library in C++11 and more." + topics = ("co", "coroutine", "c++11") exports_sources = ["CMakeLists.txt"] generators = "cmake" From b71de7cb4e75c9fdc05b96d7faa56f9c5d833cd0 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:47:12 +0800 Subject: [PATCH 10/30] Update recipes/co/all/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 87ce4ccabaff6..ba60358098de3 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -11,7 +11,7 @@ class CoConan(ConanFile): license = "MIT" description = "A go-style coroutine library in C++11 and more." topics = ("co", "coroutine", "c++11") - exports_sources = ["CMakeLists.txt"] + exports_sources = "CMakeLists.txt", "patches/*" generators = "cmake" settings = "os", "arch", "compiler", "build_type" From ffe85700d3779fa7d58eceafca2475069da4b065 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:47:54 +0800 Subject: [PATCH 11/30] Update recipes/co/all/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index ba60358098de3..ef2f907bbe69f 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -1,5 +1,5 @@ -import os from conans import ConanFile, CMake, tools +import os required_conan_version = ">=1.33.0" From 49d4aaa7cd5497cd13540a505aca8c8819d82cc0 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:48:24 +0800 Subject: [PATCH 12/30] Update recipes/co/all/test_package/CMakeLists.txt Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/test_package/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/co/all/test_package/CMakeLists.txt b/recipes/co/all/test_package/CMakeLists.txt index aebddd76b5b21..506e3d08f42d1 100644 --- a/recipes/co/all/test_package/CMakeLists.txt +++ b/recipes/co/all/test_package/CMakeLists.txt @@ -3,7 +3,9 @@ project(test_package) set(CMAKE_CXX_STANDARD 11) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) + +find_package(CO REQUIRED) add_executable(${PROJECT_NAME} test_package.cc) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} CO::CO) From 3ad6edb11374701734425ed49d552aef918f773b Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:48:50 +0800 Subject: [PATCH 13/30] Update recipes/co/all/test_package/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/test_package/conanfile.py b/recipes/co/all/test_package/conanfile.py index fdb9f346a1da9..5493d58611803 100644 --- a/recipes/co/all/test_package/conanfile.py +++ b/recipes/co/all/test_package/conanfile.py @@ -3,7 +3,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "cmake", "cmake_find_package" def build(self): cmake = CMake(self) From 86aa76d7f8602a5187a70bde0e67cbf8f7cbbbc0 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:49:10 +0800 Subject: [PATCH 14/30] Update recipes/co/all/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index ef2f907bbe69f..ec4587fc02e71 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -81,6 +81,6 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["co"] self.cpp_info.names["cmake_find_package"] = "CO" self.cpp_info.names["cmake_find_package_multi"] = "CO" From e28fce9b84547668b475cd24464dcddca8a84eb3 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 7 Oct 2021 21:49:42 +0800 Subject: [PATCH 15/30] Update recipes/co/all/conanfile.py Co-authored-by: Sparik Hayrapetyan --- recipes/co/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index ec4587fc02e71..50020f273c71e 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -66,7 +66,6 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared if not self.options.shared: self._cmake.definitions["FPIC"] = self.options.fPIC self._cmake.definitions["STATIC_VS_CRT"] = self.options.static_vs_crt From 2c8cebac3c5f8ab27b8a5e7ac20091c253f8385a Mon Sep 17 00:00:00 2001 From: SSE4 Date: Fri, 8 Oct 2021 03:02:02 -0700 Subject: [PATCH 16/30] Update recipes/co/all/conanfile.py --- recipes/co/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 50020f273c71e..18cef46d59cb0 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -51,7 +51,10 @@ def configure(self): def requirements(self): if self.options.with_openssl: self.requires("openssl/1.1.0") - + def build_requirements(self): + if self.settings.os == "Macos" and self.settings.arch == "armv8": + # The OSX_ARCHITECTURES target property is now respected for the ASM language + self.build_requires("cmake/3.20.1") def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) From 4706fb2085edd9557f7fffa9933d4aea0f1ef312 Mon Sep 17 00:00:00 2001 From: SSE4 Date: Fri, 8 Oct 2021 03:39:35 -0700 Subject: [PATCH 17/30] Update recipes/co/all/conanfile.py --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 18cef46d59cb0..a7d35dfd4f271 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -70,7 +70,7 @@ def _configure_cmake(self): return self._cmake self._cmake = CMake(self) if not self.options.shared: - self._cmake.definitions["FPIC"] = self.options.fPIC + self._cmake.definitions["FPIC"] = self.options.get_safe("fPIC", False) self._cmake.definitions["STATIC_VS_CRT"] = self.options.static_vs_crt self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl From 78edc30ca27f3404a67dcd088a7896de1bf13e81 Mon Sep 17 00:00:00 2001 From: Alvin Date: Fri, 8 Oct 2021 21:24:02 +0800 Subject: [PATCH 18/30] Update recipes/co/all/conanfile.py Co-authored-by: SSE4 --- recipes/co/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index a7d35dfd4f271..d31ed293d7ca2 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -71,7 +71,9 @@ def _configure_cmake(self): self._cmake = CMake(self) if not self.options.shared: self._cmake.definitions["FPIC"] = self.options.get_safe("fPIC", False) - self._cmake.definitions["STATIC_VS_CRT"] = self.options.static_vs_crt + runtime = self.settings.get_safe("compiler.runtime") + if runtime: + self._cmake.definitions["STATIC_VS_CRT"] = "MT" in runtime self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl self._cmake.configure(build_folder=self._build_subfolder) From fcc3fb5caa4bef6dc11b96e7cd856fb17b7caa3b Mon Sep 17 00:00:00 2001 From: Alvin Date: Fri, 8 Oct 2021 21:26:43 +0800 Subject: [PATCH 19/30] Update recipes/co/all/conanfile.py Co-authored-by: SSE4 --- recipes/co/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index d31ed293d7ca2..c011ab4638e50 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -20,7 +20,6 @@ class CoConan(ConanFile): "fPIC": [True, False], "with_libcurl": [True, False], "with_openssl": [True, False], - "static_vs_crt": [True, False], } default_options = { "shared": False, From 6324731d1b77683700862e7bb689a96bbf423028 Mon Sep 17 00:00:00 2001 From: Alvin Date: Fri, 8 Oct 2021 21:27:06 +0800 Subject: [PATCH 20/30] Update recipes/co/all/conanfile.py Co-authored-by: SSE4 --- recipes/co/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index c011ab4638e50..1a27864d4535f 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -26,7 +26,6 @@ class CoConan(ConanFile): "fPIC": True, "with_libcurl": False, "with_openssl": False, - "static_vs_crt": True, } _cmake = None From b773395eff290681e08790b5ab10e70e2123b135 Mon Sep 17 00:00:00 2001 From: Alvin Date: Sat, 9 Oct 2021 08:53:28 +0800 Subject: [PATCH 21/30] Update recipes/co/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 1a27864d4535f..0cc2b693c3107 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -48,7 +48,7 @@ def configure(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.0") + self.requires("openssl/1.1.1l") def build_requirements(self): if self.settings.os == "Macos" and self.settings.arch == "armv8": # The OSX_ARCHITECTURES target property is now respected for the ASM language From 1ea10d1a4cdcf2b5dd9ac7db289c6084ed0562e2 Mon Sep 17 00:00:00 2001 From: Alvin Date: Sat, 9 Oct 2021 09:35:32 +0800 Subject: [PATCH 22/30] Update recipes/co/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/co/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 0cc2b693c3107..761a100ac9391 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -12,7 +12,7 @@ class CoConan(ConanFile): description = "A go-style coroutine library in C++11 and more." topics = ("co", "coroutine", "c++11") exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" + generators = "cmake", "cmake_find_package" settings = "os", "arch", "compiler", "build_type" options = { From 93cee24b242936d52ba682a6e5b1e0435acf4f34 Mon Sep 17 00:00:00 2001 From: idealvin Date: Sat, 9 Oct 2021 10:16:36 +0800 Subject: [PATCH 23/30] add validate --- recipes/co/all/conanfile.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 761a100ac9391..bb2a032baeb31 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -86,3 +86,11 @@ def package_info(self): self.cpp_info.libs = ["co"] self.cpp_info.names["cmake_find_package"] = "CO" self.cpp_info.names["cmake_find_package_multi"] = "CO" + + def validate(self): + if self.options.with_libcurl and not self.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True") + if self.options["libcurl"].with_ssl != "openssl": + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled") + if not self.options["libcurl"].with_zlib: + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled") From e90259b043286bbbca8d0f7a916e930dd69d8f8d Mon Sep 17 00:00:00 2001 From: idealvin Date: Sat, 9 Oct 2021 12:36:55 +0800 Subject: [PATCH 24/30] add require for libcurl --- recipes/co/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index bb2a032baeb31..60bd776ba50c8 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -47,6 +47,8 @@ def configure(self): del self.options.fPIC def requirements(self): + if self.options.with_libcurl: + self.requires("libcurl/7.79.1") if self.options.with_openssl: self.requires("openssl/1.1.1l") def build_requirements(self): From bbf6c85f11d605b6c7b17d01e3316d798069b1f1 Mon Sep 17 00:00:00 2001 From: idealvin Date: Sat, 9 Oct 2021 13:57:19 +0800 Subject: [PATCH 25/30] fix validate --- recipes/co/all/conanfile.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 60bd776ba50c8..6531152af6060 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -51,10 +51,12 @@ def requirements(self): self.requires("libcurl/7.79.1") if self.options.with_openssl: self.requires("openssl/1.1.1l") + def build_requirements(self): if self.settings.os == "Macos" and self.settings.arch == "armv8": # The OSX_ARCHITECTURES target property is now respected for the ASM language self.build_requires("cmake/3.20.1") + def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @@ -90,9 +92,10 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "CO" def validate(self): - if self.options.with_libcurl and not self.options.with_openssl: - raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True") - if self.options["libcurl"].with_ssl != "openssl": - raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled") - if not self.options["libcurl"].with_zlib: - raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled") + if self.options.with_libcurl: + if not self.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True") + if self.options["libcurl"].with_ssl != "openssl": + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled") + if not self.options["libcurl"].with_zlib: + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled") From 8859d8f644b68b6c45ae51e4b8e4ce561b41e119 Mon Sep 17 00:00:00 2001 From: Alvin Date: Sun, 10 Oct 2021 12:28:22 +0800 Subject: [PATCH 26/30] Update recipes/co/all/CMakeLists.txt Co-authored-by: Chris Mc --- recipes/co/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/co/all/CMakeLists.txt b/recipes/co/all/CMakeLists.txt index bd4164cb5c1c7..c986d294c7547 100644 --- a/recipes/co/all/CMakeLists.txt +++ b/recipes/co/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) include(conanbuildinfo.cmake) From b0b4231289cabd131defec60a192a0e39e0bbbd2 Mon Sep 17 00:00:00 2001 From: idealvin Date: Sun, 10 Oct 2021 12:32:54 +0800 Subject: [PATCH 27/30] to lowercase --- recipes/co/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index 6531152af6060..c772ca880ab9d 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -88,8 +88,8 @@ def package(self): def package_info(self): self.cpp_info.libs = ["co"] - self.cpp_info.names["cmake_find_package"] = "CO" - self.cpp_info.names["cmake_find_package_multi"] = "CO" + self.cpp_info.names["cmake_find_package"] = "co" + self.cpp_info.names["cmake_find_package_multi"] = "co" def validate(self): if self.options.with_libcurl: From b8bf11725c63695251a8c582bbd2f3a7c36fb5fd Mon Sep 17 00:00:00 2001 From: idealvin Date: Sun, 10 Oct 2021 12:41:11 +0800 Subject: [PATCH 28/30] to lowercase --- recipes/co/all/test_package/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/co/all/test_package/CMakeLists.txt b/recipes/co/all/test_package/CMakeLists.txt index 506e3d08f42d1..d9ea9b93dcee7 100644 --- a/recipes/co/all/test_package/CMakeLists.txt +++ b/recipes/co/all/test_package/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 11) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(CO REQUIRED) +find_package(co REQUIRED) add_executable(${PROJECT_NAME} test_package.cc) -target_link_libraries(${PROJECT_NAME} CO::CO) +target_link_libraries(${PROJECT_NAME} co::co) From 94d026acaca914f03231d06dd4b049dbe958072d Mon Sep 17 00:00:00 2001 From: idealvin Date: Mon, 11 Oct 2021 21:35:39 +0800 Subject: [PATCH 29/30] add a patch for co 2.0.2 --- recipes/co/all/patches/002-fix-event-destruct.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 recipes/co/all/patches/002-fix-event-destruct.patch diff --git a/recipes/co/all/patches/002-fix-event-destruct.patch b/recipes/co/all/patches/002-fix-event-destruct.patch new file mode 100644 index 0000000000000..7949dbdca3146 --- /dev/null +++ b/recipes/co/all/patches/002-fix-event-destruct.patch @@ -0,0 +1,13 @@ +diff --git a/src/co/co.cc b/src/co/co.cc +index 8921296..838ac16 100644 +--- a/src/co/co.cc ++++ b/src/co/co.cc +@@ -8,7 +8,7 @@ namespace co { + class EventImpl { + public: + EventImpl() : _counter(0), _signaled(false), _has_cond(false) {} +- ~EventImpl() { co::xx::cond_destroy(&_cond); } ++ ~EventImpl() { if (_has_cond) co::xx::cond_destroy(&_cond); } + + bool wait(uint32 ms); + From 3c4fe47dedabeaaf6af5487750336bbcc9771b18 Mon Sep 17 00:00:00 2001 From: Alvin Date: Tue, 12 Oct 2021 09:48:24 +0800 Subject: [PATCH 30/30] Update recipes/co/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/co/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/co/all/conanfile.py b/recipes/co/all/conanfile.py index c772ca880ab9d..1752f89b396c9 100644 --- a/recipes/co/all/conanfile.py +++ b/recipes/co/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.33.0"