From 1203dd0b11f0603b0c40857bbe10eff5617a4d2d Mon Sep 17 00:00:00 2001 From: ydcpp Date: Tue, 21 May 2024 21:57:04 +0300 Subject: [PATCH 01/17] tcpcat 1.0.0 publish --- recipes/tcpcat/all/conandata.yml | 4 + recipes/tcpcat/all/conanfile.py | 61 ++++++++++++++++ .../tcpcat/all/test_package/CMakeLists.txt | 7 ++ recipes/tcpcat/all/test_package/conanfile.py | 26 +++++++ .../tcpcat/all/test_package/test_package.cpp | 73 +++++++++++++++++++ recipes/tcpcat/config.yml | 3 + 6 files changed, 174 insertions(+) create mode 100644 recipes/tcpcat/all/conandata.yml create mode 100644 recipes/tcpcat/all/conanfile.py create mode 100644 recipes/tcpcat/all/test_package/CMakeLists.txt create mode 100644 recipes/tcpcat/all/test_package/conanfile.py create mode 100644 recipes/tcpcat/all/test_package/test_package.cpp create mode 100644 recipes/tcpcat/config.yml diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/tcpcat/all/conandata.yml new file mode 100644 index 0000000000000..6b40ad3702644 --- /dev/null +++ b/recipes/tcpcat/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.0.tar.gz" + sha256: "60763370e6924b2257dd897b8a37b33396e333d246e500e1c49011e8b3219461" diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py new file mode 100644 index 0000000000000..80a0713c596d7 --- /dev/null +++ b/recipes/tcpcat/all/conanfile.py @@ -0,0 +1,61 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import copy +from conan.tools.build import check_min_cppstd +from os.path import join + +class TcpcatConan(ConanFile): + name = "tcpcat" + version = "1.0.0" + package_type = "library" + + # Optional metadata + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ydcpp/tcpcat" + description = "Simple C++ TCP Server and Client library." + topics = ("network", "tcp", "tcp server", "tcp client") + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "CMakeLists.txt", "src/*", "include/*" + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=join(self.package_folder, "licenses")) + copy(self, "*", src=join(self.source_folder, "include"), dst=join(self.package_folder, "include")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["tcpcat"] + diff --git a/recipes/tcpcat/all/test_package/CMakeLists.txt b/recipes/tcpcat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e00cc3f35a7ee --- /dev/null +++ b/recipes/tcpcat/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +add_executable(test_package test_package.cpp) + +find_package(tcpcat CONFIG REQUIRED) +target_link_libraries(test_package tcpcat::tcpcat) diff --git a/recipes/tcpcat/all/test_package/conanfile.py b/recipes/tcpcat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..806fd5ae2a792 --- /dev/null +++ b/recipes/tcpcat/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class tcpcatTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def layout(self): + cmake_layout(self) + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/tcpcat/all/test_package/test_package.cpp b/recipes/tcpcat/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bdff6c9a3e2c4 --- /dev/null +++ b/recipes/tcpcat/all/test_package/test_package.cpp @@ -0,0 +1,73 @@ +#include + +#include +#include + +class ServerHandler : public tcpcat::EventHandler +{ + void OnConnected(std::shared_ptr session) override + { + std::cout << "Client connected: " << session->RemoteEndpoint().address().to_string() << " : " + << session->RemoteEndpoint().port() << '\n'; + } + + void OnReceived(std::shared_ptr session, const std::vector &buf, size_t bytes) override + { + std::cout << "Message received from client: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; + } + + void OnSent(std::shared_ptr session, const std::vector &buf, size_t bytes) override + { + std::cout << "Message sent to client: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; + } + + void OnDisconnected(std::shared_ptr session) override + { + std::cout << "Client disconnected: " << session->RemoteEndpoint().address().to_string() << " : " + << session->RemoteEndpoint().port() << '\n'; + } + + void OnError(std::shared_ptr session, const asio::error_code &err) override + { + std::cout << "Error: " << err.message() << '\n'; + } +}; + +class ClientHandler : public tcpcat::EventHandler +{ + void OnConnected(std::shared_ptr session) override + { + std::cout << "Connected to server: " << session->RemoteEndpoint().address().to_string() << " : " + << session->RemoteEndpoint().port() << '\n'; + } + + void OnReceived(std::shared_ptr session, const std::vector &buf, size_t bytes) override + { + std::cout << "Message received from server: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; + } + + void OnSent(std::shared_ptr session, const std::vector &buf, size_t bytes) override + { + std::cout << "Message sent to server: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; + } + + void OnDisconnected(std::shared_ptr session) override + { + std::cout << "Disconnected from server: " << session->RemoteEndpoint().address().to_string() << " : " + << session->RemoteEndpoint().port() << '\n'; + } + + void OnError(std::shared_ptr session, const asio::error_code &err) override + { + std::cout << "Error: " << err.message() << '\n'; + } +}; + + +int main() +{ + tcpcat::TcpServer server("127.0.0.1", 3001, std::make_shared()); + tcpcat::TcpClient client("127.0.0.1", 3001, std::make_shared()); + + return 0; +} diff --git a/recipes/tcpcat/config.yml b/recipes/tcpcat/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/tcpcat/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all From b1b9937699dbcfb91475167ca47d46feffd8ce0a Mon Sep 17 00:00:00 2001 From: ydcpp Date: Tue, 21 May 2024 22:46:02 +0300 Subject: [PATCH 02/17] fix linter errors --- recipes/tcpcat/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index 80a0713c596d7..48e5c2fb1c621 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -6,7 +6,6 @@ class TcpcatConan(ConanFile): name = "tcpcat" - version = "1.0.0" package_type = "library" # Optional metadata @@ -37,7 +36,7 @@ def validate(self): check_min_cppstd(self, 17) def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def generate(self): deps = CMakeDeps(self) From 59f340d10416e53576158f91402a971ca703f49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Thu, 23 May 2024 09:48:53 +0200 Subject: [PATCH 03/17] Simplify recipe and test_package --- recipes/tcpcat/all/conanfile.py | 46 +++++++++---- .../tcpcat/all/test_package/test_package.cpp | 68 +------------------ 2 files changed, 36 insertions(+), 78 deletions(-) diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index 48e5c2fb1c621..03fd51a9c89f4 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -1,8 +1,11 @@ from conan import ConanFile -from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps -from conan.tools.files import copy +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import copy, get from conan.tools.build import check_min_cppstd -from os.path import join +from conan.tools.scm import Version +import os + class TcpcatConan(ConanFile): name = "tcpcat" @@ -20,8 +23,19 @@ class TcpcatConan(ConanFile): options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - # Sources are located in the same place as this recipe, copy them to the recipe - exports_sources = "CMakeLists.txt", "src/*", "include/*" + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "16", + "msvc": "192", + "clang": "7", + "apple-clang": "12" + } def config_options(self): if self.settings.os == "Windows": @@ -31,16 +45,23 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - def layout(self): - cmake_layout(self, src_folder="src") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - deps = CMakeDeps(self) - deps.generate() tc = CMakeToolchain(self) tc.generate() @@ -50,11 +71,10 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=join(self.package_folder, "licenses")) - copy(self, "*", src=join(self.source_folder, "include"), dst=join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["tcpcat"] - diff --git a/recipes/tcpcat/all/test_package/test_package.cpp b/recipes/tcpcat/all/test_package/test_package.cpp index bdff6c9a3e2c4..3a3224d3af25c 100644 --- a/recipes/tcpcat/all/test_package/test_package.cpp +++ b/recipes/tcpcat/all/test_package/test_package.cpp @@ -3,71 +3,9 @@ #include #include -class ServerHandler : public tcpcat::EventHandler -{ - void OnConnected(std::shared_ptr session) override - { - std::cout << "Client connected: " << session->RemoteEndpoint().address().to_string() << " : " - << session->RemoteEndpoint().port() << '\n'; - } - - void OnReceived(std::shared_ptr session, const std::vector &buf, size_t bytes) override - { - std::cout << "Message received from client: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; - } - - void OnSent(std::shared_ptr session, const std::vector &buf, size_t bytes) override - { - std::cout << "Message sent to client: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; - } - - void OnDisconnected(std::shared_ptr session) override - { - std::cout << "Client disconnected: " << session->RemoteEndpoint().address().to_string() << " : " - << session->RemoteEndpoint().port() << '\n'; - } - - void OnError(std::shared_ptr session, const asio::error_code &err) override - { - std::cout << "Error: " << err.message() << '\n'; - } -}; - -class ClientHandler : public tcpcat::EventHandler -{ - void OnConnected(std::shared_ptr session) override - { - std::cout << "Connected to server: " << session->RemoteEndpoint().address().to_string() << " : " - << session->RemoteEndpoint().port() << '\n'; - } - - void OnReceived(std::shared_ptr session, const std::vector &buf, size_t bytes) override - { - std::cout << "Message received from server: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; - } - - void OnSent(std::shared_ptr session, const std::vector &buf, size_t bytes) override - { - std::cout << "Message sent to server: " << std::string(buf.begin(), buf.begin() + bytes) << '\n'; - } - - void OnDisconnected(std::shared_ptr session) override - { - std::cout << "Disconnected from server: " << session->RemoteEndpoint().address().to_string() << " : " - << session->RemoteEndpoint().port() << '\n'; - } - - void OnError(std::shared_ptr session, const asio::error_code &err) override - { - std::cout << "Error: " << err.message() << '\n'; - } -}; - - int main() { - tcpcat::TcpServer server("127.0.0.1", 3001, std::make_shared()); - tcpcat::TcpClient client("127.0.0.1", 3001, std::make_shared()); - - return 0; + auto session = tcpcat::TcpSession(nullptr, nullptr, 0); + std::cout << "session id: " << session.GetId() << std::endl; + return 0; } From b512607db2852e1113ce7edb60bdc61bd2432f4c Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 14:14:15 +0300 Subject: [PATCH 04/17] updated ASIO dependency usage and upstream version number --- recipes/tcpcat/all/conandata.yml | 6 +++--- recipes/tcpcat/all/conanfile.py | 4 ++++ recipes/tcpcat/all/test_package/CMakeLists.txt | 2 +- recipes/tcpcat/config.yml | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/tcpcat/all/conandata.yml index 6b40ad3702644..8b8b8b149a151 100644 --- a/recipes/tcpcat/all/conandata.yml +++ b/recipes/tcpcat/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.0": - url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.0.tar.gz" - sha256: "60763370e6924b2257dd897b8a37b33396e333d246e500e1c49011e8b3219461" + "1.0.1": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.1.tar.gz" + sha256: "7fdd9fee54c3858d207499e1c1d369e044f012ab164ce6045237cebe724fb2da" diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index 03fd51a9c89f4..8eeb2bffaf5be 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -58,6 +58,9 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) + def requirements(self): + self.requires("asio/[^1.30]", transitive_headers = True) + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -78,3 +81,4 @@ def package(self): def package_info(self): self.cpp_info.libs = ["tcpcat"] + self.cpp_info.set_property("cmake_target_name", "tcpcat") diff --git a/recipes/tcpcat/all/test_package/CMakeLists.txt b/recipes/tcpcat/all/test_package/CMakeLists.txt index e00cc3f35a7ee..753bab6d2ebd1 100644 --- a/recipes/tcpcat/all/test_package/CMakeLists.txt +++ b/recipes/tcpcat/all/test_package/CMakeLists.txt @@ -4,4 +4,4 @@ project(PackageTest CXX) add_executable(test_package test_package.cpp) find_package(tcpcat CONFIG REQUIRED) -target_link_libraries(test_package tcpcat::tcpcat) +target_link_libraries(test_package tcpcat) diff --git a/recipes/tcpcat/config.yml b/recipes/tcpcat/config.yml index 40341aa3db6cd..715e55357a17b 100644 --- a/recipes/tcpcat/config.yml +++ b/recipes/tcpcat/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.0": + "1.0.1": folder: all From bc471c4c29de931784224080a40dc7d409c2e493 Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 14:30:48 +0300 Subject: [PATCH 05/17] CI test error fix --- recipes/tcpcat/all/test_package/test_package.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tcpcat/all/test_package/test_package.cpp b/recipes/tcpcat/all/test_package/test_package.cpp index 3a3224d3af25c..aa337b33b0be6 100644 --- a/recipes/tcpcat/all/test_package/test_package.cpp +++ b/recipes/tcpcat/all/test_package/test_package.cpp @@ -5,7 +5,7 @@ int main() { - auto session = tcpcat::TcpSession(nullptr, nullptr, 0); + tcpcat::TcpSession session(nullptr, nullptr, 0); std::cout << "session id: " << session.GetId() << std::endl; return 0; } From 305b9aa8a0e229e74129b4ed18be7a79693fa4d0 Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 15:46:06 +0300 Subject: [PATCH 06/17] updated upstream version to 1.0.2 --- recipes/tcpcat/all/conandata.yml | 6 +++--- recipes/tcpcat/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/tcpcat/all/conandata.yml index 8b8b8b149a151..8cbe8c3aba5d8 100644 --- a/recipes/tcpcat/all/conandata.yml +++ b/recipes/tcpcat/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.1": - url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.1.tar.gz" - sha256: "7fdd9fee54c3858d207499e1c1d369e044f012ab164ce6045237cebe724fb2da" + "1.0.2": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.2.tar.gz" + sha256: "7b108750abf2fc34876539ef00f8e08cba5f68fd1bd9774ab773bca2c17d0d35" diff --git a/recipes/tcpcat/config.yml b/recipes/tcpcat/config.yml index 715e55357a17b..8457ca9a4a8cd 100644 --- a/recipes/tcpcat/config.yml +++ b/recipes/tcpcat/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.1": + "1.0.2": folder: all From 8a877de82e0d49e7eb9dbf67cb240a2bbcdc14fe Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 16:19:12 +0300 Subject: [PATCH 07/17] added CMakeDeps for find_package to work properly --- recipes/tcpcat/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index 8eeb2bffaf5be..92166362ad6a5 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout from conan.tools.files import copy, get from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -65,6 +65,8 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + deps = CMakeDeps(self) + deps.generate() tc = CMakeToolchain(self) tc.generate() From 6dd37a2384e665369e1c148ac5af579528b72800 Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 19:15:08 +0300 Subject: [PATCH 08/17] updated for tcpcat 1.0.3 --- recipes/tcpcat/all/conandata.yml | 6 +++--- recipes/tcpcat/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/tcpcat/all/conandata.yml index 8cbe8c3aba5d8..8d671be4c6210 100644 --- a/recipes/tcpcat/all/conandata.yml +++ b/recipes/tcpcat/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.2": - url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.2.tar.gz" - sha256: "7b108750abf2fc34876539ef00f8e08cba5f68fd1bd9774ab773bca2c17d0d35" + "1.0.3": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.3.tar.gz" + sha256: "29cafd7e71685fc51a16770a589a5a9a16a2361b214329e6c64ea482293a0742" diff --git a/recipes/tcpcat/config.yml b/recipes/tcpcat/config.yml index 8457ca9a4a8cd..372dd1cb646bd 100644 --- a/recipes/tcpcat/config.yml +++ b/recipes/tcpcat/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.2": + "1.0.3": folder: all From f7c1da056c4085fd2aa00dde6baef8a5bfa5814c Mon Sep 17 00:00:00 2001 From: ydcpp Date: Sun, 26 May 2024 20:20:06 +0300 Subject: [PATCH 09/17] updated topics and asio requirement version --- recipes/tcpcat/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index 92166362ad6a5..f1f6f3f18555c 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -16,7 +16,7 @@ class TcpcatConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ydcpp/tcpcat" description = "Simple C++ TCP Server and Client library." - topics = ("network", "tcp", "tcp server", "tcp client") + topics = ("network", "tcp", "tcp-server", "tcp-client") # Binary configuration settings = "os", "compiler", "build_type", "arch" @@ -59,7 +59,7 @@ def validate(self): ) def requirements(self): - self.requires("asio/[^1.30]", transitive_headers = True) + self.requires("asio/1.30.2", transitive_headers = True) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 1de0ac871a0112c75cb6a796da28d09192099795 Mon Sep 17 00:00:00 2001 From: ydcpp Date: Mon, 27 May 2024 23:00:53 +0300 Subject: [PATCH 10/17] updated upstream to 1.0.4 with fixes --- recipes/tcpcat/all/conandata.yml | 6 +++--- recipes/tcpcat/all/conanfile.py | 6 +++--- recipes/tcpcat/all/test_package/CMakeLists.txt | 4 ++-- recipes/tcpcat/config.yml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/tcpcat/all/conandata.yml index 8d671be4c6210..93679778e120e 100644 --- a/recipes/tcpcat/all/conandata.yml +++ b/recipes/tcpcat/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.3": - url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.3.tar.gz" - sha256: "29cafd7e71685fc51a16770a589a5a9a16a2361b214329e6c64ea482293a0742" + "1.0.4": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.4.tar.gz" + sha256: "3413e74eab0a1bf7927b747e393b1931e8a516ee769642ce89c558a93e00e38b" diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/tcpcat/all/conanfile.py index f1f6f3f18555c..90b0086b6c310 100644 --- a/recipes/tcpcat/all/conanfile.py +++ b/recipes/tcpcat/all/conanfile.py @@ -8,7 +8,7 @@ class TcpcatConan(ConanFile): - name = "tcpcat" + name = "ydcpp-tcpcat" package_type = "library" # Optional metadata @@ -82,5 +82,5 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.libs = ["tcpcat"] - self.cpp_info.set_property("cmake_target_name", "tcpcat") + self.cpp_info.libs = ["ydcpp-tcpcat"] + self.cpp_info.set_property("cmake_target_name", "ydcpp-tcpcat") diff --git a/recipes/tcpcat/all/test_package/CMakeLists.txt b/recipes/tcpcat/all/test_package/CMakeLists.txt index 753bab6d2ebd1..a9b92d97e5273 100644 --- a/recipes/tcpcat/all/test_package/CMakeLists.txt +++ b/recipes/tcpcat/all/test_package/CMakeLists.txt @@ -3,5 +3,5 @@ project(PackageTest CXX) add_executable(test_package test_package.cpp) -find_package(tcpcat CONFIG REQUIRED) -target_link_libraries(test_package tcpcat) +find_package(ydcpp-tcpcat CONFIG REQUIRED) +target_link_libraries(test_package ydcpp-tcpcat) diff --git a/recipes/tcpcat/config.yml b/recipes/tcpcat/config.yml index 372dd1cb646bd..c20e44b006f1a 100644 --- a/recipes/tcpcat/config.yml +++ b/recipes/tcpcat/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.3": + "1.0.4": folder: all From 55c270c19ea5ed00491cbfdba02b87db8cc8cb70 Mon Sep 17 00:00:00 2001 From: ydcpp Date: Mon, 27 May 2024 23:22:38 +0300 Subject: [PATCH 11/17] updated package folder name --- recipes/{tcpcat => ydcpp-tcpcat}/all/conandata.yml | 0 recipes/{tcpcat => ydcpp-tcpcat}/all/conanfile.py | 0 recipes/{tcpcat => ydcpp-tcpcat}/all/test_package/CMakeLists.txt | 0 recipes/{tcpcat => ydcpp-tcpcat}/all/test_package/conanfile.py | 0 .../{tcpcat => ydcpp-tcpcat}/all/test_package/test_package.cpp | 0 recipes/{tcpcat => ydcpp-tcpcat}/config.yml | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename recipes/{tcpcat => ydcpp-tcpcat}/all/conandata.yml (100%) rename recipes/{tcpcat => ydcpp-tcpcat}/all/conanfile.py (100%) rename recipes/{tcpcat => ydcpp-tcpcat}/all/test_package/CMakeLists.txt (100%) rename recipes/{tcpcat => ydcpp-tcpcat}/all/test_package/conanfile.py (100%) rename recipes/{tcpcat => ydcpp-tcpcat}/all/test_package/test_package.cpp (100%) rename recipes/{tcpcat => ydcpp-tcpcat}/config.yml (100%) diff --git a/recipes/tcpcat/all/conandata.yml b/recipes/ydcpp-tcpcat/all/conandata.yml similarity index 100% rename from recipes/tcpcat/all/conandata.yml rename to recipes/ydcpp-tcpcat/all/conandata.yml diff --git a/recipes/tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py similarity index 100% rename from recipes/tcpcat/all/conanfile.py rename to recipes/ydcpp-tcpcat/all/conanfile.py diff --git a/recipes/tcpcat/all/test_package/CMakeLists.txt b/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt similarity index 100% rename from recipes/tcpcat/all/test_package/CMakeLists.txt rename to recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt diff --git a/recipes/tcpcat/all/test_package/conanfile.py b/recipes/ydcpp-tcpcat/all/test_package/conanfile.py similarity index 100% rename from recipes/tcpcat/all/test_package/conanfile.py rename to recipes/ydcpp-tcpcat/all/test_package/conanfile.py diff --git a/recipes/tcpcat/all/test_package/test_package.cpp b/recipes/ydcpp-tcpcat/all/test_package/test_package.cpp similarity index 100% rename from recipes/tcpcat/all/test_package/test_package.cpp rename to recipes/ydcpp-tcpcat/all/test_package/test_package.cpp diff --git a/recipes/tcpcat/config.yml b/recipes/ydcpp-tcpcat/config.yml similarity index 100% rename from recipes/tcpcat/config.yml rename to recipes/ydcpp-tcpcat/config.yml From 28cb3dde0dc306aac97407f211a871103ebcbe05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 29 Jun 2024 00:14:58 +0200 Subject: [PATCH 12/17] Ensure CXX is valid in Conan 1 --- recipes/ydcpp-tcpcat/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py index 90b0086b6c310..405335d9e7d6d 100644 --- a/recipes/ydcpp-tcpcat/all/conanfile.py +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -68,6 +68,8 @@ def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) + if not self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.generate() def build(self): From 990e08fa9f21508edbad8e5b77b8d0160e635e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 29 Jun 2024 00:15:55 +0200 Subject: [PATCH 13/17] reorder --- recipes/ydcpp-tcpcat/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py index 405335d9e7d6d..dd5a0d3099f3a 100644 --- a/recipes/ydcpp-tcpcat/all/conanfile.py +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -9,7 +9,6 @@ class TcpcatConan(ConanFile): name = "ydcpp-tcpcat" - package_type = "library" # Optional metadata license = "MIT" @@ -19,6 +18,7 @@ class TcpcatConan(ConanFile): topics = ("network", "tcp", "tcp-server", "tcp-client") # Binary configuration + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} From 6cec5a2730d8e49ad0e069582d4e372198dffa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 29 Jun 2024 02:41:47 +0200 Subject: [PATCH 14/17] Update recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt Co-authored-by: Uilian Ries --- recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt b/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt index a9b92d97e5273..0be8339e35258 100644 --- a/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt +++ b/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt @@ -5,3 +5,4 @@ add_executable(test_package test_package.cpp) find_package(ydcpp-tcpcat CONFIG REQUIRED) target_link_libraries(test_package ydcpp-tcpcat) +target_compile_features(test_package PRIVATE cxx_std_17) From 8b5b46339c19d7b9914b0be0377b61376fe68349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 29 Jun 2024 02:49:28 +0200 Subject: [PATCH 15/17] Disable msvc shared builds for now until upstream exports some symbols --- recipes/ydcpp-tcpcat/all/conanfile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py index dd5a0d3099f3a..30b58e42613af 100644 --- a/recipes/ydcpp-tcpcat/all/conanfile.py +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc from conan.tools.files import copy, get from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -51,6 +52,12 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) + + # Upstream meant to support Windows Shared builds, but they don't currently export any symbols + # Disable for now until fixed. As this is an upstream issue they want fixed, we don't set + # package_type = "static-library" in the configure() method so that users have a clear message error for now + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not currently support Windows shared builds due to an upstream issue") minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version and Version(self.settings.compiler.version) < minimum_version: From 7ac0657112a78c1a1f10fc5a27252131fe53ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 29 Jun 2024 03:35:50 +0200 Subject: [PATCH 16/17] Add missing m system lib --- recipes/ydcpp-tcpcat/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py index 30b58e42613af..4e2b6f2ab43c8 100644 --- a/recipes/ydcpp-tcpcat/all/conanfile.py +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -93,3 +93,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["ydcpp-tcpcat"] self.cpp_info.set_property("cmake_target_name", "ydcpp-tcpcat") + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.append("m") From b841ae2167c86f842ad619ea8deba996b9607f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sun, 30 Jun 2024 01:03:11 +0200 Subject: [PATCH 17/17] Simplify --- recipes/ydcpp-tcpcat/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py index 4e2b6f2ab43c8..ff79b54fa821b 100644 --- a/recipes/ydcpp-tcpcat/all/conanfile.py +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -75,8 +75,6 @@ def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) - if not self.settings.get_safe("compiler.cppstd"): - tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.generate() def build(self):