Skip to content

Commit

Permalink
Update NuRaft to 2.4.4 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd authored Jan 24, 2025
1 parent 90702dd commit d056423
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ jobs:
platform: ${{ inputs.platform }}
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Export Recipes
- name: Prepare Recipes
run: |
conan export import/sisl oss/master
conan export 3rd_party/nuraft nuraft/2.4.3@
./prepare.sh
cached_pkgs=$(ls -1d ~/.conan/data/*/*/*/*/package | sed 's,.*data/,,' | cut -d'/' -f1,2 | paste -sd',' - -)
echo "::info:: Pre-cached: ${cached_pkgs}"
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}
Expand Down
7 changes: 7 additions & 0 deletions 3rd_party/nuraft/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.4.4":
url: "https://github.com/eBay/nuraft/archive/f9c74627f34726f85f5cf9bcc969134f308fc471.tar.gz"
sha256: "4b38f4bef41518a124af4003c3ed277d82eead3c842d02f57b068f3770193ab6"
"2.4.3":
url: "https://github.com/eBay/nuraft/archive/1adcc6282109c2ddf1121bbc374d48d303145e39.tar.gz"
sha256: "84ff05ce33f49955829377134bb9c06cb1bc0c82f1a9ef388a8068a05a300083"
Expand All @@ -14,6 +17,10 @@ sources:
"2.3.0":
url: "https://github.com/eBay/nuraft/archive/f42b12c3ec9f20a085de61e1294e8167fa747c7d.tar.gz"
patches:
"2.4.4":
- patch_file: "patches/2-4-4.patch"
patch_description: "Dependency discovery"
patch_type: "conan"
"2.4.3":
- patch_file: "patches/2-4-3.patch"
patch_description: "Dependency discovery"
Expand Down
163 changes: 163 additions & 0 deletions 3rd_party/nuraft/patches/2-4-4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
diff -Naur CMakeLists.txt.orig CMakeLists.txt
--- CMakeLists.txt.orig 2025-01-23 00:46:29.000000000 -0700
+++ CMakeLists.txt 2025-01-23 08:06:00.169302782 -0700
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(NuRaft VERSION 1.0.0 LANGUAGES CXX)
+set (CMAKE_CXX_STANDARD 11)

# === Build type (default: RelWithDebInfo, O2) ===========
if (NOT CMAKE_BUILD_TYPE)
@@ -26,41 +27,23 @@


# === Find ASIO ===
-if (BOOST_INCLUDE_PATH AND BOOST_LIBRARY_PATH)
+find_package(OpenSSL CONFIG REQUIRED)
+find_package(Boost CONFIG)
+if (Boost_FOUND)
# If Boost path (both include and library) is given,
# use Boost's ASIO.
- message(STATUS "Boost include path: " ${BOOST_INCLUDE_PATH})
- message(STATUS "Boost library path: " ${BOOST_LIBRARY_PATH})
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BOOST_ASIO")
-
- set(ASIO_INCLUDE_DIR ${BOOST_INCLUDE_PATH})
- set(LIBBOOST_SYSTEM "${BOOST_LIBRARY_PATH}/libboost_system.a")
-
+ set(ASIO_DEP boost::boost)
else ()
# If not, ASIO standalone mode.
- FIND_PATH(ASIO_INCLUDE_DIR
- NAME asio.hpp
- HINTS ${PROJECT_SOURCE_DIR}/asio/asio/include
- $ENV{HOME}/local/include
- /opt/local/include
- /usr/local/include
- /usr/include)
-
+ find_package(Asio CONFIG REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASIO_STANDALONE")
-
-endif ()
-
-if (NOT ASIO_INCLUDE_DIR)
- message(FATAL_ERROR "Can't find ASIO header files")
-else ()
- message(STATUS "ASIO include path: " ${ASIO_INCLUDE_DIR})
+ set(ASIO_DEP asio::asio)
endif ()


# === Includes ===
include_directories(BEFORE ./)
-include_directories(BEFORE ${ASIO_INCLUDE_DIR})
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include/libnuraft)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/examples)
@@ -83,19 +66,7 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
- if (APPLE)
-# include_directories(BEFORE
-# /usr/local/opt/openssl/include
-# )
-# link_directories(
-# /usr/local/opt/openssl/lib
-# )
- else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
- endif ()
if (USE_PTHREAD_EXIT)
message(STATUS "Using ::pthread_exit for termination")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_PTHREAD_EXIT")
@@ -273,80 +244,17 @@
${ROOT_SRC}/stat_mgr.cxx
)
add_library(RAFT_CORE_OBJ OBJECT ${RAFT_CORE})
+target_link_libraries(RAFT_CORE_OBJ ${ASIO_DEP} openssl::openssl)

set(STATIC_LIB_SRC
$<TARGET_OBJECTS:RAFT_CORE_OBJ>)

# === Executables ===
-set(LIBRARY_NAME "nuraft")
-
-add_library(static_lib ${STATIC_LIB_SRC})
-add_library(NuRaft::static_lib ALIAS static_lib)
-set_target_properties(static_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1)
-
-add_library(shared_lib SHARED ${STATIC_LIB_SRC})
-add_library(NuRaft::shared_lib ALIAS shared_lib)
-set_target_properties(shared_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1)
-
-# Include directories are necessary for dependents to use the targets.
-target_include_directories(static_lib
- PUBLIC
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
-)
-
-target_include_directories(static_lib
- PUBLIC
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
-)
-
-if (APPLE)
- target_link_libraries(shared_lib ${LIBRARIES})
-endif ()
-
-if (WIN32)
- set(LIBRARY_OUTPUT_NAME "${LIBRARY_NAME}.lib")
-else ()
- set(LIBRARY_OUTPUT_NAME "lib${LIBRARY_NAME}.a")
-endif ()
-message(STATUS "Output library file name: ${LIBRARY_OUTPUT_NAME}")
-
-# === Examples ===
-add_subdirectory("${PROJECT_SOURCE_DIR}/examples")
-
-
-# === Tests ===
-add_subdirectory("${PROJECT_SOURCE_DIR}/tests")
-
-
-if (CODE_COVERAGE GREATER 0)
- set(CODE_COVERAGE_DEPS
- raft_server_test
- failure_test
- asio_service_test
- buffer_test
- serialization_test
- timer_test
- strfmt_test
- stat_mgr_test
- logger_test
- new_joiner_test
- asio_service_stream_test
- stream_functional_test
- )
-
- # lcov
- SETUP_TARGET_FOR_COVERAGE(
- NAME raft_cov
- EXECUTABLE ./runtests.sh
- DEPENDENCIES ${CODE_COVERAGE_DEPS}
- )
-endif()
-
+add_library(nuraft ${STATIC_LIB_SRC})
+target_link_libraries(nuraft ${ASIO_DEP} openssl::openssl)

# === Install Targets ===
-install(TARGETS shared_lib static_lib
+install(TARGETS nuraft
EXPORT nuraft-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
5 changes: 2 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

class NuRaftMesgConan(ConanFile):
name = "nuraft_mesg"
version = "3.7.1"

version = "3.7.2"
homepage = "https://github.com/eBay/nuraft_mesg"
description = "A gRPC service for NuRAFT"
topics = ("ebay", "nublox", "raft")
Expand Down Expand Up @@ -66,7 +65,7 @@ def build_requirements(self):
def requirements(self):
self.requires("boost/1.83.0", transitive_headers=True)
self.requires("sisl/[^12.2]@oss/master", transitive_headers=True)
self.requires("nuraft/2.4.3", transitive_headers=True)
self.requires("nuraft/2.4.4", transitive_headers=True)

def layout(self):
self.folders.source = "."
Expand Down
6 changes: 6 additions & 0 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set -eu

echo -n "Exporting custom recipes..."
echo -n "nuraft."
conan export 3rd_party/nuraft nuraft/2.4.4@
echo "done."
6 changes: 6 additions & 0 deletions prepare_v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set -eu

echo -n "Exporting custom recipes..."
echo -n "nuraft."
conan export 3rd_party/nuraft --name nuraft --version 2.4.4 >/dev/null
echo "done."

0 comments on commit d056423

Please sign in to comment.