From 942d3cbe4387af2020ae11f8abbdae8e6a2b0448 Mon Sep 17 00:00:00 2001 From: Bohdan Date: Wed, 2 Oct 2019 22:38:02 +0300 Subject: [PATCH] Add install step + example + test (#5) * Move outcome to project Signed-off-by: Bogdan Vaneev * Add example Signed-off-by: Bogdan Vaneev * add install step Signed-off-by: Bogdan Vaneev * Fix Signed-off-by: Bogdan Vaneev * Cleanup "install" Signed-off-by: Bogdan Vaneev * Fix Signed-off-by: Bogdan Vaneev --- .github/workflows/{main.yml => ci.yml} | 9 ++ CMakeLists.txt | 89 ++----------------- cmake/Hunter/config.cmake | 8 +- cmake/Hunter/init.cmake | 6 ++ cmake/dependencies.cmake | 5 +- cmake/functions.cmake | 1 + cmake/install.cmake | 50 +++-------- cmake/libp2pConfig.cmake.in | 33 ------- cmake/libp2p_add_library.cmake | 6 ++ deps/CMakeLists.txt | 4 - deps/outcome/CMakeLists.txt | 8 -- example/00-install/CMakeLists.txt | 30 +++++++ example/00-install/main.cpp | 10 +++ include/libp2p/basic/closeable.hpp | 2 +- include/libp2p/basic/message_read_writer.hpp | 2 +- .../basic/message_read_writer_error.hpp | 2 +- include/libp2p/basic/reader.hpp | 2 +- include/libp2p/common/hexutil.hpp | 2 +- include/libp2p/connection/stream.hpp | 2 +- include/libp2p/crypto/aes_provider.hpp | 2 +- .../crypto/aes_provider/aes_provider_impl.hpp | 2 +- include/libp2p/crypto/error.hpp | 2 +- include/libp2p/crypto/hmac_provider.hpp | 2 +- include/libp2p/crypto/key_generator.hpp | 2 +- include/libp2p/crypto/key_validator.hpp | 2 +- include/libp2p/host/host.hpp | 2 +- .../multi/converters/conversion_error.hpp | 2 +- .../multi/converters/converter_utils.hpp | 2 +- .../multi/converters/ip_v4_converter.hpp | 2 +- .../multi/converters/ip_v6_converter.hpp | 2 +- .../multi/converters/ipfs_converter.hpp | 2 +- .../libp2p/multi/converters/tcp_converter.hpp | 2 +- .../libp2p/multi/converters/udp_converter.hpp | 2 +- include/libp2p/multi/multiaddress.hpp | 2 +- include/libp2p/multi/multibase_codec.hpp | 2 +- .../multi/multibase_codec/codecs/base16.hpp | 2 +- .../multi/multibase_codec/codecs/base58.hpp | 2 +- .../multi/multibase_codec/codecs/base64.hpp | 2 +- .../multibase_codec/codecs/base_error.hpp | 2 +- include/libp2p/multi/multihash.hpp | 2 +- include/libp2p/muxer/muxer_adaptor.hpp | 2 +- include/libp2p/network/listener_manager.hpp | 2 +- include/libp2p/network/router.hpp | 2 +- .../libp2p}/outcome/outcome-register.hpp | 0 .../libp2p}/outcome/outcome.hpp | 2 +- include/libp2p/peer/errors.hpp | 2 +- include/libp2p/peer/key_repository.hpp | 2 +- include/libp2p/peer/peer_address.hpp | 2 +- include/libp2p/peer/peer_id.hpp | 2 +- include/libp2p/peer/protocol_repository.hpp | 2 +- include/libp2p/protocol/base_protocol.hpp | 2 +- .../identify/identify_msg_processor.hpp | 2 +- include/libp2p/protocol/ping/ping.hpp | 2 +- .../multiselect/message_manager.hpp | 2 +- .../multiselect/message_reader.hpp | 2 +- .../multiselect/multiselect_error.hpp | 2 +- .../libp2p/protocol_muxer/protocol_muxer.hpp | 2 +- include/libp2p/security/error.hpp | 2 +- include/libp2p/security/security_adaptor.hpp | 2 +- include/libp2p/transport/tcp/tcp_util.hpp | 2 +- .../libp2p/transport/transport_adaptor.hpp | 2 +- include/libp2p/transport/upgrader.hpp | 2 +- src/CMakeLists.txt | 2 +- src/basic/CMakeLists.txt | 10 +-- src/common/CMakeLists.txt | 5 +- src/crypto/CMakeLists.txt | 6 +- src/crypto/aes_provider/CMakeLists.txt | 2 +- src/crypto/hmac_provider/CMakeLists.txt | 2 +- src/crypto/key_generator/CMakeLists.txt | 2 +- src/crypto/key_marshaller/CMakeLists.txt | 2 +- src/crypto/key_validator/CMakeLists.txt | 2 +- src/crypto/random_generator/CMakeLists.txt | 2 +- src/crypto/sha/CMakeLists.txt | 2 +- src/host/basic_host/CMakeLists.txt | 5 +- src/multi/CMakeLists.txt | 13 ++- src/multi/converters/CMakeLists.txt | 19 +--- src/multi/converters/converter_utils.cpp | 2 +- src/multi/converters/ip_v4_converter.cpp | 2 +- src/multi/converters/ip_v6_converter.cpp | 2 +- src/multi/converters/ipfs_converter.cpp | 2 +- src/multi/converters/tcp_converter.cpp | 2 +- src/multi/converters/udp_converter.cpp | 2 +- src/multi/multibase_codec/CMakeLists.txt | 2 +- src/muxer/yamux/CMakeLists.txt | 8 +- src/network/CMakeLists.txt | 2 +- src/network/impl/CMakeLists.txt | 19 ++-- src/peer/CMakeLists.txt | 14 +-- src/peer/address_repository/CMakeLists.txt | 2 +- src/peer/impl/CMakeLists.txt | 4 +- src/peer/key_repository/CMakeLists.txt | 2 +- src/peer/protocol_repository/CMakeLists.txt | 4 +- src/protocol/echo/CMakeLists.txt | 2 +- src/protocol/identify/CMakeLists.txt | 2 +- src/protocol/kademlia/impl/CMakeLists.txt | 4 +- src/protocol/ping/CMakeLists.txt | 2 +- src/protocol_muxer/multiselect/CMakeLists.txt | 2 +- src/security/CMakeLists.txt | 4 +- src/security/plaintext/CMakeLists.txt | 8 +- src/transport/impl/CMakeLists.txt | 10 +-- src/transport/tcp/CMakeLists.txt | 6 +- test/deps/CMakeLists.txt | 2 +- test/deps/outcome_test.cpp | 2 +- test/libp2p/basic/CMakeLists.txt | 2 +- test/libp2p/crypto/aes_test.cpp | 2 +- test/libp2p/crypto/hmac_test.cpp | 2 +- test/libp2p/crypto/keys_test.cpp | 2 +- test/libp2p/multi/utils/CMakeLists.txt | 4 +- .../transport/multiaddress_parser_test.cpp | 2 +- test/testutil/libp2p/CMakeLists.txt | 1 - test/testutil/outcome.hpp | 2 +- 110 files changed, 234 insertions(+), 325 deletions(-) rename .github/workflows/{main.yml => ci.yml} (81%) delete mode 100644 cmake/libp2pConfig.cmake.in create mode 100644 cmake/libp2p_add_library.cmake delete mode 100644 deps/CMakeLists.txt delete mode 100644 deps/outcome/CMakeLists.txt create mode 100644 example/00-install/CMakeLists.txt create mode 100644 example/00-install/main.cpp rename {deps/outcome => include/libp2p}/outcome/outcome-register.hpp (100%) rename {deps/outcome => include/libp2p}/outcome/outcome.hpp (95%) diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 81% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index f3e8fdd3..e97caec9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -60,3 +60,12 @@ jobs: env: CTEST_OUTPUT_ON_FAILURE: 1 run: cmake --build build --target test +# TODO(warchant): on CI (linux/clang) this can not be built, figure out why +# - name: install & test +# run: | +# # install libp2p and include it as a subproject through find_package +# sudo cmake --build build --target install +# cd example/00-install +# mkdir build && cd build +# cmake .. && make +# ./main diff --git a/CMakeLists.txt b/CMakeLists.txt index 27b69ae6..e09ab784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,14 +13,7 @@ set(CMAKE_TOOLCHAIN_FILE "Default toolchain" ) - include("cmake/Hunter/init.cmake") -HunterGate( - URL "https://github.com/ruslo/hunter/archive/v0.23.171.tar.gz" - SHA1 "5d68bcca78eee347239ca5f4d34f4b6c12683154" - LOCAL -) - project(libp2p C CXX) include(cmake/print.cmake) @@ -28,20 +21,16 @@ print("C flags: ${CMAKE_C_FLAGS}") print("CXX flags: ${CMAKE_CXX_FLAGS}") print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") -set(THREADS_PREFER_PTHREAD_FLAG TRUE) -find_package(Threads) -link_libraries(Threads::Threads) -if (THREADS_HAVE_PTHREAD_ARG) - link_libraries(pthread) -endif () - include(CheckCXXCompilerFlag) +include(cmake/install.cmake) +include(cmake/libp2p_add_library.cmake) include(cmake/dependencies.cmake) include(cmake/functions.cmake) include(cmake/san.cmake) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +option(TESTING "Build tests" ON) option(CLANG_FORMAT "Enable clang-format target" ON) option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF) option(COVERAGE "Enable generation of coverage info" OFF) @@ -95,8 +84,6 @@ if (CLANG_FORMAT) include(cmake/clang-format.cmake) endif () -add_subdirectory(deps) - include_directories( # project includes ${PROJECT_SOURCE_DIR}/include @@ -108,75 +95,13 @@ include_directories( deps/di/include deps/di/extension/include deps/hat-trie/include - deps/outcome deps/spdlog/include ) add_subdirectory(src) -include(GNUInstallDirs) - -include(cmake/install.cmake) - -install_deps_headers() - -#libp2p_install( -# TARGETS -# libp2p -# libp2p_default_network -# libp2p_network -# libp2p_tcp -# libp2p_yamux -# libp2p_plaintext -# libp2p_connection_manager -# libp2p_transport_manager -# libp2p_listener_manager -# libp2p_identity_manager -# libp2p_dialer -# libp2p_router -# multiselect -# random_generator -# key_generator -# key_validator -# key_marshaller -# libp2p_tcp_connection -# libp2p_tcp_listener -# libp2p_yamuxed_connection -# libp2p_security_error -# plaintext_exchange_message_marshaller -# crypto_error -# multiaddress -# libp2p_peer_id -# uvarint -# multihash -# crypto_key -# libp2p_upgrader -# libp2p_upgrader_session -# converter_utils -# multibase_codec -# conversion_error -# converters -# hexutil -# keys_proto -# plaintext_protobuf -# logger -# sha -#) - -include(CMakePackageConfigHelpers) - -set(CONFIG_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libp2p) -configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/libp2pConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/libp2pConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libp2p - ) - -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/libp2pConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libp2p - ) - -export(PACKAGE libp2p) -enable_testing() -add_subdirectory(test) +if(TESTING) + enable_testing() + add_subdirectory(test) +endif() diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index 245d4cc1..b0d8a014 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -1,4 +1,10 @@ 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 + ) diff --git a/cmake/Hunter/init.cmake b/cmake/Hunter/init.cmake index 4cd17699..d2c806d1 100644 --- a/cmake/Hunter/init.cmake +++ b/cmake/Hunter/init.cmake @@ -27,3 +27,9 @@ set( include(${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake) + +HunterGate( + URL "https://github.com/cpp-pm/hunter/archive/v0.23.216.tar.gz" + SHA1 "a492a1879bee60c29f7af17ef56b45f0d7766241" + LOCAL +) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 5123ffc1..59dcc3cc 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -7,9 +7,8 @@ find_package(GMock CONFIG REQUIRED) hunter_add_package(Boost COMPONENTS random filesystem) find_package(Boost CONFIG REQUIRED random filesystem) -# https://docs.hunter.sh/en/latest/packages/pkg/Microsoft.GSL.html -hunter_add_package(Microsoft.GSL) -find_package(Microsoft.GSL CONFIG REQUIRED) +# added from hunter_config +hunter_add_package(GSL) # https://www.openssl.org/ hunter_add_package(OpenSSL) diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 90575c97..778eb16f 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -111,6 +111,7 @@ function(add_proto_library NAME) ) disable_clang_tidy(${NAME}) + libp2p_install(${NAME}) add_dependencies(generated ${NAME}) endfunction() diff --git a/cmake/install.cmake b/cmake/install.cmake index 8f4b73ba..8cc8a888 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -1,20 +1,7 @@ -function(install_deps_headers) - install(DIRECTORY ${MICROSOFT.GSL_ROOT}/include/gsl - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +include(GNUInstallDirs) - install(DIRECTORY deps/outcome/outcome - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -endfunction() - -function(libp2p_install) - set(options) - set(oneValueArgs) - set(multiValueArgs TARGETS HEADER_DIRS) - cmake_parse_arguments(arg "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN}) - - install(TARGETS ${arg_TARGETS} EXPORT libp2pTargets +function (libp2p_install targets) + install(TARGETS ${targets} EXPORT libp2pConfig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -22,25 +9,14 @@ function(libp2p_install) PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX} ) - - foreach (DIR IN ITEMS ${arg_HEADER_DIRS}) - get_filename_component(FULL_PATH ${DIR} ABSOLUTE) - string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/p2p libp2p RELATIVE_PATH ${FULL_PATH}) - get_filename_component(INSTALL_PREFIX ${RELATIVE_PATH} DIRECTORY) - install(DIRECTORY ${DIR} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_PREFIX} - FILES_MATCHING PATTERN "*.hpp") - endforeach () - - install( - EXPORT libp2pTargets - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libp2p - NAMESPACE libp2p:: - ) - export( - EXPORT libp2pTargets - FILE ${CMAKE_CURRENT_BINARY_DIR}/libp2pTargets.cmake - NAMESPACE libp2p:: - ) - endfunction() + +install( + DIRECTORY ${CMAKE_SOURCE_DIR}/include/libp2p + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +install( + EXPORT libp2pConfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libp2p + NAMESPACE p2p:: +) diff --git a/cmake/libp2pConfig.cmake.in b/cmake/libp2pConfig.cmake.in deleted file mode 100644 index b941441e..00000000 --- a/cmake/libp2pConfig.cmake.in +++ /dev/null @@ -1,33 +0,0 @@ -get_filename_component(libp2p_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - - -#if(NOT TARGET kagome::buffer) -# include("${kagome_CMAKE_DIR}/kagomeTargets.cmake") -#endif() - -find_package(Threads) - - -include(GNUInstallDirs) - -set(libp2p_INCLUDE_DIRS - "@CONFIG_INCLUDE_DIRS@" -) - -#set(kagome_LIBRARIES -# kagome::scale -# kagome::buffer -# kagome::hexutil -# kagome::blob -# kagome::polkadot_trie_db -# kagome::polkadot_trie_codec -# kagome::polkadot_trie -# kagome::blake2 -# kagome::hasher -# kagome::twox -# kagome::sha -# kagome::leveldb -# kagome::polkadot_trie_batch -# kagome::logger -# kagome::in_memory_storage -# ) diff --git a/cmake/libp2p_add_library.cmake b/cmake/libp2p_add_library.cmake new file mode 100644 index 00000000..ee360fa5 --- /dev/null +++ b/cmake/libp2p_add_library.cmake @@ -0,0 +1,6 @@ +function(libp2p_add_library target) + add_library(${target} + ${ARGN} + ) + libp2p_install(${target}) +endfunction() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt deleted file mode 100644 index 3f30ce97..00000000 --- a/deps/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright Soramitsu Co., Ltd. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(outcome) diff --git a/deps/outcome/CMakeLists.txt b/deps/outcome/CMakeLists.txt deleted file mode 100644 index 7e058271..00000000 --- a/deps/outcome/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Soramitsu Co., Ltd. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -add_library(outcome INTERFACE IMPORTED GLOBAL) -set_target_properties(outcome PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR} - INTERFACE_LINK_LIBRARIES Boost::boost - ) diff --git a/example/00-install/CMakeLists.txt b/example/00-install/CMakeLists.txt new file mode 100644 index 00000000..0283ff40 --- /dev/null +++ b/example/00-install/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.12) + +# reuse HunterGate... +include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/Hunter/HunterGate.cmake) +HunterGate( + URL "https://github.com/cpp-pm/hunter/archive/v0.23.216.tar.gz" + SHA1 "a492a1879bee60c29f7af17ef56b45f0d7766241" +) + + +project(00-install C CXX) + +set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +hunter_add_package(Boost) +find_package(Boost CONFIG REQUIRED) + +hunter_add_package(Microsoft.GSL) +find_package(Microsoft.GSL CONFIG REQUIRED) + +# look for libp2p in OS +find_package(libp2p CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main + p2p::p2p_multiaddress + ) diff --git a/example/00-install/main.cpp b/example/00-install/main.cpp new file mode 100644 index 00000000..bbcd265f --- /dev/null +++ b/example/00-install/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace libp2p; + +int main() { + auto addr = multi::Multiaddress::create("/ip4/192.168.0.1/tcp/8080"); + std::cout << "address: " << addr.value().getStringAddress() << std::endl; + return 0; +} diff --git a/include/libp2p/basic/closeable.hpp b/include/libp2p/basic/closeable.hpp index f20e7494..b56526fb 100644 --- a/include/libp2p/basic/closeable.hpp +++ b/include/libp2p/basic/closeable.hpp @@ -8,7 +8,7 @@ #include -#include +#include namespace libp2p::basic { diff --git a/include/libp2p/basic/message_read_writer.hpp b/include/libp2p/basic/message_read_writer.hpp index 17bda376..2ece3a11 100644 --- a/include/libp2p/basic/message_read_writer.hpp +++ b/include/libp2p/basic/message_read_writer.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libp2p::basic { /** diff --git a/include/libp2p/basic/message_read_writer_error.hpp b/include/libp2p/basic/message_read_writer_error.hpp index 567653eb..bfb5386d 100644 --- a/include/libp2p/basic/message_read_writer_error.hpp +++ b/include/libp2p/basic/message_read_writer_error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_MESSAGE_READ_WRITER_ERROR_HPP #define LIBP2P_MESSAGE_READ_WRITER_ERROR_HPP -#include +#include namespace libp2p::basic { enum class MessageReadWriterError { diff --git a/include/libp2p/basic/reader.hpp b/include/libp2p/basic/reader.hpp index e18db45e..b361fb1b 100644 --- a/include/libp2p/basic/reader.hpp +++ b/include/libp2p/basic/reader.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libp2p::basic { diff --git a/include/libp2p/common/hexutil.hpp b/include/libp2p/common/hexutil.hpp index babbb945..28966f16 100644 --- a/include/libp2p/common/hexutil.hpp +++ b/include/libp2p/common/hexutil.hpp @@ -11,7 +11,7 @@ #include -#include +#include namespace libp2p::common { diff --git a/include/libp2p/connection/stream.hpp b/include/libp2p/connection/stream.hpp index b3d60034..cfd65c81 100644 --- a/include/libp2p/connection/stream.hpp +++ b/include/libp2p/connection/stream.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include namespace libp2p::peer { class PeerId; diff --git a/include/libp2p/crypto/aes_provider.hpp b/include/libp2p/crypto/aes_provider.hpp index 68b55cdf..cda75246 100644 --- a/include/libp2p/crypto/aes_provider.hpp +++ b/include/libp2p/crypto/aes_provider.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace libp2p::crypto::aes { /** diff --git a/include/libp2p/crypto/aes_provider/aes_provider_impl.hpp b/include/libp2p/crypto/aes_provider/aes_provider_impl.hpp index 11babb42..afccc964 100644 --- a/include/libp2p/crypto/aes_provider/aes_provider_impl.hpp +++ b/include/libp2p/crypto/aes_provider/aes_provider_impl.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include namespace libp2p::crypto::aes { class AesProviderImpl : public AesProvider { diff --git a/include/libp2p/crypto/error.hpp b/include/libp2p/crypto/error.hpp index f1e95d56..ba884475 100644 --- a/include/libp2p/crypto/error.hpp +++ b/include/libp2p/crypto/error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_CRYPTO_ERROR_HPP #define LIBP2P_CRYPTO_ERROR_HPP -#include +#include namespace libp2p::crypto { enum class CryptoProviderError { diff --git a/include/libp2p/crypto/hmac_provider.hpp b/include/libp2p/crypto/hmac_provider.hpp index 27bd2ebd..61af2b66 100644 --- a/include/libp2p/crypto/hmac_provider.hpp +++ b/include/libp2p/crypto/hmac_provider.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace libp2p::crypto::hmac { /** diff --git a/include/libp2p/crypto/key_generator.hpp b/include/libp2p/crypto/key_generator.hpp index d1c9a01d..497efc2e 100644 --- a/include/libp2p/crypto/key_generator.hpp +++ b/include/libp2p/crypto/key_generator.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include namespace libp2p::crypto { diff --git a/include/libp2p/crypto/key_validator.hpp b/include/libp2p/crypto/key_validator.hpp index 6a96ce0f..7e71bb06 100644 --- a/include/libp2p/crypto/key_validator.hpp +++ b/include/libp2p/crypto/key_validator.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_CRYPTO_KEY_VALIDATOR_HPP #define LIBP2P_CRYPTO_KEY_VALIDATOR_HPP -#include +#include #include namespace libp2p::crypto::validator { diff --git a/include/libp2p/host/host.hpp b/include/libp2p/host/host.hpp index c17873ac..e8c85eae 100644 --- a/include/libp2p/host/host.hpp +++ b/include/libp2p/host/host.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace libp2p { /** diff --git a/include/libp2p/multi/converters/conversion_error.hpp b/include/libp2p/multi/converters/conversion_error.hpp index dd19ee95..23d2a04e 100644 --- a/include/libp2p/multi/converters/conversion_error.hpp +++ b/include/libp2p/multi/converters/conversion_error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_MULTI_CONVERTERS_CONVERSION_ERROR_HPP_ #define LIBP2P_MULTI_CONVERTERS_CONVERSION_ERROR_HPP_ -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/converter_utils.hpp b/include/libp2p/multi/converters/converter_utils.hpp index 10d29fba..29fd4604 100644 --- a/include/libp2p/multi/converters/converter_utils.hpp +++ b/include/libp2p/multi/converters/converter_utils.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/ip_v4_converter.hpp b/include/libp2p/multi/converters/ip_v4_converter.hpp index 6439274a..cd3a3f07 100644 --- a/include/libp2p/multi/converters/ip_v4_converter.hpp +++ b/include/libp2p/multi/converters/ip_v4_converter.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_IPV4CONVERTER_HPP #define LIBP2P_IPV4CONVERTER_HPP -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/ip_v6_converter.hpp b/include/libp2p/multi/converters/ip_v6_converter.hpp index 7e3ed41f..03ec131a 100644 --- a/include/libp2p/multi/converters/ip_v6_converter.hpp +++ b/include/libp2p/multi/converters/ip_v6_converter.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_IPV6CONVERTER_HPP #define LIBP2P_IPV6CONVERTER_HPP -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/ipfs_converter.hpp b/include/libp2p/multi/converters/ipfs_converter.hpp index eee95e86..0683ce22 100644 --- a/include/libp2p/multi/converters/ipfs_converter.hpp +++ b/include/libp2p/multi/converters/ipfs_converter.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_IPFS_CONVERTER_HPP #define LIBP2P_IPFS_CONVERTER_HPP -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/tcp_converter.hpp b/include/libp2p/multi/converters/tcp_converter.hpp index d982cfdd..d91a9e9b 100644 --- a/include/libp2p/multi/converters/tcp_converter.hpp +++ b/include/libp2p/multi/converters/tcp_converter.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_TCPCONVERTER_HPP #define LIBP2P_TCPCONVERTER_HPP -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/converters/udp_converter.hpp b/include/libp2p/multi/converters/udp_converter.hpp index 832d7313..fe2abc9d 100644 --- a/include/libp2p/multi/converters/udp_converter.hpp +++ b/include/libp2p/multi/converters/udp_converter.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_UDP_CONVERTER_HPP #define LIBP2P_UDP_CONVERTER_HPP -#include +#include namespace libp2p::multi::converters { diff --git a/include/libp2p/multi/multiaddress.hpp b/include/libp2p/multi/multiaddress.hpp index 24d9c46d..06642f09 100644 --- a/include/libp2p/multi/multiaddress.hpp +++ b/include/libp2p/multi/multiaddress.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace libp2p::multi { diff --git a/include/libp2p/multi/multibase_codec.hpp b/include/libp2p/multi/multibase_codec.hpp index 4fdaf93a..9c038b71 100644 --- a/include/libp2p/multi/multibase_codec.hpp +++ b/include/libp2p/multi/multibase_codec.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libp2p::multi { /** diff --git a/include/libp2p/multi/multibase_codec/codecs/base16.hpp b/include/libp2p/multi/multibase_codec/codecs/base16.hpp index acc27d77..0c0338d7 100644 --- a/include/libp2p/multi/multibase_codec/codecs/base16.hpp +++ b/include/libp2p/multi/multibase_codec/codecs/base16.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include /** * Encode/decode to/from base16 format diff --git a/include/libp2p/multi/multibase_codec/codecs/base58.hpp b/include/libp2p/multi/multibase_codec/codecs/base58.hpp index 93dcb161..00c1b827 100644 --- a/include/libp2p/multi/multibase_codec/codecs/base58.hpp +++ b/include/libp2p/multi/multibase_codec/codecs/base58.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include /** * Encode/decode to/from base58 format diff --git a/include/libp2p/multi/multibase_codec/codecs/base64.hpp b/include/libp2p/multi/multibase_codec/codecs/base64.hpp index 5e672ade..a879fa28 100644 --- a/include/libp2p/multi/multibase_codec/codecs/base64.hpp +++ b/include/libp2p/multi/multibase_codec/codecs/base64.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include /** * Encode/decode to/from base64 format diff --git a/include/libp2p/multi/multibase_codec/codecs/base_error.hpp b/include/libp2p/multi/multibase_codec/codecs/base_error.hpp index c41b2042..bfe19e9f 100644 --- a/include/libp2p/multi/multibase_codec/codecs/base_error.hpp +++ b/include/libp2p/multi/multibase_codec/codecs/base_error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_BASE_ERROR_HPP #define LIBP2P_BASE_ERROR_HPP -#include +#include namespace libp2p::multi::detail { diff --git a/include/libp2p/multi/multihash.hpp b/include/libp2p/multi/multihash.hpp index 7fe03b01..0130b177 100644 --- a/include/libp2p/multi/multihash.hpp +++ b/include/libp2p/multi/multihash.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace libp2p::multi { diff --git a/include/libp2p/muxer/muxer_adaptor.hpp b/include/libp2p/muxer/muxer_adaptor.hpp index 549c6f96..592f75e3 100644 --- a/include/libp2p/muxer/muxer_adaptor.hpp +++ b/include/libp2p/muxer/muxer_adaptor.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace libp2p::muxer { /** diff --git a/include/libp2p/network/listener_manager.hpp b/include/libp2p/network/listener_manager.hpp index 7faf2131..43eb811d 100644 --- a/include/libp2p/network/listener_manager.hpp +++ b/include/libp2p/network/listener_manager.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace libp2p::network { diff --git a/include/libp2p/network/router.hpp b/include/libp2p/network/router.hpp index 7930927c..e809f84c 100644 --- a/include/libp2p/network/router.hpp +++ b/include/libp2p/network/router.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace libp2p::network { diff --git a/deps/outcome/outcome/outcome-register.hpp b/include/libp2p/outcome/outcome-register.hpp similarity index 100% rename from deps/outcome/outcome/outcome-register.hpp rename to include/libp2p/outcome/outcome-register.hpp diff --git a/deps/outcome/outcome/outcome.hpp b/include/libp2p/outcome/outcome.hpp similarity index 95% rename from deps/outcome/outcome/outcome.hpp rename to include/libp2p/outcome/outcome.hpp index decadfc9..3d3b4181 100644 --- a/deps/outcome/outcome/outcome.hpp +++ b/include/libp2p/outcome/outcome.hpp @@ -12,7 +12,7 @@ #define OUTCOME_TRY(...) BOOST_OUTCOME_TRY(__VA_ARGS__) -#include +#include /** * __cpp_sized_deallocation macro interferes with protobuf generated files diff --git a/include/libp2p/peer/errors.hpp b/include/libp2p/peer/errors.hpp index e003ba7a..b80aab07 100644 --- a/include/libp2p/peer/errors.hpp +++ b/include/libp2p/peer/errors.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_PEER_ERRORS_HPP #define LIBP2P_PEER_ERRORS_HPP -#include +#include namespace libp2p::peer { diff --git a/include/libp2p/peer/key_repository.hpp b/include/libp2p/peer/key_repository.hpp index 1eb45a10..77b0ede1 100644 --- a/include/libp2p/peer/key_repository.hpp +++ b/include/libp2p/peer/key_repository.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libp2p::peer { diff --git a/include/libp2p/peer/peer_address.hpp b/include/libp2p/peer/peer_address.hpp index b43b3c0a..d27e7fde 100644 --- a/include/libp2p/peer/peer_address.hpp +++ b/include/libp2p/peer/peer_address.hpp @@ -12,7 +12,7 @@ #include #include -#include +#include namespace libp2p::peer { /** diff --git a/include/libp2p/peer/peer_id.hpp b/include/libp2p/peer/peer_id.hpp index 4c8df472..91937b1b 100644 --- a/include/libp2p/peer/peer_id.hpp +++ b/include/libp2p/peer/peer_id.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace libp2p::peer { diff --git a/include/libp2p/peer/protocol_repository.hpp b/include/libp2p/peer/protocol_repository.hpp index aa322bcd..376144c4 100644 --- a/include/libp2p/peer/protocol_repository.hpp +++ b/include/libp2p/peer/protocol_repository.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace libp2p::peer { diff --git a/include/libp2p/protocol/base_protocol.hpp b/include/libp2p/protocol/base_protocol.hpp index 90306bf4..8d2448d4 100644 --- a/include/libp2p/protocol/base_protocol.hpp +++ b/include/libp2p/protocol/base_protocol.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace libp2p::protocol { diff --git a/include/libp2p/protocol/identify/identify_msg_processor.hpp b/include/libp2p/protocol/identify/identify_msg_processor.hpp index c41c8754..9fc6f14d 100644 --- a/include/libp2p/protocol/identify/identify_msg_processor.hpp +++ b/include/libp2p/protocol/identify/identify_msg_processor.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace identify::pb { class Identify; diff --git a/include/libp2p/protocol/ping/ping.hpp b/include/libp2p/protocol/ping/ping.hpp index b68769c4..d98c5ed8 100644 --- a/include/libp2p/protocol/ping/ping.hpp +++ b/include/libp2p/protocol/ping/ping.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace libp2p::crypto::random { class RandomGenerator; diff --git a/include/libp2p/protocol_muxer/multiselect/message_manager.hpp b/include/libp2p/protocol_muxer/multiselect/message_manager.hpp index dab4b0d7..9614eade 100644 --- a/include/libp2p/protocol_muxer/multiselect/message_manager.hpp +++ b/include/libp2p/protocol_muxer/multiselect/message_manager.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace libp2p::protocol_muxer { /** diff --git a/include/libp2p/protocol_muxer/multiselect/message_reader.hpp b/include/libp2p/protocol_muxer/multiselect/message_reader.hpp index 296c506b..7adbb2bd 100644 --- a/include/libp2p/protocol_muxer/multiselect/message_reader.hpp +++ b/include/libp2p/protocol_muxer/multiselect/message_reader.hpp @@ -8,7 +8,7 @@ #include -#include +#include #include #include #include diff --git a/include/libp2p/protocol_muxer/multiselect/multiselect_error.hpp b/include/libp2p/protocol_muxer/multiselect/multiselect_error.hpp index 6a500ba3..c65c3df8 100644 --- a/include/libp2p/protocol_muxer/multiselect/multiselect_error.hpp +++ b/include/libp2p/protocol_muxer/multiselect/multiselect_error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_MULTISELECT_ERROR_HPP #define LIBP2P_MULTISELECT_ERROR_HPP -#include +#include namespace libp2p::protocol_muxer { enum class MultiselectError { diff --git a/include/libp2p/protocol_muxer/protocol_muxer.hpp b/include/libp2p/protocol_muxer/protocol_muxer.hpp index f52c5043..90d89097 100644 --- a/include/libp2p/protocol_muxer/protocol_muxer.hpp +++ b/include/libp2p/protocol_muxer/protocol_muxer.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/include/libp2p/security/error.hpp b/include/libp2p/security/error.hpp index a89a57ab..5c903dd4 100644 --- a/include/libp2p/security/error.hpp +++ b/include/libp2p/security/error.hpp @@ -6,7 +6,7 @@ #ifndef LIBP2P_SECURITY_ERROR_HPP #define LIBP2P_SECURITY_ERROR_HPP -#include +#include namespace libp2p::security { diff --git a/include/libp2p/security/security_adaptor.hpp b/include/libp2p/security/security_adaptor.hpp index d07f0103..a59e70ea 100644 --- a/include/libp2p/security/security_adaptor.hpp +++ b/include/libp2p/security/security_adaptor.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace libp2p::security { diff --git a/include/libp2p/transport/tcp/tcp_util.hpp b/include/libp2p/transport/tcp/tcp_util.hpp index 95a1b4cf..d64caed1 100644 --- a/include/libp2p/transport/tcp/tcp_util.hpp +++ b/include/libp2p/transport/tcp/tcp_util.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include namespace libp2p::transport::detail { diff --git a/include/libp2p/transport/transport_adaptor.hpp b/include/libp2p/transport/transport_adaptor.hpp index 2383b07e..8a80298b 100644 --- a/include/libp2p/transport/transport_adaptor.hpp +++ b/include/libp2p/transport/transport_adaptor.hpp @@ -17,7 +17,7 @@ #include #include #include -#include // for outcome::result +#include // for outcome::result namespace libp2p::transport { diff --git a/include/libp2p/transport/upgrader.hpp b/include/libp2p/transport/upgrader.hpp index a54079dd..b92ac872 100644 --- a/include/libp2p/transport/upgrader.hpp +++ b/include/libp2p/transport/upgrader.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace libp2p::transport { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f302ec8..d3797bed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,4 +22,4 @@ add_library(p2p target_link_libraries(p2p INTERFACE p2p_default_network ) - +libp2p_install(p2p) diff --git a/src/basic/CMakeLists.txt b/src/basic/CMakeLists.txt index 3cf194a7..728c9def 100644 --- a/src/basic/CMakeLists.txt +++ b/src/basic/CMakeLists.txt @@ -3,21 +3,21 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_varint_reader +libp2p_add_library(p2p_varint_reader varint_reader.cpp ) target_link_libraries(p2p_varint_reader p2p_uvarint ) -add_library(p2p_message_read_writer_error +libp2p_add_library(p2p_message_read_writer_error message_read_writer_error.cpp ) target_link_libraries(p2p_message_read_writer_error - outcome + Boost::boost ) -add_library(p2p_message_read_writer +libp2p_add_library(p2p_message_read_writer message_read_writer.cpp ) target_link_libraries(p2p_message_read_writer @@ -25,7 +25,7 @@ target_link_libraries(p2p_message_read_writer p2p_varint_reader ) -add_library(p2p_protobuf_message_read_writer +libp2p_add_library(p2p_protobuf_message_read_writer protobuf_message_read_writer.cpp ) target_link_libraries(p2p_protobuf_message_read_writer diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index cdcaa259..38553d24 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -3,14 +3,13 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_hexutil +libp2p_add_library(p2p_hexutil hexutil.cpp ) target_link_libraries(p2p_hexutil Boost::boost - outcome ) -add_library(p2p_logger +libp2p_add_library(p2p_logger logger.cpp ) diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index d618e423..3d4a633b 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -12,14 +12,14 @@ add_subdirectory(protobuf) add_subdirectory(random_generator) add_subdirectory(sha) -add_library(p2p_crypto_error +libp2p_add_library(p2p_crypto_error error.cpp ) target_link_libraries(p2p_crypto_error - outcome + Boost::boost ) -add_library(p2p_crypto_key +libp2p_add_library(p2p_crypto_key key.cpp ) target_link_libraries(p2p_crypto_key diff --git a/src/crypto/aes_provider/CMakeLists.txt b/src/crypto/aes_provider/CMakeLists.txt index a670df78..7fad9849 100644 --- a/src/crypto/aes_provider/CMakeLists.txt +++ b/src/crypto/aes_provider/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_aes_provider +libp2p_add_library(p2p_aes_provider aes_provider_impl.cpp ) diff --git a/src/crypto/hmac_provider/CMakeLists.txt b/src/crypto/hmac_provider/CMakeLists.txt index 82647abd..4a0a7efb 100644 --- a/src/crypto/hmac_provider/CMakeLists.txt +++ b/src/crypto/hmac_provider/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_hmac_provider +libp2p_add_library(p2p_hmac_provider hmac_provider_impl.cpp ) target_link_libraries(p2p_hmac_provider diff --git a/src/crypto/key_generator/CMakeLists.txt b/src/crypto/key_generator/CMakeLists.txt index 109c97e8..e4ecb058 100644 --- a/src/crypto/key_generator/CMakeLists.txt +++ b/src/crypto/key_generator/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_key_generator +libp2p_add_library(p2p_key_generator key_generator_impl.cpp ) diff --git a/src/crypto/key_marshaller/CMakeLists.txt b/src/crypto/key_marshaller/CMakeLists.txt index b684fc0f..ac7982fb 100644 --- a/src/crypto/key_marshaller/CMakeLists.txt +++ b/src/crypto/key_marshaller/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_key_marshaller +libp2p_add_library(p2p_key_marshaller key_marshaller_impl.cpp ) target_link_libraries(p2p_key_marshaller diff --git a/src/crypto/key_validator/CMakeLists.txt b/src/crypto/key_validator/CMakeLists.txt index 9443d47e..441c1cd3 100644 --- a/src/crypto/key_validator/CMakeLists.txt +++ b/src/crypto/key_validator/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_key_validator +libp2p_add_library(p2p_key_validator key_validator_impl.cpp ) target_link_libraries(p2p_key_validator diff --git a/src/crypto/random_generator/CMakeLists.txt b/src/crypto/random_generator/CMakeLists.txt index a22a481e..483515cf 100644 --- a/src/crypto/random_generator/CMakeLists.txt +++ b/src/crypto/random_generator/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_random_generator +libp2p_add_library(p2p_random_generator boost_generator.cpp ) diff --git a/src/crypto/sha/CMakeLists.txt b/src/crypto/sha/CMakeLists.txt index 208c1f92..d6b46a33 100644 --- a/src/crypto/sha/CMakeLists.txt +++ b/src/crypto/sha/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_sha +libp2p_add_library(p2p_sha sha256.cpp ) target_link_libraries(p2p_sha diff --git a/src/host/basic_host/CMakeLists.txt b/src/host/basic_host/CMakeLists.txt index dc0c7bda..c223f839 100644 --- a/src/host/basic_host/CMakeLists.txt +++ b/src/host/basic_host/CMakeLists.txt @@ -1,9 +1,10 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_basic_host +libp2p_add_library(p2p_basic_host basic_host.cpp ) target_link_libraries(p2p_basic_host - outcome + Boost::boost + p2p_multiaddress ) diff --git a/src/multi/CMakeLists.txt b/src/multi/CMakeLists.txt index 38c496eb..3f233657 100644 --- a/src/multi/CMakeLists.txt +++ b/src/multi/CMakeLists.txt @@ -6,30 +6,29 @@ add_subdirectory(converters) add_subdirectory(multibase_codec) -add_library(p2p_uvarint +libp2p_add_library(p2p_uvarint uvarint.cpp ) target_link_libraries(p2p_uvarint - outcome + Boost::boost p2p_hexutil ) -add_library(p2p_multihash +libp2p_add_library(p2p_multihash multihash.cpp ) target_link_libraries(p2p_multihash p2p_hexutil p2p_uvarint Boost::boost - Microsoft.GSL::GSL ) -add_library(p2p_multiaddress +libp2p_add_library(p2p_multiaddress multiaddress.cpp ) target_link_libraries(p2p_multiaddress - p2p_converter_utils - outcome + p2p_converters + Boost::boost ) diff --git a/src/multi/converters/CMakeLists.txt b/src/multi/converters/CMakeLists.txt index 47faaaba..cd6009b2 100644 --- a/src/multi/converters/CMakeLists.txt +++ b/src/multi/converters/CMakeLists.txt @@ -3,24 +3,9 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_converter_utils +libp2p_add_library(p2p_converters converter_utils.cpp - ) -target_link_libraries(p2p_converter_utils - p2p_conversion_error - p2p_uvarint - p2p_hexutil - p2p_converters - ) - -add_library(p2p_conversion_error conversion_error.cpp - ) -target_link_libraries(p2p_conversion_error - outcome - ) - -add_library(p2p_converters ip_v4_converter.cpp ip_v6_converter.cpp tcp_converter.cpp @@ -28,7 +13,7 @@ add_library(p2p_converters ipfs_converter.cpp ) target_link_libraries(p2p_converters - outcome + Boost::boost p2p_hexutil p2p_uvarint p2p_multibase_codec diff --git a/src/multi/converters/converter_utils.cpp b/src/multi/converters/converter_utils.cpp index 29683257..5af2825c 100644 --- a/src/multi/converters/converter_utils.cpp +++ b/src/multi/converters/converter_utils.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include using libp2p::common::hex_upper; using libp2p::common::unhex; diff --git a/src/multi/converters/ip_v4_converter.cpp b/src/multi/converters/ip_v4_converter.cpp index 7ae7a751..ed8262dc 100644 --- a/src/multi/converters/ip_v4_converter.cpp +++ b/src/multi/converters/ip_v4_converter.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace libp2p::multi::converters { diff --git a/src/multi/converters/ip_v6_converter.cpp b/src/multi/converters/ip_v6_converter.cpp index 850b927b..003cd3ad 100644 --- a/src/multi/converters/ip_v6_converter.cpp +++ b/src/multi/converters/ip_v6_converter.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace libp2p::multi::converters { diff --git a/src/multi/converters/ipfs_converter.cpp b/src/multi/converters/ipfs_converter.cpp index 2c3fcbf7..3a3f5562 100644 --- a/src/multi/converters/ipfs_converter.cpp +++ b/src/multi/converters/ipfs_converter.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include using std::string_literals::operator""s; diff --git a/src/multi/converters/tcp_converter.cpp b/src/multi/converters/tcp_converter.cpp index 1ef1d72f..3f3741e4 100644 --- a/src/multi/converters/tcp_converter.cpp +++ b/src/multi/converters/tcp_converter.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include namespace libp2p::multi::converters { diff --git a/src/multi/converters/udp_converter.cpp b/src/multi/converters/udp_converter.cpp index 222875c1..5c76635a 100644 --- a/src/multi/converters/udp_converter.cpp +++ b/src/multi/converters/udp_converter.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include namespace libp2p::multi::converters { diff --git a/src/multi/multibase_codec/CMakeLists.txt b/src/multi/multibase_codec/CMakeLists.txt index 4c47e24e..5b14c43a 100644 --- a/src/multi/multibase_codec/CMakeLists.txt +++ b/src/multi/multibase_codec/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_multibase_codec +libp2p_add_library(p2p_multibase_codec multibase_codec_impl.cpp codecs/base16.cpp codecs/base58.cpp diff --git a/src/muxer/yamux/CMakeLists.txt b/src/muxer/yamux/CMakeLists.txt index 8cae2409..1b81b59c 100644 --- a/src/muxer/yamux/CMakeLists.txt +++ b/src/muxer/yamux/CMakeLists.txt @@ -3,20 +3,22 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_yamux +libp2p_add_library(p2p_yamux yamux.cpp ) target_link_libraries(p2p_yamux p2p_yamuxed_connection + p2p_peer_id ) -add_library(p2p_yamuxed_connection +libp2p_add_library(p2p_yamuxed_connection yamuxed_connection.cpp yamux_frame.cpp yamux_stream.cpp ) target_link_libraries(p2p_yamuxed_connection - outcome + Boost::boost p2p_logger + p2p_peer_id ) diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 4f54a044..ea3af9aa 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(impl) -add_library(p2p_default_network +libp2p_add_library(p2p_default_network default_network.cpp ) target_link_libraries(p2p_default_network diff --git a/src/network/impl/CMakeLists.txt b/src/network/impl/CMakeLists.txt index d1b9b0e3..020558b7 100644 --- a/src/network/impl/CMakeLists.txt +++ b/src/network/impl/CMakeLists.txt @@ -3,15 +3,16 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_router +libp2p_add_library(p2p_router router_impl.cpp ) target_link_libraries(p2p_router - outcome + Boost::boost + p2p_peer_id ) -add_library(p2p_listener_manager +libp2p_add_library(p2p_listener_manager listener_manager_impl.cpp ) target_link_libraries(p2p_listener_manager @@ -21,7 +22,7 @@ target_link_libraries(p2p_listener_manager ) -add_library(p2p_dialer +libp2p_add_library(p2p_dialer dialer_impl.cpp ) target_link_libraries(p2p_dialer @@ -31,23 +32,23 @@ target_link_libraries(p2p_dialer ) -add_library(p2p_network +libp2p_add_library(p2p_network network_impl.cpp ) target_link_libraries(p2p_network - outcome + Boost::boost ) -add_library(p2p_transport_manager +libp2p_add_library(p2p_transport_manager transport_manager_impl.cpp ) target_link_libraries(p2p_transport_manager p2p_multiaddress ) -add_library(p2p_connection_manager +libp2p_add_library(p2p_connection_manager connection_manager_impl.cpp ) target_link_libraries(p2p_connection_manager - outcome + Boost::boost ) diff --git a/src/peer/CMakeLists.txt b/src/peer/CMakeLists.txt index 6a98d811..5aea50af 100644 --- a/src/peer/CMakeLists.txt +++ b/src/peer/CMakeLists.txt @@ -8,35 +8,35 @@ add_subdirectory(key_repository) add_subdirectory(protocol_repository) add_subdirectory(impl) -add_library(p2p_address_repository +libp2p_add_library(p2p_address_repository address_repository.cpp ) target_link_libraries(p2p_address_repository Boost::boost ) -add_library(p2p_peer_errors +libp2p_add_library(p2p_peer_errors errors.cpp ) target_link_libraries(p2p_peer_errors - outcome + Boost::boost ) -add_library(p2p_peer_id +libp2p_add_library(p2p_peer_id peer_id.cpp ) target_link_libraries(p2p_peer_id - outcome + Boost::boost p2p_multihash p2p_multibase_codec p2p_sha ) -add_library(p2p_peer_address +libp2p_add_library(p2p_peer_address peer_address.cpp ) target_link_libraries(p2p_peer_address - outcome + Boost::boost p2p_multiaddress p2p_multihash p2p_multibase_codec diff --git a/src/peer/address_repository/CMakeLists.txt b/src/peer/address_repository/CMakeLists.txt index 31826c79..3264a06e 100644 --- a/src/peer/address_repository/CMakeLists.txt +++ b/src/peer/address_repository/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_inmem_address_repository +libp2p_add_library(p2p_inmem_address_repository inmem_address_repository.cpp ) target_link_libraries(p2p_inmem_address_repository diff --git a/src/peer/impl/CMakeLists.txt b/src/peer/impl/CMakeLists.txt index 828967bc..32ab67e9 100644 --- a/src/peer/impl/CMakeLists.txt +++ b/src/peer/impl/CMakeLists.txt @@ -3,14 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_identity_manager +libp2p_add_library(p2p_identity_manager identity_manager_impl.cpp ) target_link_libraries(p2p_identity_manager p2p_peer_id ) -add_library(p2p_peer_repository +libp2p_add_library(p2p_peer_repository peer_repository_impl.cpp ) target_link_libraries(p2p_peer_repository diff --git a/src/peer/key_repository/CMakeLists.txt b/src/peer/key_repository/CMakeLists.txt index 6b84efad..6b609fde 100644 --- a/src/peer/key_repository/CMakeLists.txt +++ b/src/peer/key_repository/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_inmem_key_repository +libp2p_add_library(p2p_inmem_key_repository inmem_key_repository.cpp ) target_link_libraries(p2p_inmem_key_repository diff --git a/src/peer/protocol_repository/CMakeLists.txt b/src/peer/protocol_repository/CMakeLists.txt index 49e62af5..41400ba7 100644 --- a/src/peer/protocol_repository/CMakeLists.txt +++ b/src/peer/protocol_repository/CMakeLists.txt @@ -1,11 +1,11 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_inmem_protocol_repository +libp2p_add_library(p2p_inmem_protocol_repository inmem_protocol_repository.cpp ) target_link_libraries(p2p_inmem_protocol_repository - outcome + Boost::boost p2p_peer_errors p2p_multihash p2p_peer_id diff --git a/src/protocol/echo/CMakeLists.txt b/src/protocol/echo/CMakeLists.txt index cd59c58b..c4f0ad9c 100644 --- a/src/protocol/echo/CMakeLists.txt +++ b/src/protocol/echo/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_protocol_echo +libp2p_add_library(p2p_protocol_echo echo.cpp server_echo_session.cpp client_echo_session.cpp diff --git a/src/protocol/identify/CMakeLists.txt b/src/protocol/identify/CMakeLists.txt index 77721d41..218e5302 100644 --- a/src/protocol/identify/CMakeLists.txt +++ b/src/protocol/identify/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(protobuf) -add_library(p2p_identify +libp2p_add_library(p2p_identify identify.cpp identify_msg_processor.cpp observed_addresses.cpp diff --git a/src/protocol/kademlia/impl/CMakeLists.txt b/src/protocol/kademlia/impl/CMakeLists.txt index d3b80f1b..cf776b99 100644 --- a/src/protocol/kademlia/impl/CMakeLists.txt +++ b/src/protocol/kademlia/impl/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_protocol_kademlia +libp2p_add_library(p2p_protocol_kademlia kad_impl.cpp ) target_link_libraries(p2p_protocol_kademlia @@ -10,7 +10,7 @@ target_link_libraries(p2p_protocol_kademlia ) -add_library(p2p_kad_routing_table +libp2p_add_library(p2p_kad_routing_table routing_table_impl.cpp ) target_link_libraries(p2p_kad_routing_table diff --git a/src/protocol/ping/CMakeLists.txt b/src/protocol/ping/CMakeLists.txt index 36cf8a71..cc59ed5c 100644 --- a/src/protocol/ping/CMakeLists.txt +++ b/src/protocol/ping/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_ping +libp2p_add_library(p2p_ping ping.cpp ping_server_session.cpp ping_client_session.cpp diff --git a/src/protocol_muxer/multiselect/CMakeLists.txt b/src/protocol_muxer/multiselect/CMakeLists.txt index 7e338766..c3b49519 100644 --- a/src/protocol_muxer/multiselect/CMakeLists.txt +++ b/src/protocol_muxer/multiselect/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -add_library(p2p_multiselect +libp2p_add_library(p2p_multiselect multiselect.cpp message_manager.cpp message_reader.cpp diff --git a/src/security/CMakeLists.txt b/src/security/CMakeLists.txt index 26919f7b..43bec57f 100644 --- a/src/security/CMakeLists.txt +++ b/src/security/CMakeLists.txt @@ -5,9 +5,9 @@ add_subdirectory(plaintext) -add_library(p2p_security_error +libp2p_add_library(p2p_security_error error.cpp ) target_link_libraries(p2p_security_error - outcome + Boost::boost ) diff --git a/src/security/plaintext/CMakeLists.txt b/src/security/plaintext/CMakeLists.txt index a7c748b2..a7d52aca 100644 --- a/src/security/plaintext/CMakeLists.txt +++ b/src/security/plaintext/CMakeLists.txt @@ -5,23 +5,23 @@ add_subdirectory(protobuf) -add_library(p2p_plaintext +libp2p_add_library(p2p_plaintext plaintext.cpp plaintext_connection.cpp plaintext_session.cpp ) target_link_libraries(p2p_plaintext - outcome + Boost::boost p2p_security_error p2p_plaintext_exchange_message_marshaller p2p_crypto_error ) -add_library(p2p_plaintext_exchange_message_marshaller +libp2p_add_library(p2p_plaintext_exchange_message_marshaller exchange_message_marshaller_impl.cpp ) target_link_libraries(p2p_plaintext_exchange_message_marshaller - outcome + Boost::boost p2p_plaintext_protobuf p2p_key_marshaller ) diff --git a/src/transport/impl/CMakeLists.txt b/src/transport/impl/CMakeLists.txt index 42595f06..07b5abd2 100644 --- a/src/transport/impl/CMakeLists.txt +++ b/src/transport/impl/CMakeLists.txt @@ -3,7 +3,7 @@ -add_library(p2p_transport_parser +libp2p_add_library(p2p_transport_parser multiaddress_parser.cpp ) target_link_libraries(p2p_transport_parser @@ -11,18 +11,18 @@ target_link_libraries(p2p_transport_parser p2p_multiaddress ) -add_library(p2p_upgrader +libp2p_add_library(p2p_upgrader upgrader_impl.cpp ) target_link_libraries(p2p_upgrader - outcome + Boost::boost ) -add_library(p2p_upgrader_session +libp2p_add_library(p2p_upgrader_session upgrader_session.cpp ) target_link_libraries(p2p_upgrader_session - outcome + Boost::boost p2p_upgrader ) diff --git a/src/transport/tcp/CMakeLists.txt b/src/transport/tcp/CMakeLists.txt index ccca63f7..daf10f8f 100644 --- a/src/transport/tcp/CMakeLists.txt +++ b/src/transport/tcp/CMakeLists.txt @@ -1,20 +1,20 @@ # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(p2p_tcp_connection tcp_connection.cpp) +libp2p_add_library(p2p_tcp_connection tcp_connection.cpp) target_link_libraries(p2p_tcp_connection Boost::boost p2p_multiaddress p2p_upgrader_session ) -add_library(p2p_tcp_listener tcp_listener.cpp) +libp2p_add_library(p2p_tcp_listener tcp_listener.cpp) target_link_libraries(p2p_tcp_listener p2p_tcp_connection p2p_upgrader_session ) -add_library(p2p_tcp tcp_transport.cpp) +libp2p_add_library(p2p_tcp tcp_transport.cpp) target_link_libraries(p2p_tcp p2p_tcp_connection p2p_tcp_listener diff --git a/test/deps/CMakeLists.txt b/test/deps/CMakeLists.txt index 5f1927c9..8d78307a 100644 --- a/test/deps/CMakeLists.txt +++ b/test/deps/CMakeLists.txt @@ -5,7 +5,7 @@ addtest(outcome_test outcome_test.cpp) target_link_libraries(outcome_test - outcome + Boost::boost ) addtest(di_test di_test.cpp) diff --git a/test/deps/outcome_test.cpp b/test/deps/outcome_test.cpp index 497a2c3d..33db1f52 100644 --- a/test/deps/outcome_test.cpp +++ b/test/deps/outcome_test.cpp @@ -4,7 +4,7 @@ */ #include -#include +#include #include using std::string_literals::operator""s; diff --git a/test/libp2p/basic/CMakeLists.txt b/test/libp2p/basic/CMakeLists.txt index e1f74df5..42f305ae 100644 --- a/test/libp2p/basic/CMakeLists.txt +++ b/test/libp2p/basic/CMakeLists.txt @@ -11,5 +11,5 @@ target_link_libraries(message_read_writer_test p2p_protobuf_message_read_writer p2p_message_read_writer_error p2p_uvarint - outcome + Boost::boost ) diff --git a/test/libp2p/crypto/aes_test.cpp b/test/libp2p/crypto/aes_test.cpp index d1eea6c5..02eb1810 100644 --- a/test/libp2p/crypto/aes_test.cpp +++ b/test/libp2p/crypto/aes_test.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "testutil/literals.hpp" using libp2p::common::ByteArray; diff --git a/test/libp2p/crypto/hmac_test.cpp b/test/libp2p/crypto/hmac_test.cpp index 0bb4857c..8acd4c79 100644 --- a/test/libp2p/crypto/hmac_test.cpp +++ b/test/libp2p/crypto/hmac_test.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include "testutil/literals.hpp" using libp2p::common::ByteArray; diff --git a/test/libp2p/crypto/keys_test.cpp b/test/libp2p/crypto/keys_test.cpp index 27bf1f99..87625814 100644 --- a/test/libp2p/crypto/keys_test.cpp +++ b/test/libp2p/crypto/keys_test.cpp @@ -4,7 +4,7 @@ */ #include -#include +#include #include "libp2p/crypto/common.hpp" #include "libp2p/crypto/key.hpp" diff --git a/test/libp2p/multi/utils/CMakeLists.txt b/test/libp2p/multi/utils/CMakeLists.txt index da18cdb5..f7c5e2b7 100644 --- a/test/libp2p/multi/utils/CMakeLists.txt +++ b/test/libp2p/multi/utils/CMakeLists.txt @@ -22,7 +22,7 @@ addtest(address_converter_test target_link_libraries(address_converter_test p2p_uvarint - p2p_converter_utils + p2p_converters ) addtest(string_to_bytes_test @@ -30,5 +30,5 @@ addtest(string_to_bytes_test ) target_link_libraries(string_to_bytes_test - p2p_converter_utils + p2p_converters ) diff --git a/test/libp2p/transport/multiaddress_parser_test.cpp b/test/libp2p/transport/multiaddress_parser_test.cpp index 9e9578ce..b1ebe805 100644 --- a/test/libp2p/transport/multiaddress_parser_test.cpp +++ b/test/libp2p/transport/multiaddress_parser_test.cpp @@ -6,7 +6,7 @@ #include "libp2p/transport/impl/multiaddress_parser.hpp" #include -#include +#include #include "testutil/outcome.hpp" #include "testutil/literals.hpp" diff --git a/test/testutil/libp2p/CMakeLists.txt b/test/testutil/libp2p/CMakeLists.txt index 201e5630..6da8f33d 100644 --- a/test/testutil/libp2p/CMakeLists.txt +++ b/test/testutil/libp2p/CMakeLists.txt @@ -6,7 +6,6 @@ add_library(p2p_testutil_peer ) target_link_libraries(p2p_testutil_peer p2p_peer_id - Microsoft.GSL::GSL ) add_library(p2p_testutil_read_writer_helper diff --git a/test/testutil/outcome.hpp b/test/testutil/outcome.hpp index d86549c0..d544f5a0 100644 --- a/test/testutil/outcome.hpp +++ b/test/testutil/outcome.hpp @@ -7,7 +7,7 @@ #define LIBP2P_GTEST_OUTCOME_UTIL_HPP #include -#include +#include #define PP_CAT(a, b) PP_CAT_I(a, b) #define PP_CAT_I(a, b) PP_CAT_II(~, a##b)