2019-12-12 03:32:27 +01:00
|
|
|
include(Version)
|
|
|
|
|
2021-08-23 17:48:55 +02:00
|
|
|
add_library(lokinet-util
|
2021-09-19 01:54:06 +02:00
|
|
|
STATIC
|
2020-03-27 01:49:05 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/bencode.cpp
|
|
|
|
util/buffer.cpp
|
|
|
|
util/fs.cpp
|
2019-02-16 00:04:04 +01:00
|
|
|
util/json.cpp
|
2021-03-11 02:01:43 +01:00
|
|
|
util/logging/buffer.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
util/easter_eggs.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/mem.cpp
|
|
|
|
util/str.cpp
|
2019-09-01 15:26:16 +02:00
|
|
|
util/thread/queue_manager.cpp
|
|
|
|
util/thread/threading.cpp
|
2021-07-29 22:40:25 +02:00
|
|
|
util/time.cpp)
|
|
|
|
|
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
add_dependencies(lokinet-util genversion)
|
2019-02-09 17:16:00 +01:00
|
|
|
|
2021-03-09 22:55:10 +01:00
|
|
|
target_include_directories(lokinet-util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR})
|
2019-12-12 03:32:27 +01:00
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
target_link_libraries(lokinet-util PUBLIC
|
|
|
|
lokinet-cryptography
|
|
|
|
nlohmann_json::nlohmann_json
|
|
|
|
filesystem
|
2022-05-10 15:47:54 +02:00
|
|
|
oxenc::oxenc
|
2022-07-16 02:41:14 +02:00
|
|
|
oxen::logging
|
2020-05-17 21:41:48 +02:00
|
|
|
)
|
2019-12-12 03:32:27 +01:00
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
add_library(lokinet-platform
|
2021-03-26 16:55:47 +01:00
|
|
|
STATIC
|
2021-03-08 20:19:20 +01:00
|
|
|
# for networking
|
2019-02-09 17:16:00 +01:00
|
|
|
ev/ev.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
ev/libuv.cpp
|
2020-05-20 21:14:05 +02:00
|
|
|
net/ip.cpp
|
2020-05-20 21:25:57 +02:00
|
|
|
net/ip_address.cpp
|
2020-05-20 21:02:48 +02:00
|
|
|
net/ip_packet.cpp
|
2020-05-20 21:14:05 +02:00
|
|
|
net/ip_range.cpp
|
2019-06-11 18:44:05 +02:00
|
|
|
net/net_int.cpp
|
2020-05-20 21:25:57 +02:00
|
|
|
net/sock_addr.cpp
|
2021-03-02 19:18:22 +01:00
|
|
|
vpn/packet_router.cpp
|
2021-09-23 20:01:04 +02:00
|
|
|
vpn/egres_packet_router.cpp
|
2021-01-12 00:13:22 +01:00
|
|
|
vpn/platform.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
)
|
|
|
|
|
2021-03-02 03:06:20 +01:00
|
|
|
target_link_libraries(lokinet-platform PUBLIC lokinet-cryptography lokinet-util Threads::Threads base_libs uvw)
|
2022-05-10 15:47:54 +02:00
|
|
|
target_link_libraries(lokinet-platform PRIVATE oxenmq::oxenmq)
|
2020-05-17 21:41:48 +02:00
|
|
|
|
|
|
|
if (ANDROID)
|
|
|
|
target_sources(lokinet-platform PRIVATE android/ifaddrs.c)
|
|
|
|
endif()
|
2019-03-05 17:21:56 +01:00
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
2022-05-23 18:45:06 +02:00
|
|
|
target_sources(lokinet-platform PRIVATE linux/dbus.cpp)
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
if (WIN32)
|
|
|
|
target_sources(lokinet-platform PRIVATE
|
2022-07-28 18:07:38 +02:00
|
|
|
net/win32.cpp
|
|
|
|
win32/exec.cpp)
|
|
|
|
add_library(lokinet-win32 STATIC
|
|
|
|
win32/dll.cpp
|
|
|
|
win32/exception.cpp)
|
|
|
|
add_library(lokinet-wintun STATIC
|
|
|
|
win32/wintun.cpp)
|
|
|
|
add_library(lokinet-windivert STATIC
|
|
|
|
win32/windivert.cpp)
|
|
|
|
|
|
|
|
# wintun and windivert are privated linked by lokinet-platform
|
|
|
|
# this is so their details do not leak out to deps of lokinet-platform
|
|
|
|
# wintun and windivert still need things from lokinet-platform
|
|
|
|
target_compile_options(lokinet-wintun PUBLIC -I${CMAKE_BINARY_DIR}/wintun/include/)
|
|
|
|
target_compile_options(lokinet-windivert PUBLIC -I${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/include/)
|
|
|
|
target_include_directories(lokinet-windivert PUBLIC ${PROJECT_SOURCE_DIR})
|
|
|
|
target_link_libraries(lokinet-wintun PUBLIC lokinet-platform lokinet-util lokinet-config)
|
|
|
|
target_link_libraries(lokinet-win32 PUBLIC lokinet-util)
|
|
|
|
target_link_libraries(lokinet-windivert PUBLIC oxen-logging)
|
|
|
|
target_link_libraries(lokinet-windivert PRIVATE lokinet-win32)
|
|
|
|
target_link_libraries(lokinet-platform PRIVATE lokinet-win32 lokinet-wintun lokinet-windivert)
|
|
|
|
else()
|
|
|
|
target_sources(lokinet-platform PRIVATE
|
|
|
|
net/posix.cpp)
|
2020-05-17 21:41:48 +02:00
|
|
|
endif()
|
|
|
|
|
2022-07-28 18:07:38 +02:00
|
|
|
|
2020-05-17 21:41:48 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
target_include_directories(lokinet-platform SYSTEM PUBLIC /usr/local/include)
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
2020-05-17 21:41:48 +02:00
|
|
|
|
2022-07-28 18:07:38 +02:00
|
|
|
add_library(lokinet-dns
|
2021-03-26 16:55:47 +01:00
|
|
|
STATIC
|
2019-02-09 17:16:00 +01:00
|
|
|
dns/message.cpp
|
|
|
|
dns/name.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
dns/platform.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
dns/question.cpp
|
|
|
|
dns/rr.cpp
|
|
|
|
dns/serialize.cpp
|
|
|
|
dns/server.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
dns/srv_data.cpp)
|
|
|
|
|
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
target_sources(lokinet-dns PRIVATE dns/nm_platform.cpp dns/sd_platform.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(lokinet-dns PUBLIC lokinet-platform uvw)
|
|
|
|
target_link_libraries(lokinet-dns PRIVATE libunbound lokinet-config)
|
|
|
|
|
|
|
|
add_library(lokinet-config
|
|
|
|
STATIC
|
|
|
|
config/config.cpp
|
|
|
|
config/definition.cpp
|
|
|
|
config/ini.cpp
|
|
|
|
config/key_manager.cpp)
|
2019-02-09 17:16:00 +01:00
|
|
|
|
2022-07-28 18:07:38 +02:00
|
|
|
target_link_libraries(lokinet-config PUBLIC lokinet-dns lokinet-platform oxenmq::oxenmq)
|
|
|
|
|
|
|
|
add_library(lokinet-amalgum
|
|
|
|
STATIC
|
2020-01-21 18:31:48 +01:00
|
|
|
consensus/table.cpp
|
2021-06-06 14:32:23 +02:00
|
|
|
consensus/reachability_testing.cpp
|
2020-01-21 18:31:48 +01:00
|
|
|
|
2019-12-06 18:32:46 +01:00
|
|
|
bootstrap.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
context.cpp
|
|
|
|
crypto/crypto_libsodium.cpp
|
|
|
|
crypto/crypto.cpp
|
|
|
|
crypto/encrypted_frame.cpp
|
|
|
|
crypto/types.cpp
|
|
|
|
dht/context.cpp
|
|
|
|
dht/dht.cpp
|
|
|
|
dht/explorenetworkjob.cpp
|
|
|
|
dht/localtaglookup.cpp
|
|
|
|
dht/localrouterlookup.cpp
|
|
|
|
dht/localserviceaddresslookup.cpp
|
|
|
|
dht/message.cpp
|
|
|
|
dht/messages/findintro.cpp
|
|
|
|
dht/messages/findrouter.cpp
|
|
|
|
dht/messages/gotintro.cpp
|
|
|
|
dht/messages/gotrouter.cpp
|
|
|
|
dht/messages/pubintro.cpp
|
2020-09-17 21:18:08 +02:00
|
|
|
dht/messages/findname.cpp
|
|
|
|
dht/messages/gotname.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
dht/publishservicejob.cpp
|
|
|
|
dht/recursiverouterlookup.cpp
|
|
|
|
dht/serviceaddresslookup.cpp
|
|
|
|
dht/taglookup.cpp
|
2021-04-06 14:25:46 +02:00
|
|
|
|
|
|
|
endpoint_base.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
exit/context.cpp
|
|
|
|
exit/endpoint.cpp
|
2019-06-15 16:55:14 +02:00
|
|
|
exit/exit_messages.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
exit/policy.cpp
|
|
|
|
exit/session.cpp
|
|
|
|
handlers/exit.cpp
|
|
|
|
handlers/tun.cpp
|
2019-03-29 16:17:49 +01:00
|
|
|
iwp/iwp.cpp
|
2019-08-22 22:53:27 +02:00
|
|
|
iwp/linklayer.cpp
|
|
|
|
iwp/message_buffer.cpp
|
|
|
|
iwp/session.cpp
|
2019-06-26 23:39:29 +02:00
|
|
|
link/link_manager.cpp
|
2020-11-10 15:24:58 +01:00
|
|
|
link/session.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
link/server.cpp
|
|
|
|
messages/dht_immediate.cpp
|
|
|
|
messages/link_intro.cpp
|
2019-06-15 16:55:13 +02:00
|
|
|
messages/link_message_parser.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
messages/relay.cpp
|
|
|
|
messages/relay_commit.cpp
|
2019-06-04 20:31:17 +02:00
|
|
|
messages/relay_status.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
net/address_info.cpp
|
|
|
|
net/exit_info.cpp
|
2021-04-14 17:07:06 +02:00
|
|
|
net/traffic_policy.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
nodedb.cpp
|
2019-06-18 01:19:39 +02:00
|
|
|
path/ihophandler.cpp
|
|
|
|
path/path_context.cpp
|
|
|
|
path/path.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
path/pathbuilder.cpp
|
|
|
|
path/pathset.cpp
|
|
|
|
path/transit_hop.cpp
|
2020-05-20 19:26:45 +02:00
|
|
|
peerstats/peer_db.cpp
|
2020-05-20 23:00:10 +02:00
|
|
|
peerstats/types.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
pow.cpp
|
|
|
|
profiling.cpp
|
2022-04-07 22:44:23 +02:00
|
|
|
|
2021-03-26 16:49:30 +01:00
|
|
|
quic/address.cpp
|
|
|
|
quic/client.cpp
|
|
|
|
quic/connection.cpp
|
|
|
|
quic/endpoint.cpp
|
|
|
|
quic/null_crypto.cpp
|
|
|
|
quic/server.cpp
|
|
|
|
quic/stream.cpp
|
|
|
|
quic/tunnel.cpp
|
|
|
|
|
|
|
|
router_contact.cpp
|
|
|
|
router_id.cpp
|
|
|
|
router_version.cpp
|
|
|
|
service/name.cpp
|
2019-06-26 23:39:29 +02:00
|
|
|
router/outbound_message_handler.cpp
|
|
|
|
router/outbound_session_maker.cpp
|
|
|
|
router/rc_lookup_handler.cpp
|
2020-01-30 18:23:16 +01:00
|
|
|
router/rc_gossiper.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
router/router.cpp
|
2020-09-24 02:28:38 +02:00
|
|
|
router/route_poker.cpp
|
2022-07-28 18:07:38 +02:00
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
routing/dht_message.cpp
|
|
|
|
routing/message_parser.cpp
|
2019-06-20 00:30:07 +02:00
|
|
|
routing/path_confirm_message.cpp
|
|
|
|
routing/path_latency_message.cpp
|
|
|
|
routing/path_transfer_message.cpp
|
|
|
|
routing/transfer_traffic_message.cpp
|
2020-05-18 18:06:52 +02:00
|
|
|
rpc/lokid_rpc_client.cpp
|
2020-05-21 16:09:45 +02:00
|
|
|
rpc/rpc_server.cpp
|
2020-06-02 23:10:42 +02:00
|
|
|
rpc/endpoint_rpc.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/address.cpp
|
2019-04-21 19:41:58 +02:00
|
|
|
service/async_key_exchange.cpp
|
2020-06-02 23:10:42 +02:00
|
|
|
service/auth.cpp
|
2021-03-12 18:41:48 +01:00
|
|
|
service/convotag.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/context.cpp
|
2019-07-15 11:15:51 +02:00
|
|
|
service/endpoint_state.cpp
|
2019-04-30 03:06:20 +02:00
|
|
|
service/endpoint_util.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/endpoint.cpp
|
2019-04-21 19:41:58 +02:00
|
|
|
service/hidden_service_address_lookup.cpp
|
2019-04-22 20:35:19 +02:00
|
|
|
service/identity.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/info.cpp
|
2019-04-22 20:35:19 +02:00
|
|
|
service/intro_set.cpp
|
|
|
|
service/intro.cpp
|
2021-03-19 15:09:06 +01:00
|
|
|
service/lns_tracker.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/lookup.cpp
|
2020-09-17 21:18:08 +02:00
|
|
|
service/name.cpp
|
2019-04-21 18:44:27 +02:00
|
|
|
service/outbound_context.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/protocol.cpp
|
2019-07-15 11:15:51 +02:00
|
|
|
service/router_lookup_job.cpp
|
2019-04-19 18:02:32 +02:00
|
|
|
service/sendcontext.cpp
|
2019-04-21 20:38:30 +02:00
|
|
|
service/session.cpp
|
2020-02-27 22:16:46 +01:00
|
|
|
service/tag.cpp
|
2020-03-01 02:58:45 +01:00
|
|
|
)
|
2020-05-17 21:41:48 +02:00
|
|
|
|
|
|
|
|
2022-07-28 18:07:38 +02:00
|
|
|
if(WITH_PEERSTATS_BACKEND)
|
|
|
|
target_compile_definitions(lokinet-amalgum PRIVATE -DLOKINET_PEERSTATS_BACKEND)
|
|
|
|
target_link_libraries(lokinet-amalgum PUBLIC sqlite_orm)
|
2020-02-24 16:26:46 +01:00
|
|
|
endif()
|
|
|
|
|
2020-02-27 21:17:37 +01:00
|
|
|
if(WITH_HIVE)
|
2022-07-28 18:07:38 +02:00
|
|
|
target_sources(lokinet-amalgum PRIVATE
|
2020-06-29 17:44:13 +02:00
|
|
|
tooling/router_hive.cpp
|
|
|
|
tooling/hive_router.cpp
|
|
|
|
tooling/hive_context.cpp
|
|
|
|
)
|
2020-02-27 21:17:37 +01:00
|
|
|
endif()
|
|
|
|
|
2022-07-28 18:07:38 +02:00
|
|
|
# TODO: make libunbound hidden behind a feature flag like sqlite for embedded lokinet
|
|
|
|
target_link_libraries(lokinet-amalgum PRIVATE libunbound)
|
|
|
|
|
|
|
|
target_link_libraries(lokinet-amalgum PUBLIC
|
2022-07-16 02:41:14 +02:00
|
|
|
cxxopts
|
|
|
|
oxenc::oxenc
|
|
|
|
lokinet-platform
|
2022-07-28 18:07:38 +02:00
|
|
|
lokinet-config
|
|
|
|
lokinet-dns
|
2022-07-16 02:41:14 +02:00
|
|
|
lokinet-util
|
|
|
|
lokinet-cryptography
|
|
|
|
ngtcp2_static
|
|
|
|
oxenmq::oxenmq)
|
2022-07-28 18:07:38 +02:00
|
|
|
|
|
|
|
enable_lto(lokinet-util lokinet-platform lokinet-dns lokinet-config lokinet-amalgum)
|
|
|
|
|
2022-04-01 20:31:20 +02:00
|
|
|
pkg_check_modules(CRYPT libcrypt IMPORTED_TARGET)
|
2022-04-18 19:59:14 +02:00
|
|
|
if(CRYPT_FOUND AND NOT CMAKE_CROSSCOMPILING)
|
2022-04-01 20:31:20 +02:00
|
|
|
add_definitions(-DHAVE_CRYPT)
|
2022-04-01 19:18:18 +02:00
|
|
|
add_library(libcrypt INTERFACE)
|
|
|
|
target_link_libraries(libcrypt INTERFACE PkgConfig::CRYPT)
|
2022-07-28 18:07:38 +02:00
|
|
|
target_link_libraries(lokinet-amalgum PRIVATE libcrypt)
|
2022-04-01 20:31:20 +02:00
|
|
|
message(STATUS "using libcrypt ${CRYPT_VERSION}")
|
2022-04-01 19:18:18 +02:00
|
|
|
endif()
|
2019-03-11 14:01:53 +01:00
|
|
|
|
2020-05-19 20:53:03 +02:00
|
|
|
|
2021-03-08 20:19:20 +01:00
|
|
|
if(BUILD_LIBLOKINET)
|
2020-10-28 23:26:43 +01:00
|
|
|
include(GNUInstallDirs)
|
2021-03-08 20:19:20 +01:00
|
|
|
add_library(lokinet-shared SHARED lokinet_shared.cpp)
|
2022-07-28 18:07:38 +02:00
|
|
|
target_link_libraries(lokinet-shared PUBLIC lokinet-amalgum)
|
2020-05-17 21:41:48 +02:00
|
|
|
if(WIN32)
|
2021-04-19 13:19:07 +02:00
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "")
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
2021-04-19 13:19:07 +02:00
|
|
|
set_target_properties(lokinet-shared PROPERTIES OUTPUT_NAME lokinet)
|
2021-05-13 12:40:17 +02:00
|
|
|
if(WIN32)
|
|
|
|
target_link_libraries(lokinet-shared PUBLIC ws2_32 iphlpapi -fstack-protector)
|
|
|
|
install(TARGETS lokinet-shared DESTINATION bin COMPONENT liblokinet)
|
2022-06-22 23:56:35 +02:00
|
|
|
elseif(NOT APPLE)
|
2021-05-13 12:40:17 +02:00
|
|
|
install(TARGETS lokinet-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT liblokinet)
|
|
|
|
endif()
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
2019-02-15 21:49:10 +01:00
|
|
|
|
2021-05-14 19:07:44 +02:00
|
|
|
if(APPLE)
|
2021-08-23 17:48:55 +02:00
|
|
|
add_subdirectory(apple)
|
2021-05-14 19:07:44 +02:00
|
|
|
endif()
|
|
|
|
|
2020-03-30 14:15:32 +02:00
|
|
|
file(GLOB_RECURSE docs_SRC */*.hpp *.hpp)
|
2021-03-08 20:19:20 +01:00
|
|
|
|
2020-03-27 16:04:13 +01:00
|
|
|
set(DOCS_SRC ${docs_SRC} PARENT_SCOPE)
|