Skip to content

Commit

Permalink
Changed protobuf to protobuf-c
Browse files Browse the repository at this point in the history
To reduce code bloat
  • Loading branch information
SChernykh committed Jan 29, 2024
1 parent 3731820 commit 6d39ea4
Show file tree
Hide file tree
Showing 35 changed files with 16,705 additions and 65,506 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
strategy:
matrix:
config:
- {os: ubuntu-20.04, c: gcc-8, cpp: g++-8, flags: "-Wno-lto-type-mismatch"}
- {os: ubuntu-20.04, c: gcc-7, cpp: g++-7, flags: "-Wno-lto-type-mismatch"}
- {os: ubuntu-20.04, c: gcc-11, cpp: g++-11, flags: ""}
- {os: ubuntu-22.04, c: gcc-12, cpp: g++-12, flags: ""}

Expand Down Expand Up @@ -579,7 +579,7 @@ jobs:

build-freebsd:

timeout-minutes: 120
timeout-minutes: 75
runs-on: ${{ matrix.os.host }}

strategy:
Expand Down Expand Up @@ -647,7 +647,7 @@ jobs:

build-openbsd:

timeout-minutes: 120
timeout-minutes: 75
runs-on: ${{ matrix.os.host }}

strategy:
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
[submodule "external/src/miniupnp"]
path = external/src/miniupnp
url = https://github.com/SChernykh/miniupnp
[submodule "external/src/protobuf"]
path = external/src/protobuf
url = https://github.com/SChernykh/protobuf
[submodule "external/src/protobuf-c"]
path = external/src/protobuf-c
url = https://github.com/SChernykh/protobuf-c
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool)

add_subdirectory(external/src/protobuf)
set(LIBS ${LIBS} libprotobuf)

add_subdirectory(external/src/Tari)
set(LIBS ${LIBS} Tari_gRPC)

Expand Down Expand Up @@ -177,7 +174,7 @@ include_directories(external/src/robin-hood-hashing/src/include)
if (WITH_UPNP)
include_directories(external/src/miniupnp/miniupnpc/include)
endif()
include_directories(external/src/protobuf/src)
include_directories(external/src/protobuf-c)

if (WIN32)
set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Only 64-bit builds are supported, in particular ARMv7 or older CPUs are not supp
### Prerequisites
- cmake >= 3.10
- C++ compiler with full C++17 support. GCC-8, Clang-13 and MSVC-2019 have been tested and confirmed to work, older compilers may fail to build P2Pool.
- C++ compiler with C++17 support. GCC-7, Clang-13 and MSVC-2019 have been tested and confirmed to work, older compilers may fail to build P2Pool.
### Ubuntu 20.04
Expand Down
31 changes: 17 additions & 14 deletions external/src/Tari/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ cmake_minimum_required(VERSION 3.10)
project(Tari_gRPC)

set(HEADERS
proto/gRPC/base_node.pb.h
proto/gRPC/block.pb.h
proto/gRPC/network.pb.h
proto/gRPC/sidechain_types.pb.h
proto/gRPC/transaction.pb.h
proto/gRPC/types.pb.h
../protobuf-c/protobuf-c/protobuf-c.h
proto/gRPC/google/protobuf/timestamp.pb-c.h
proto/gRPC/base_node.pb-c.h
proto/gRPC/block.pb-c.h
proto/gRPC/network.pb-c.h
proto/gRPC/sidechain_types.pb-c.h
proto/gRPC/transaction.pb-c.h
proto/gRPC/types.pb-c.h
proto.h
)

set(SOURCES
proto/gRPC/base_node.pb.cc
proto/gRPC/block.pb.cc
proto/gRPC/network.pb.cc
proto/gRPC/sidechain_types.pb.cc
proto/gRPC/transaction.pb.cc
proto/gRPC/types.pb.cc
../protobuf-c/protobuf-c/protobuf-c.c
proto/gRPC/google/protobuf/timestamp.pb-c.c
proto/gRPC/base_node.pb-c.c
proto/gRPC/block.pb-c.c
proto/gRPC/network.pb-c.c
proto/gRPC/sidechain_types.pb-c.c
proto/gRPC/transaction.pb-c.c
proto/gRPC/types.pb-c.c
)

include_directories(../protobuf/src)
include_directories(../protobuf/third_party/abseil-cpp)
include_directories(../protobuf-c)

set(DISABLE_WARNINGS ON)

Expand Down
16 changes: 10 additions & 6 deletions external/src/Tari/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
#pragma warning(push, 0)
#endif

#include "proto/gRPC/base_node.pb.h"
#include "proto/gRPC/block.pb.h"
#include "proto/gRPC/network.pb.h"
#include "proto/gRPC/sidechain_types.pb.h"
#include "proto/gRPC/transaction.pb.h"
#include "proto/gRPC/types.pb.h"
extern "C" {

#include "proto/gRPC/base_node.pb-c.h"
#include "proto/gRPC/block.pb-c.h"
#include "proto/gRPC/network.pb-c.h"
#include "proto/gRPC/sidechain_types.pb-c.h"
#include "proto/gRPC/transaction.pb-c.h"
#include "proto/gRPC/types.pb-c.h"

}

#ifdef _MSC_VER
#pragma warning(pop)
Expand Down
Loading

0 comments on commit 6d39ea4

Please sign in to comment.