From 53fbfbdfa86b0a25ea9957c78b7d86e80cb0b109 Mon Sep 17 00:00:00 2001 From: Brian Szmyd Date: Tue, 7 May 2024 11:36:17 -0600 Subject: [PATCH] Bump nuraft to latest HEAD. (#82) * Bump nuraft to latest HEAD. --- .github/workflows/build_dependencies.yml | 2 +- 3rd_party/nuraft/conandata.yml | 15 +++ 3rd_party/nuraft/conanfile.py | 14 +- 3rd_party/nuraft/patches/2-4-0.patch | 165 +++++++++++++++++++++++ conanfile.py | 4 +- 5 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 3rd_party/nuraft/conandata.yml create mode 100644 3rd_party/nuraft/patches/2-4-0.patch diff --git a/.github/workflows/build_dependencies.yml b/.github/workflows/build_dependencies.yml index 83fd5e3..21ef6f3 100644 --- a/.github/workflows/build_dependencies.yml +++ b/.github/workflows/build_dependencies.yml @@ -130,7 +130,7 @@ jobs: - name: Export Recipes run: | conan export import/sisl oss/master - conan export 3rd_party/nuraft + conan export 3rd_party/nuraft nuraft/2.4.0@ 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' }} diff --git a/3rd_party/nuraft/conandata.yml b/3rd_party/nuraft/conandata.yml new file mode 100644 index 0000000..4bad29a --- /dev/null +++ b/3rd_party/nuraft/conandata.yml @@ -0,0 +1,15 @@ +sources: + "2.4.0": + url: "https://github.com/eBay/nuraft/archive/929132f5a0e86ab3070055c63b485a512f82bcb0.tar.gz" + sha256: "8894be82d396fe3b8eb3ed6e03e65e398c81779bf8c1f8e2345530f8e80da5b3" + "2.3.0": + url: "https://github.com/eBay/nuraft/archive/f42b12c3ec9f20a085de61e1294e8167fa747c7d.tar.gz" +patches: + "2.4.0": + - patch_file: "patches/2-4-0.patch" + patch_description: "Dependency discovery" + patch_type: "conan" + "2.3.0": + - patch_file: "patches/patch.diff" + patch_description: "Dependency discovery" + patch_type: "conan" diff --git a/3rd_party/nuraft/conanfile.py b/3rd_party/nuraft/conanfile.py index 28437f4..0128fb8 100644 --- a/3rd_party/nuraft/conanfile.py +++ b/3rd_party/nuraft/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import patch, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os required_conan_version = ">=1.53.0" @@ -10,12 +10,11 @@ class NuRaftConan(ConanFile): name = "nuraft" - homepage = "https://github.corp.ebay.com/sds/NuRaft" + homepage = "https://github.com/eBay/nuraft" description = """Cornerstone based RAFT library.""" topics = ("raft",) - url = "https://github.com/conan-io/conan-center-index" + url = "https://github.com/eBay/nuraft" license = "Apache-2.0" - version = "2.3.0" package_type = "library" settings = "os", "arch", "compiler", "build_type" @@ -30,7 +29,8 @@ class NuRaftConan(ConanFile): "asio": "boost", } - exports_sources = "patches/*" + def export_sources(self): + export_conandata_patches(self) def configure(self): if self.options.shared: @@ -55,7 +55,7 @@ def validate(self): check_min_cppstd(self, 11) def source(self): - get(self, "https://github.com/eBay/nuraft/archive/f42b12c3ec9f20a085de61e1294e8167fa747c7d.tar.gz", strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -64,7 +64,7 @@ def generate(self): deps.generate() def build(self): - patch(self, patch_file="patches/patch.diff") + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/3rd_party/nuraft/patches/2-4-0.patch b/3rd_party/nuraft/patches/2-4-0.patch new file mode 100644 index 0000000..87ece89 --- /dev/null +++ b/3rd_party/nuraft/patches/2-4-0.patch @@ -0,0 +1,165 @@ +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2024-05-06 13:23:42.000000000 -0700 ++++ b/CMakeLists.txt 2024-05-07 10:13:57.568884730 -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) +@@ -82,24 +65,11 @@ + 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 () + + else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5045 /wd4571 /wd4774 /wd4820 /wd5039 /wd4626 /wd4625 /wd5026 /wd5027 /wd4623 /wd4996 /wd4530 /wd4267 /wd4244 /W3") + message(STATUS "---- WIN32 ----") +- set(DISABLE_SSL 1) + endif () + + # === Disable SSL === +@@ -264,6 +234,7 @@ + ${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 + $) +@@ -271,70 +242,11 @@ + # === 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 +- $ +- $ +-) +- +-target_include_directories(static_lib +- PUBLIC +- $ +- $ +-) +- +-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 +- ) +- +- # 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 diff --git a/conanfile.py b/conanfile.py index 19243e7..945e2ef 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,7 +10,7 @@ class NuRaftMesgConan(ConanFile): name = "nuraft_mesg" - version = "3.4.1" + version = "3.5.1" homepage = "https://github.com/eBay/nuraft_mesg" description = "A gRPC service for NuRAFT" @@ -67,7 +67,7 @@ def build_requirements(self): def requirements(self): self.requires("boost/1.83.0", transitive_headers=True) self.requires("sisl/[~12.2, include_prerelease=True]@oss/master", transitive_headers=True) - self.requires("nuraft/2.3.0", transitive_headers=True) + self.requires("nuraft/2.4.0", transitive_headers=True) def layout(self): cmake_layout(self)