diff --git a/.travis.yml b/.travis.yml index c749b08d..568fa942 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ matrix: - os: osx osx_image: xcode10 env: - - MATRIX_EVAL="brew update && brew unlink python && brew install protobuf && brew install snappy && brew install openssl && brew install cmake" + - MATRIX_EVAL="brew update && brew unlink python && brew install protobuf && brew install snappy && brew install lz4 && brew install openssl && brew install cmake" - CMAKE_URL="https://cmake.org/files/v3.12/cmake-3.12.1-Darwin-x86_64.tar.gz" - CMAKE_COMMAND="cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" diff --git a/CMakeLists.txt b/CMakeLists.txt index f3ec8c62..10a0c215 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,10 @@ set(CMAKE_C_FLAGS ${warnings}) # find packages include(cmake/add_gmock_test.cmake) +include(FindProtobuf) +find_package(Protobuf REQUIRED) +include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR}) + set(REQUIRED_BOOST "1.68.0") set(Boost_USE_STATIC_LIBS on) diff --git a/README.md b/README.md index c404f0db..1054ccde 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This will result in a custom Boost install at `~/myboost/1_68_0/`that will not c **Other dependencies \(Protobuf, CMake\)** ```text -$ brew update && brew install protobuf && brew install snappy && brew upgrade cmake +$ brew update && brew install protobuf && brew install snappy && brew install lz4 && brew upgrade cmake ``` **ccache \(Optional\)** diff --git a/audit/test/CMakeLists.txt b/audit/test/CMakeLists.txt index c9bf0dd1..ac0a4a7e 100644 --- a/audit/test/CMakeLists.txt +++ b/audit/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(test_srcs audit_test.cpp) -set(test_libs audit proto protobuf.a) +set(test_libs audit proto ${Protobuf_LIBRARIES}) add_gmock_test(audit) diff --git a/cmake/rocksdb.cmake b/cmake/rocksdb.cmake index a9811ed2..4912b949 100644 --- a/cmake/rocksdb.cmake +++ b/cmake/rocksdb.cmake @@ -86,3 +86,15 @@ ExternalProject_Get_Property(rocksdb binary_dir) link_directories(${binary_dir}/) set(ROCKSDB_LIBRARIES ${binary_dir}/librocksdb.a ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}) + +if (APPLE) + find_library(LZ4_LIBRARY NAMES liblz4.a) + message(STATUS ${LZ4_LIBRARY}) + list(APPEND ROCKSDB_LIBRARIES ${LZ4_LIBRARY}) + + # rocksdb may of found this library? + find_library(ZSTD_LIBRARY NAMES libzstd.a) + if (ZSTD_LIBRARY) + list(APPEND ROCKSDB_LIBRARIES ${ZSTD_LIBRARY}) + endif() +endif() diff --git a/crud/test/CMakeLists.txt b/crud/test/CMakeLists.txt index f3b4c1b0..7a19ec43 100644 --- a/crud/test/CMakeLists.txt +++ b/crud/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(test_srcs crud_test.cpp subscription_manager_test.cpp) -set(test_libs crud node storage bootstrap raft proto protobuf.a) +set(test_libs crud node storage bootstrap raft proto ${Protobuf_LIBRARIES}) add_gmock_test(crud) diff --git a/http/test/CMakeLists.txt b/http/test/CMakeLists.txt index 69a5670d..ad8dc058 100644 --- a/http/test/CMakeLists.txt +++ b/http/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(test_srcs server_test.cpp connection_test.cpp) -set(test_libs http proto protobuf.a) +set(test_libs http proto ${Protobuf_LIBRARIES}) add_gmock_test(http) diff --git a/node/test/CMakeLists.txt b/node/test/CMakeLists.txt index 722e327f..995585f9 100644 --- a/node/test/CMakeLists.txt +++ b/node/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(test_srcs node_test.cpp session_test.cpp) -set(test_libs node proto protobuf.a) +set(test_libs node proto ${Protobuf_LIBRARIES}) add_gmock_test(node) diff --git a/pbft/test/CMakeLists.txt b/pbft/test/CMakeLists.txt index 78d97c5a..213c2277 100644 --- a/pbft/test/CMakeLists.txt +++ b/pbft/test/CMakeLists.txt @@ -1,5 +1,5 @@ set(test_srcs pbft_test.cpp pbft_operation_test.cpp pbft_failure_detector_test.cpp pbft_audit_test.cpp pbft_test_common.cpp pbft_checkpoint_tests.cpp) -set(test_libs pbft protobuf.a bootstrap) +set(test_libs pbft ${Protobuf_LIBRARIES} bootstrap) add_gmock_test(pbft) diff --git a/proto/CMakeLists.txt b/proto/CMakeLists.txt index 71b1e8cc..df0aa5de 100644 --- a/proto/CMakeLists.txt +++ b/proto/CMakeLists.txt @@ -1,6 +1,3 @@ -include(FindProtobuf) -find_package(Protobuf REQUIRED) -include_directories(${PROTOBUF_INCLUDE_DIR}) protobuf_generate_cpp(PROTO_SRC PROTO_HEADER bluzelle.proto database.proto pbft.proto audit.proto) add_library(proto ${PROTO_HEADER} ${PROTO_SRC}) set_target_properties(proto PROPERTIES COMPILE_FLAGS "-Wno-unused") diff --git a/raft/test/CMakeLists.txt b/raft/test/CMakeLists.txt index 8c6bf44c..23d77477 100644 --- a/raft/test/CMakeLists.txt +++ b/raft/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(test_srcs raft_test.cpp raft_log_test.cpp) -set(test_libs raft storage bootstrap proto protobuf) +set(test_libs raft storage bootstrap proto ${Protobuf_LIBRARIES}) add_gmock_test(raft) diff --git a/swarm/CMakeLists.txt b/swarm/CMakeLists.txt index 994a09ef..e184a3d2 100644 --- a/swarm/CMakeLists.txt +++ b/swarm/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable(swarm main.cpp) -add_dependencies(swarm jsoncpp) # rocksdb -target_include_directories(swarm PRIVATE ${JSONCPP_INCLUDE_DIRS}) -target_link_libraries(swarm node http raft pbft audit crud options ethereum bootstrap storage proto protobuf.a status ${Boost_LIBRARIES} ${JSONCPP_LIBRARIES} pthread) +add_dependencies(swarm jsoncpp rocksdb) +target_include_directories(swarm PRIVATE ${JSONCPP_INCLUDE_DIRS} ${ROCKSDB_INCLUDE_DIRS}) +target_link_libraries(swarm node http raft pbft audit crud options ethereum bootstrap storage proto ${Protobuf_LIBRARIES} status ${ROCKSDB_LIBRARIES} ${Boost_LIBRARIES} ${JSONCPP_LIBRARIES} pthread)