Untangle some interdependencies

macOS doing a shared library build is not working without untangling
some of the interdependencies.  This commit does that, at least enough
to get macOS to compile.

This isn't the cleanest as currently implemented (we have some net/
things in `liblokinet-platform` and some in `liblokinet`, and likewise
ev/vpnio.cpp is in `liblokinet` while the rest of `ev/*` is in
`liblokinet-platform`).
pull/1282/head
Jason Rhinelander 4 years ago
parent 97088719e0
commit 7f9160bb6e

@ -1,10 +1,6 @@
include(Version) include(Version)
add_library(lokinet-util add_library(lokinet-util
config/config.cpp
config/definition.cpp
config/ini.cpp
config/key_manager.cpp
${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp ${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp
util/bencode.cpp util/bencode.cpp
util/buffer.cpp util/buffer.cpp
@ -41,13 +37,6 @@ target_link_libraries(lokinet-util PUBLIC
filesystem filesystem
date::date date::date
) )
if(TARGET curl)
target_link_libraries(lokinet-util PUBLIC curl)
target_compile_definitions(lokinet-util PRIVATE HAVE_CURL)
if(TARGET libcurl_external)
add_dependencies(lokinet-util libcurl_external)
endif()
endif()
if(ANDROID) if(ANDROID)
target_link_libraries(lokinet-util PUBLIC log) target_link_libraries(lokinet-util PUBLIC log)
@ -58,14 +47,15 @@ add_library(lokinet-platform
# for networking # for networking
ev/ev.cpp ev/ev.cpp
ev/pipe.cpp ev/pipe.cpp
ev/vpnio.cpp
ev/ev_libuv.cpp ev/ev_libuv.cpp
net/ip.cpp net/ip.cpp
net/ip_address.cpp
net/ip_packet.cpp net/ip_packet.cpp
net/ip_range.cpp net/ip_range.cpp
net/net.cpp net/net.cpp
net/net_int.cpp net/net_int.cpp
net/sock_addr.cpp
$<TARGET_OBJECTS:tuntap> $<TARGET_OBJECTS:tuntap>
) )
@ -100,6 +90,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
endif() endif()
add_library(liblokinet add_library(liblokinet
config/config.cpp
config/definition.cpp
config/ini.cpp
config/key_manager.cpp
dns/message.cpp dns/message.cpp
dns/name.cpp dns/name.cpp
dns/question.cpp dns/question.cpp
@ -109,6 +104,8 @@ add_library(liblokinet
consensus/table.cpp consensus/table.cpp
ev/vpnio.cpp
bootstrap.cpp bootstrap.cpp
context.cpp context.cpp
crypto/crypto_libsodium.cpp crypto/crypto_libsodium.cpp
@ -152,8 +149,6 @@ add_library(liblokinet
messages/relay_commit.cpp messages/relay_commit.cpp
messages/relay_status.cpp messages/relay_status.cpp
net/address_info.cpp net/address_info.cpp
net/ip_address.cpp
net/sock_addr.cpp
net/exit_info.cpp net/exit_info.cpp
nodedb.cpp nodedb.cpp
path/ihophandler.cpp path/ihophandler.cpp
@ -200,6 +195,15 @@ add_library(liblokinet
service/tag.cpp service/tag.cpp
) )
if(TARGET curl)
# key_manager needs curl for now (to fetch service node keys from lokid)
target_link_libraries(liblokinet PUBLIC curl)
target_compile_definitions(liblokinet PRIVATE HAVE_CURL)
if(TARGET libcurl_external)
add_dependencies(liblokinet libcurl_external)
endif()
endif()
set_target_properties(liblokinet PROPERTIES OUTPUT_NAME lokinet) set_target_properties(liblokinet PROPERTIES OUTPUT_NAME lokinet)
enable_lto(lokinet-util lokinet-platform liblokinet) enable_lto(lokinet-util lokinet-platform liblokinet)

@ -5,6 +5,7 @@
#include <net/ip_packet.hpp> #include <net/ip_packet.hpp>
#include <path/pathbuilder.hpp> #include <path/pathbuilder.hpp>
#include <routing/transfer_traffic_message.hpp> #include <routing/transfer_traffic_message.hpp>
#include <constants/path.hpp>
#include <deque> #include <deque>
#include <queue> #include <queue>

@ -86,7 +86,7 @@ struct ipv6_header
}; };
#include <memory> #include <memory>
#include <service/protocol.hpp> #include <service/protocol_type.hpp>
#include <utility> #include <utility>
struct llarp_ev_loop; struct llarp_ev_loop;

@ -5,6 +5,7 @@
#include <crypto/types.hpp> #include <crypto/types.hpp>
#include <dht/message.hpp> #include <dht/message.hpp>
#include <routing/message.hpp> #include <routing/message.hpp>
#include <service/protocol_type.hpp>
#include <service/identity.hpp> #include <service/identity.hpp>
#include <service/info.hpp> #include <service/info.hpp>
#include <service/intro.hpp> #include <service/intro.hpp>
@ -31,12 +32,6 @@ namespace llarp
{ {
constexpr std::size_t MAX_PROTOCOL_MESSAGE_SIZE = 2048 * 2; constexpr std::size_t MAX_PROTOCOL_MESSAGE_SIZE = 2048 * 2;
using ProtocolType = uint64_t;
constexpr ProtocolType eProtocolControl = 0UL;
constexpr ProtocolType eProtocolTrafficV4 = 1UL;
constexpr ProtocolType eProtocolTrafficV6 = 2UL;
/// inner message /// inner message
struct ProtocolMessage struct ProtocolMessage
{ {

@ -0,0 +1,13 @@
#pragma once
#include <cstdint>
namespace llarp::service {
using ProtocolType = uint64_t;
constexpr ProtocolType eProtocolControl = 0UL;
constexpr ProtocolType eProtocolTrafficV4 = 1UL;
constexpr ProtocolType eProtocolTrafficV6 = 2UL;
}
Loading…
Cancel
Save