From 8c69a191409cdfe7db1c8c12a0093dd674d256e9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 20 Dec 2021 14:01:44 +0800 Subject: [PATCH 1/4] more --- cmake/craft_CMakeLists.txt.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/craft_CMakeLists.txt.in b/cmake/craft_CMakeLists.txt.in index a77fa679e0..199881b293 100644 --- a/cmake/craft_CMakeLists.txt.in +++ b/cmake/craft_CMakeLists.txt.in @@ -4,9 +4,9 @@ ExternalProject_Add(craft GIT_REPOSITORY https://github.com/canonical/raft.git GIT_TAG v0.11.2 SOURCE_DIR "${CMAKE_CONTRIB_DIR}/craft" - BINARY_DIR "${CMAKE_CONTRIB_DIR}/craft/.libs" + BINARY_DIR "${CMAKE_CONTRIB_DIR}/craft" #BUILD_IN_SOURCE TRUE - CONFIGURE_COMMAND "autoreconf -i && ./configure" + CONFIGURE_COMMAND "autoreconf -i && ./configure --enable-example" BUILD_COMMAND "$(MAKE)" INSTALL_COMMAND "" TEST_COMMAND "" From dafefe0b6f9f01fa7cf19d06ccf99aadc9687800 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 20 Dec 2021 14:44:36 +0800 Subject: [PATCH 2/4] make compile --- cmake/craft_CMakeLists.txt.in | 3 ++- contrib/CMakeLists.txt | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/craft_CMakeLists.txt.in b/cmake/craft_CMakeLists.txt.in index 199881b293..3a951c1c99 100644 --- a/cmake/craft_CMakeLists.txt.in +++ b/cmake/craft_CMakeLists.txt.in @@ -6,7 +6,8 @@ ExternalProject_Add(craft SOURCE_DIR "${CMAKE_CONTRIB_DIR}/craft" BINARY_DIR "${CMAKE_CONTRIB_DIR}/craft" #BUILD_IN_SOURCE TRUE - CONFIGURE_COMMAND "autoreconf -i && ./configure --enable-example" + # https://answers.ros.org/question/333125/how-to-include-external-automakeautoconf-projects-into-ament_cmake/ + CONFIGURE_COMMAND COMMAND autoreconf -i COMMAND ./configure --enable-example BUILD_COMMAND "$(MAKE)" INSTALL_COMMAND "" TEST_COMMAND "" diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 0aadaccfa1..fa3bff41ae 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -42,7 +42,7 @@ endif(${BUILD_WITH_CRAFT}) # bdb if(${BUILD_WITH_BDB}) cat("${CMAKE_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) -endif(${BUILD_WITH_DBD}) +endif(${BUILD_WITH_BDB}) # sqlite if(${BUILD_WITH_SQLITE}) @@ -154,11 +154,11 @@ if(${BUILD_WITH_CRAFT}) add_library(craft STATIC IMPORTED GLOBAL) set_target_properties(craft PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/craft/.libs/libraft.a" - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/craft" - ) - target_link_libraries(craft - INTERFACE pthread + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/craft/include" ) + # target_link_libraries(craft + # INTERFACE pthread + # ) endif(${BUILD_WITH_CRAFT}) # BDB From a0ea401732cbdcfaf1de42d40957b1fc7e27be3a Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 20 Dec 2021 14:54:48 +0800 Subject: [PATCH 3/4] make compile --- contrib/test/CMakeLists.txt | 4 ++++ contrib/test/craft/CMakeLists.txt | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 contrib/test/craft/CMakeLists.txt diff --git a/contrib/test/CMakeLists.txt b/contrib/test/CMakeLists.txt index 0a333f604c..330fe8f70f 100644 --- a/contrib/test/CMakeLists.txt +++ b/contrib/test/CMakeLists.txt @@ -15,4 +15,8 @@ if(${BUILD_WITH_SQLITE}) add_subdirectory(sqlite) endif(${BUILD_WITH_SQLITE}) +if(${BUILD_WITH_CRAFT}) + add_subdirectory(craft) +endif(${BUILD_WITH_CRAFT}) + add_subdirectory(tdev) diff --git a/contrib/test/craft/CMakeLists.txt b/contrib/test/craft/CMakeLists.txt new file mode 100644 index 0000000000..a6659b3518 --- /dev/null +++ b/contrib/test/craft/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(simulate_vnode "simulate_vnode.c") +target_link_libraries(simulate_vnode PUBLIC craft lz4) \ No newline at end of file From d0ea2682b092880b6ad588e9ee6f330789f6b211 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 20 Dec 2021 15:05:01 +0800 Subject: [PATCH 4/4] integrate libuv --- cmake/cmake.options | 6 ++++++ cmake/libuv_CMakeLists.txt.in | 12 ++++++++++++ contrib/CMakeLists.txt | 11 +++++++++++ contrib/test/craft/CMakeLists.txt | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 cmake/libuv_CMakeLists.txt.in diff --git a/cmake/cmake.options b/cmake/cmake.options index 8eec896af1..44fa8c7e4b 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -44,6 +44,12 @@ option( OFF ) +option( + BUILD_WITH_UV + "If build with libuv" + OFF +) + option( BUILD_WITH_CRAFT "If build with canonical-raft" diff --git a/cmake/libuv_CMakeLists.txt.in b/cmake/libuv_CMakeLists.txt.in new file mode 100644 index 0000000000..ed406e089e --- /dev/null +++ b/cmake/libuv_CMakeLists.txt.in @@ -0,0 +1,12 @@ + +# libuv +ExternalProject_Add(libuv + GIT_REPOSITORY https://github.com/libuv/libuv.git + GIT_TAG v1.42.0 + SOURCE_DIR "${CMAKE_CONTRIB_DIR}/libuv" + BINARY_DIR "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + ) \ No newline at end of file diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index fa3bff41ae..041727b0f7 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -37,8 +37,14 @@ endif(${BUILD_WITH_ROCKSDB}) # canonical-raft if(${BUILD_WITH_CRAFT}) cat("${CMAKE_SUPPORT_DIR}/craft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) + option(BUILD_WITH_UV "" ON) endif(${BUILD_WITH_CRAFT}) +#libuv +if(${BUILD_WITH_UV}) + cat("${CMAKE_SUPPORT_DIR}/libuv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif(${BUILD_WITH_UV}) + # bdb if(${BUILD_WITH_BDB}) cat("${CMAKE_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) @@ -161,6 +167,11 @@ if(${BUILD_WITH_CRAFT}) # ) endif(${BUILD_WITH_CRAFT}) +# LIBUV +if(${BUILD_WITH_UV}) + add_subdirectory(libuv) +endif(${BUILD_WITH_UV}) + # BDB if(${BUILD_WITH_BDB}) add_library(bdb STATIC IMPORTED GLOBAL) diff --git a/contrib/test/craft/CMakeLists.txt b/contrib/test/craft/CMakeLists.txt index a6659b3518..e0f6ae64bd 100644 --- a/contrib/test/craft/CMakeLists.txt +++ b/contrib/test/craft/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(simulate_vnode "simulate_vnode.c") -target_link_libraries(simulate_vnode PUBLIC craft lz4) \ No newline at end of file +target_link_libraries(simulate_vnode PUBLIC craft lz4 uv_a) \ No newline at end of file