Skip to content

Commit

Permalink
Update nuraft library.
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Oct 4, 2023
1 parent 4ae2a0e commit ad3a16f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
4 changes: 2 additions & 2 deletions 3rd_party/nuraft/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NuRaftConan(ConanFile):
topics = ("raft",)
url = "https://github.com/conan-io/conan-center-index"
license = "Apache-2.0"
version = "2.2.0"
version = "2.3.0"

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
Expand Down Expand Up @@ -55,7 +55,7 @@ def validate(self):
check_min_cppstd(self, 11)

def source(self):
get(self, "https://github.com/eBay/nuraft/archive/62d73b52b6897d4ec1c02d77fe5f7909705399be.tar.gz", strip_root=True)
get(self, "https://github.com/eBay/nuraft/archive/f42b12c3ec9f20a085de61e1294e8167fa747c7d.tar.gz", strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
Expand Down
57 changes: 35 additions & 22 deletions 3rd_party/nuraft/patches/patch.diff
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20024fc..aa8f09d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2023-10-02 16:14:29.000000000 -0700
+++ b/CMakeLists.txt 2023-10-04 14:47:30.034743439 -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 @@ endif()
@@ -26,41 +27,23 @@


# === Find ASIO ===
Expand Down Expand Up @@ -57,7 +56,7 @@ index 20024fc..aa8f09d 100644
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 @@ if (NOT WIN32)
@@ -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")
Expand All @@ -82,23 +81,39 @@ index 20024fc..aa8f09d 100644
endif ()

# === Disable SSL ===
@@ -271,6 +241,7 @@ set(RAFT_CORE
@@ -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
$<TARGET_OBJECTS:RAFT_CORE_OBJ>)
@@ -278,54 +249,11 @@ set(STATIC_LIB_SRC
@@ -271,69 +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
- $<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 ()
Expand All @@ -112,11 +127,9 @@ index 20024fc..aa8f09d 100644
-
-# === Examples ===
-add_subdirectory("${PROJECT_SOURCE_DIR}/examples")
+add_library(nuraft ${STATIC_LIB_SRC})
+target_link_libraries(nuraft ${ASIO_DEP} openssl::openssl)


# === Tests ===
-
-
-# === Tests ===
-add_subdirectory("${PROJECT_SOURCE_DIR}/tests")
-
-
Expand All @@ -140,12 +153,12 @@ index 20024fc..aa8f09d 100644
- )
-endif()
-
-
-# === Install Targets ===
-install(TARGETS static_lib ARCHIVE DESTINATION lib)
-install(TARGETS shared_lib LIBRARY DESTINATION lib)
+install(TARGETS nuraft ARCHIVE DESTINATION lib)
+install(TARGETS nuraft LIBRARY DESTINATION lib)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/libnuraft DESTINATION include)
-
-
+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
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def build_requirements(self):

def requirements(self):
self.requires("sisl/[~=10, include_prerelease=True]@oss/master")
self.requires("nuraft/2.2.0")
self.requires("nuraft/2.3.0")

self.requires("boost/1.82.0")
self.requires("openssl/3.1.1")
Expand Down

0 comments on commit ad3a16f

Please sign in to comment.