Browse Source

remove dependencies from deps, check them out as external projects (#12)

pull/14/head
Yura Zarudniy 5 years ago
committed by GitHub
parent
commit
94a4a35617
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      .gitmodules
  2. 11
      CMakeLists.txt
  3. 8
      cmake/Hunter/config.cmake
  4. 40
      cmake/boost_di.cmake
  5. 10
      cmake/dependencies.cmake
  6. 39
      cmake/hat-trie.cmake
  7. 1
      deps/di
  8. 1
      deps/hat-trie
  9. 1
      deps/spdlog
  10. 3
      example/01-echo/CMakeLists.txt
  11. 3
      src/common/CMakeLists.txt
  12. 2
      src/common/logger.cpp
  13. 1
      src/network/impl/CMakeLists.txt
  14. 5
      test/acceptance/p2p/host/host_integration_test.cpp
  15. 2
      test/acceptance/p2p/host/peer/CMakeLists.txt
  16. 3
      test/deps/CMakeLists.txt
  17. 2
      test/libp2p/injector/CMakeLists.txt
  18. 1
      test/libp2p/security/CMakeLists.txt

9
.gitmodules

@ -1,9 +0,0 @@
[submodule "deps/di"]
path = deps/di
url = https://github.com/boost-experimental/di
[submodule "deps/hat-trie"]
path = deps/hat-trie
url = https://github.com/Tessil/hat-trie.git
[submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog

11
CMakeLists.txt

@ -85,23 +85,14 @@ if (CLANG_FORMAT)
endif ()
include_directories(
SYSTEM
# project includes
${PROJECT_SOURCE_DIR}/include
)
include_directories(
SYSTEM
# system includes
deps/di/include
deps/di/extension/include
deps/hat-trie/include
deps/spdlog/include
)
add_subdirectory(src)
add_subdirectory(example)
if(TESTING)
enable_testing()
add_subdirectory(test)

8
cmake/Hunter/config.cmake

@ -1,10 +1,16 @@
hunter_config(
Boost
VERSION 1.70.0-p0
)
)
hunter_config(GSL
URL https://github.com/microsoft/GSL/archive/v2.0.0.tar.gz
SHA1 9bbdea551b38d7d09ab7aa2e89b91a66dd032b4a
CMAKE_ARGS GSL_TEST=OFF
)
hunter_config(
spdlog
URL https://github.com/gabime/spdlog/archive/v1.x.zip
SHA1 086e9f8e3708024d5765fa5f94695819b223be23
)

40
cmake/boost_di.cmake

@ -0,0 +1,40 @@
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
#######################################
# load and set up boost di dependency #
#######################################
include(FeatureSummary)
include(ExternalProject)
add_library(di INTERFACE IMPORTED)
set(GIT_URL https://github.com/boost-experimental/di.git)
set(BOOTS_DI_VERSION cpp14)
set(GIT_TAG "cpp14")
set_package_properties(boost_di
PROPERTIES
URL ${GIT_URL}
DESCRIPTION "boost experimental dependency injection library"
)
externalproject_add(boost_di
GIT_REPOSITORY ${GIT_URL}
GIT_TAG ${GIT_TAG}
GIT_SHALLOW 1
TLS_VERIFY true
INSTALL_COMMAND "" # remove install step
)
add_dependencies(di boost_di)
externalproject_get_property(boost_di source_dir)
set(boost_di_INCLUDE_DIR ${source_dir}/include ${source_dir}/extension/include)
file(MAKE_DIRECTORY ${boost_di_INCLUDE_DIR})
target_include_directories(di INTERFACE ${boost_di_INCLUDE_DIR})

10
cmake/dependencies.cmake

@ -17,3 +17,13 @@ find_package(OpenSSL REQUIRED)
# https://developers.google.com/protocol-buffers/
hunter_add_package(Protobuf)
find_package(Protobuf CONFIG REQUIRED)
# https://docs.hunter.sh/en/latest/packages/pkg/spdlog.html
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
# load boost di package
include(cmake/boost_di.cmake)
#load tsl hat-trie package
include(cmake/hat-trie.cmake)

39
cmake/hat-trie.cmake

@ -0,0 +1,39 @@
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
#######################################
# load and set up hat-trie dependency #
#######################################
include(FeatureSummary)
include(ExternalProject)
add_library(hat_trie INTERFACE IMPORTED)
set(GIT_URL https://github.com/Tessil/hat-trie.git)
set(HAT_TRIE_VERSION master)
set(GIT_TAG "v0.6.0")
set_package_properties(hat-trie-imp
PROPERTIES
URL ${GIT_URL}
DESCRIPTION "fast and memory efficient HAT-trie"
)
externalproject_add(hat-trie-imp
GIT_REPOSITORY ${GIT_URL}
GIT_TAG ${GIT_TAG}
GIT_SHALLOW 1
TLS_VERIFY true
INSTALL_COMMAND "" # remove install step
)
add_dependencies(hat_trie hat-trie-imp)
externalproject_get_property(hat-trie-imp source_dir)
set(hat-trie_INCLUDE_DIR ${source_dir}/include)
file(MAKE_DIRECTORY ${hat-trie_INCLUDE_DIR})
target_include_directories(hat_trie INTERFACE ${hat-trie_INCLUDE_DIR})

1
deps/di

@ -1 +0,0 @@
Subproject commit 65a739dab05813b1d711f985cfce5b0877738d6a

1
deps/hat-trie

@ -1 +0,0 @@
Subproject commit ff788cd86e40a39885f5e155df455ce6dd1ce3d0

1
deps/spdlog

@ -1 +0,0 @@
Subproject commit 453be2e08a42027b22d7315b49fa0e975795f60b

3
example/01-echo/CMakeLists.txt

@ -6,8 +6,8 @@
add_executable(libp2p_echo_server
libp2p_echo_server.cpp
)
target_link_libraries(libp2p_echo_server
di
p2p_basic_host
p2p_default_network
p2p_peer_repository
@ -23,6 +23,7 @@ add_executable(libp2p_echo_client
)
target_link_libraries(libp2p_echo_client
di
p2p_basic_host
p2p_default_network
p2p_peer_repository

3
src/common/CMakeLists.txt

@ -13,6 +13,9 @@ target_link_libraries(p2p_hexutil
libp2p_add_library(p2p_logger
logger.cpp
)
target_link_libraries(p2p_logger
spdlog::spdlog
)
libp2p_add_library(p2p_byteutil
byteutil.cpp

2
src/common/logger.cpp

@ -5,6 +5,8 @@
#include <libp2p/common/logger.hpp>
#include <boost/scoped_ptr.hpp>
#include <spdlog/fmt/ostr.h>
#include <spdlog/sinks/stdout_color_sinks.h>
namespace {

1
src/network/impl/CMakeLists.txt

@ -8,6 +8,7 @@ libp2p_add_library(p2p_router
)
target_link_libraries(p2p_router
Boost::boost
hat_trie
p2p_peer_id
)

5
test/acceptance/p2p/host/host_integration_test.cpp

@ -67,9 +67,6 @@ TEST_P(HostIntegrationTest, InteractAllToAllSuccess) {
// create peers
peers.reserve(peer_count);
for (size_t i = 0; i < peer_count; ++i) {
}
peerinfo_futures.reserve(peer_count);
// initialize `peer info` promises and futures and addresses
@ -79,7 +76,7 @@ TEST_P(HostIntegrationTest, InteractAllToAllSuccess) {
auto peer = std::make_shared<Peer>(timeout);
auto ma = ma_generator.nextMultiaddress();
peer->startServer(std::move(ma), std::move(promise));
peer->startServer(ma, std::move(promise));
peers.push_back(std::move(peer));
}

2
test/acceptance/p2p/host/peer/CMakeLists.txt

@ -6,6 +6,8 @@ add_library(p2p_test_peer
test_peer.cpp
)
target_link_libraries(p2p_test_peer
di
hat_trie
Boost::boost
p2p_basic_host
p2p_peer_repository

3
test/deps/CMakeLists.txt

@ -9,3 +9,6 @@ target_link_libraries(outcome_test
)
addtest(di_test di_test.cpp)
target_link_libraries(di_test
di
)

2
test/libp2p/injector/CMakeLists.txt

@ -5,6 +5,7 @@ addtest(network_injector_test
network_injector_test.cpp
)
target_link_libraries(network_injector_test
di
p2p_default_network
)
@ -13,6 +14,7 @@ addtest(host_injector_test
host_injector_test.cpp
)
target_link_libraries(host_injector_test
di
p2p_default_network
p2p_basic_host
p2p_peer_repository

1
test/libp2p/security/CMakeLists.txt

@ -7,6 +7,7 @@ addtest(plaintext_adaptor_test
plaintext_adaptor_test.cpp
)
target_link_libraries(plaintext_adaptor_test
di
p2p_plaintext
p2p_peer_id
p2p_multihash

Loading…
Cancel
Save