From 7b704e0f83479a49ae1638369210ec59c8f371e5 Mon Sep 17 00:00:00 2001 From: Brian Szmyd Date: Thu, 28 Mar 2024 13:59:37 -0600 Subject: [PATCH] More canonical way of pulling in grpc headers. (#80) Old headers were still on 1.48.0; while grpc was 1.54.3. I bind these together now by calculating the source path in recipe and pulling directly into the build folder. As we are not using (or building) this feature currently I have disabled it, but should be straight-forward to get working now with this change (just some -I needed). --- 3rd_party/grpc_internal/conanfile.py | 27 ------------------------- conanfile.py | 30 +++++++++++++++++++++++----- prepare.sh | 2 -- src/lib/CMakeLists.txt | 1 - 4 files changed, 25 insertions(+), 35 deletions(-) delete mode 100644 3rd_party/grpc_internal/conanfile.py diff --git a/3rd_party/grpc_internal/conanfile.py b/3rd_party/grpc_internal/conanfile.py deleted file mode 100644 index a0f452a3..00000000 --- a/3rd_party/grpc_internal/conanfile.py +++ /dev/null @@ -1,27 +0,0 @@ -from conans import ConanFile, tools -import os - -required_conan_version = ">=1.43.0" - -class grpcInternalConan(ConanFile): - name = "grpc_internal" - description = "Google's RPC (remote procedure call) library and framework." - topics = ("grpc", "rpc") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/grpc/grpc" - license = "Apache-2.0" - version = "1.48.0" - - @property - def _source_subfolder(self): - return "grpc_internal" - - def source(self): - tools.get("https://github.com/grpc/grpc/archive/v1.48.0.tar.gz", - destination=self._source_subfolder, strip_root=True) - - def package(self): - self.copy("*.h", dst="include/", src="./", keep_path=True) - - def package_info(self): - self.cpp_info.includedirs = ["include/", "include/grpc_internal"] diff --git a/conanfile.py b/conanfile.py index ca8d79e8..38562ff0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,11 +1,12 @@ -from os.path import join from conan import ConanFile -from conan.tools.files import copy +from conan.tools.files import copy, get, save, load from conans import CMake +from os.path import join, exists +import json class IOMgrConan(ConanFile): name = "iomgr" - version = "11.2.1" + version = "11.2.2" homepage = "https://github.com/eBay/IOManager" description = "Asynchronous event manager" @@ -29,7 +30,7 @@ class IOMgrConan(ConanFile): 'shared': False, 'fPIC': True, 'coverage': False, - 'grpc_support': True, + 'grpc_support': False, 'sanitize': False, 'spdk': True, 'testing': 'epoll_mode', @@ -57,7 +58,6 @@ def requirements(self): self.requires("sisl/[~=12, include_prerelease=True]@oss/master") if self.options.grpc_support: self.requires("grpc/[>=1.50]") - self.requires("grpc_internal/1.48.0") self.requires("liburing/2.4") if self.options.spdk: self.requires("spdk/21.07.y") @@ -67,6 +67,26 @@ def requirements(self): self.requires("lz4/1.9.4", override=True) self.requires("zstd/1.5.5", override=True) + def _download_grpc(self, folder): + ref = self.dependencies['grpc'].ref.version + source_info = self.dependencies['grpc'].conan_data["sources"][f"{ref}"] + current_info_str = json.dumps(source_info, sort_keys=True) + + touch_file_path = join(folder, "grpc_download") + + if exists(touch_file_path) == False or load(self, touch_file_path) != current_info_str: + print("-------------- downloading grpc sources ---------") + get(self, **source_info, destination=join(folder, "grpc_internal"), strip_root=True) + save(self, touch_file_path, current_info_str) + + def source(self): + if self.options.grpc_support: + self._download_grpc(self.source_folder) + + def generate(self): + if self.options.grpc_support: + self._download_grpc(self.source_folder) + def build(self): cmake = CMake(self) definitions = {'CMAKE_TEST_TARGET': self.options.testing, diff --git a/prepare.sh b/prepare.sh index b4e90ce9..9c222851 100755 --- a/prepare.sh +++ b/prepare.sh @@ -10,8 +10,6 @@ echo -n "dpdk." conan export 3rd_party/dpdk echo -n "fio." conan export 3rd_party/fio -echo -n "gprc_internal." -conan export 3rd_party/grpc_internal echo -n "spdk." conan export 3rd_party/spdk diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 4a8c3534..32931e89 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -10,7 +10,6 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPACKAGE_VERSION=\\\"${PACKAGE_REVISIO set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPACKAGE_NAME=\\\"${PROJECT_NAME}\\\"") find_package(flatbuffers REQUIRED) -find_package(grpc_internal QUIET) find_package(sisl REQUIRED) find_package(liburing REQUIRED) find_package(Pistache REQUIRED)