Skip to content

Commit

Permalink
fix:fixed a bug that included braft (#163)
Browse files Browse the repository at this point in the history
* fix:fixed a bug that included braft
  • Loading branch information
panlei-coder authored Feb 3, 2024
1 parent cfe3482 commit aea6aca
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cmake/braft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SET(BRAFT_INSTALL_DIR ${THIRD_PARTY_PATH}/install/braft)
SET(BRAFT_INCLUDE_DIR "${BRAFT_INSTALL_DIR}/include" CACHE PATH "braft include directory." FORCE)
SET(BRAFT_LIBRARIES "${BRAFT_INSTALL_DIR}/lib/libbraft.a" CACHE FILEPATH "braft library." FORCE)

SET(NUM_OF_PROCESSOR 1)

set(prefix_path "${THIRD_PARTY_PATH}/install/brpc|${CMAKE_CURRENT_BINARY_DIR}/_deps/gflags-build|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${CMAKE_CURRENT_BINARY_DIR}/_deps/glog-src/src|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-build")

ExternalProject_Add(
Expand Down
2 changes: 2 additions & 0 deletions cmake/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SET(BRPC_INSTALL_DIR ${THIRD_PARTY_PATH}/install/brpc)
SET(BRPC_INCLUDE_DIR "${BRPC_INSTALL_DIR}/include" CACHE PATH "brpc include directory." FORCE)
SET(BRPC_LIBRARIES "${BRPC_INSTALL_DIR}/lib/libbrpc.a" CACHE FILEPATH "brpc library." FORCE)

SET(NUM_OF_PROCESSOR 1)

# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args
set(prefix_path "${CMAKE_CURRENT_BINARY_DIR}/_deps/gflags-build|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${CMAKE_CURRENT_BINARY_DIR}/_deps/glog-src/src|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-build")

Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ TARGET_INCLUDE_DIRECTORIES(pikiwidb PRIVATE
${PROJECT_SOURCE_DIR}/src/storage/include
${rocksdb_SOURCE_DIR}/
${rocksdb_SOURCE_DIR}/include
PRIVATE ${BRAFT_INCLUDE_DIR}
PRIVATE ${BRPC_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(pikiwidb net; dl; leveldb; fmt; pikiwidb-folly; storage; rocksdb)
TARGET_LINK_LIBRARIES(pikiwidb net; dl; leveldb; fmt; pikiwidb-folly; storage; rocksdb; braft brpc ssl crypto zlib protobuf leveldb gflags)
SET_TARGET_PROPERTIES(pikiwidb PROPERTIES LINKER_LANGUAGE CXX)
1 change: 1 addition & 0 deletions src/pstd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ADD_SUBDIRECTORY(tests)

TARGET_INCLUDE_DIRECTORIES(pstd
PRIVATE ${rocksdb_SOURCE_DIR}/include
PRIVATE ${GLOG_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(pstd; spdlog pthread glog)
Expand Down
33 changes: 29 additions & 4 deletions src/storage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# #AUX_SOURCE_DIRECTORY(./src STORAGE_SRC)
# FILE(GLOB STORAGE_SRC
# "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc"
# "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/storage/*.h"
# )
# SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# ADD_LIBRARY(storage ${STORAGE_SRC})

# TARGET_INCLUDE_DIRECTORIES(storage
# PUBLIC ${CMAKE_SOURCE_DIR}/src
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
# PRIVATE ${rocksdb_SOURCE_DIR}/
# PRIVATE ${rocksdb_SOURCE_DIR}/include
# )

# TARGET_LINK_LIBRARIES(storage pstd glog rocksdb)

# SET_TARGET_PROPERTIES(storage PROPERTIES LINKER_LANGUAGE CXX)

####################################zzz########################################

#AUX_SOURCE_DIRECTORY(./src STORAGE_SRC)
FILE(GLOB STORAGE_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc"
Expand All @@ -9,12 +32,14 @@ ADD_LIBRARY(storage ${STORAGE_SRC})

TARGET_INCLUDE_DIRECTORIES(storage
PUBLIC ${CMAKE_SOURCE_DIR}/src
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${rocksdb_SOURCE_DIR}/
PRIVATE ${rocksdb_SOURCE_DIR}/include
PRIVATE ${BRAFT_INCLUDE_DIR}
PRIVATE ${BRPC_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(storage pstd glog rocksdb)
# TARGET_LINK_LIBRARIES(storage pstd glog rocksdb)
TARGET_LINK_LIBRARIES (storage pstd braft brpc ssl crypto zlib protobuf leveldb gflags glog rocksdb)

SET_TARGET_PROPERTIES(storage PROPERTIES LINKER_LANGUAGE CXX)
2 changes: 2 additions & 0 deletions src/storage/include/storage/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include "pstd/pstd_mutex.h"

#include "braft/raft.h"

namespace storage {

inline constexpr double ZSET_SCORE_MAX = std::numeric_limits<double>::max();
Expand Down
2 changes: 2 additions & 0 deletions src/storage/src/base_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "src/base_meta_value_format.h"
#include "src/debug.h"

#include "braft/raft.h"

namespace storage {

class BaseMetaFilter : public rocksdb::CompactionFilter {
Expand Down
2 changes: 2 additions & 0 deletions src/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <shared_mutex>
#include <vector>

#include "braft/raft.h"

namespace pikiwidb {

using PSTRING = PString*;
Expand Down

0 comments on commit aea6aca

Please sign in to comment.