mirror of https://github.com/libp2p/cpp-libp2p.git
Browse Source
* Move outcome to project Signed-off-by: Bogdan Vaneev <warchantua@gmail.com> * Add example Signed-off-by: Bogdan Vaneev <warchantua@gmail.com> * add install step Signed-off-by: Bogdan Vaneev <warchantua@gmail.com> * Fix Signed-off-by: Bogdan Vaneev <warchantua@gmail.com> * Cleanup "install" Signed-off-by: Bogdan Vaneev <warchantua@gmail.com> * Fix Signed-off-by: Bogdan Vaneev <warchantua@gmail.com>pull/12/head
Bohdan
5 years ago
committed by
GitHub
110 changed files with 234 additions and 325 deletions
@ -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 |
|||
) |
|||
|
@ -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 |
|||
# ) |
@ -0,0 +1,6 @@ |
|||
function(libp2p_add_library target) |
|||
add_library(${target} |
|||
${ARGN} |
|||
) |
|||
libp2p_install(${target}) |
|||
endfunction() |
@ -1,4 +0,0 @@ |
|||
# Copyright Soramitsu Co., Ltd. All Rights Reserved. |
|||
# SPDX-License-Identifier: Apache-2.0 |
|||
|
|||
add_subdirectory(outcome) |
@ -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 |
|||
) |
@ -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 |
|||
) |
@ -0,0 +1,10 @@ |
|||
#include <iostream> |
|||
#include <libp2p/multi/multiaddress.hpp> |
|||
|
|||
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; |
|||
} |
@ -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 |
|||
) |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue