Skip to content

Commit

Permalink
More canonical way of pulling in grpc headers. (eBay#80)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
szmyd authored Mar 28, 2024
1 parent fca8ec7 commit 7b704e0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 35 deletions.
27 changes: 0 additions & 27 deletions 3rd_party/grpc_internal/conanfile.py

This file was deleted.

30 changes: 25 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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',
Expand Down Expand Up @@ -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")
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7b704e0

Please sign in to comment.