2019-02-09 16:16:00 +00:00
|
|
|
set(LIB_UTIL_SRC
|
|
|
|
constants/defaults.cpp
|
|
|
|
constants/link_layer.cpp
|
|
|
|
constants/proto.cpp
|
|
|
|
constants/version.cpp
|
|
|
|
util/aligned.cpp
|
|
|
|
util/bencode.cpp
|
|
|
|
util/bits.cpp
|
|
|
|
util/buffer.cpp
|
|
|
|
util/codel.cpp
|
|
|
|
util/common.cpp
|
|
|
|
util/encode.cpp
|
|
|
|
util/endian.cpp
|
|
|
|
util/fs.cpp
|
|
|
|
util/ini.cpp
|
2019-02-15 23:04:04 +00:00
|
|
|
util/json.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/logger.cpp
|
2019-04-11 12:58:23 +00:00
|
|
|
util/android_logger.cpp
|
2019-04-16 13:20:48 +00:00
|
|
|
util/file_logger.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/logic.cpp
|
|
|
|
util/mem.cpp
|
2019-06-02 21:19:10 +00:00
|
|
|
util/memfn_traits.cpp
|
|
|
|
util/memfn.cpp
|
2019-02-27 21:46:23 +00:00
|
|
|
util/metrics_core.cpp
|
|
|
|
util/metrics_types.cpp
|
2019-06-02 21:19:10 +00:00
|
|
|
util/ostream_logger.cpp
|
|
|
|
util/syslog_logger.cpp
|
|
|
|
util/win32_logger.cpp
|
2019-02-27 21:46:23 +00:00
|
|
|
util/metrics.cpp
|
2019-03-20 23:18:32 +00:00
|
|
|
util/object.cpp
|
|
|
|
util/printer.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/queue_manager.cpp
|
|
|
|
util/queue.cpp
|
2019-03-20 23:18:32 +00:00
|
|
|
util/scheduler.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/status.cpp
|
2019-02-27 21:46:23 +00:00
|
|
|
util/stopwatch.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/str.cpp
|
|
|
|
util/string_view.cpp
|
|
|
|
util/thread_pool.cpp
|
|
|
|
util/threading.cpp
|
|
|
|
util/threadpool.cpp
|
|
|
|
util/time.cpp
|
|
|
|
util/timer.cpp
|
2019-03-20 23:18:32 +00:00
|
|
|
util/timerqueue.cpp
|
2019-02-24 04:52:34 +00:00
|
|
|
util/traits.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
util/types.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
2019-03-03 15:01:05 +00:00
|
|
|
target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
2019-04-24 23:27:31 +00:00
|
|
|
target_link_libraries_system(${UTIL_LIB} absl::synchronization absl::hash nlohmann_json::nlohmann_json)
|
2019-04-11 15:17:58 +00:00
|
|
|
|
2019-02-09 16:16:00 +00:00
|
|
|
# cut back on fluff
|
|
|
|
if (NOT WIN32)
|
2019-04-24 23:27:31 +00:00
|
|
|
target_link_libraries_system(${UTIL_LIB} absl::optional absl::variant absl::strings cppbackport)
|
2019-02-09 16:16:00 +00:00
|
|
|
endif(NOT WIN32)
|
|
|
|
|
2019-02-11 00:02:20 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set(ISOLATE_PROC_SRC linux/netns.cpp)
|
|
|
|
endif()
|
|
|
|
|
2019-02-09 16:16:00 +00:00
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
# for networking
|
|
|
|
ev/ev.cpp
|
2019-04-08 12:01:52 +00:00
|
|
|
ev/pipe.cpp
|
2019-04-14 16:08:51 +00:00
|
|
|
metrics/metrictank_publisher.cpp
|
2019-04-09 12:51:10 +00:00
|
|
|
metrics/publishers.cpp
|
2019-06-11 16:44:05 +00:00
|
|
|
net/ip.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
net/net.cpp
|
|
|
|
net/net_addr.cpp
|
|
|
|
net/net_inaddr.cpp
|
2019-06-11 16:44:05 +00:00
|
|
|
net/net_int.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
# for android shim
|
|
|
|
${ANDROID_PLATFORM_SRC}
|
|
|
|
# process isolation implementation
|
|
|
|
${ISOLATE_PROC_SRC}
|
|
|
|
# tun
|
|
|
|
${LIBTUNTAP_SRC}
|
|
|
|
${EV_SRC}
|
2019-06-02 21:17:05 +00:00
|
|
|
ev/ev_libuv.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
)
|
|
|
|
|
2019-03-05 16:21:56 +00:00
|
|
|
if (WIN32)
|
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
${LIB_PLATFORM_SRC}
|
|
|
|
win32/win32_inet.c
|
|
|
|
win32/win32_intrnl.c
|
|
|
|
win32/win32_upoll.c
|
|
|
|
)
|
|
|
|
endif(WIN32)
|
|
|
|
|
2019-03-26 21:07:16 +00:00
|
|
|
if (SOLARIS)
|
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
${LIB_PLATFORM_SRC}
|
|
|
|
ev/upoll_sun.c
|
|
|
|
)
|
|
|
|
endif(SOLARIS)
|
|
|
|
|
2019-02-09 16:16:00 +00:00
|
|
|
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
|
2019-02-14 00:22:21 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${UTIL_LIB} libutp Threads::Threads)
|
2019-02-09 16:16:00 +00:00
|
|
|
|
2019-02-11 00:02:20 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
if(NON_PC_TARGET)
|
|
|
|
add_import_library(rt)
|
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC rt)
|
|
|
|
else()
|
|
|
|
add_import_library(rt)
|
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC cap)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
2019-02-14 00:22:21 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC iphlpapi)
|
2019-02-11 00:02:20 +00:00
|
|
|
endif()
|
2019-02-09 16:16:00 +00:00
|
|
|
set(DNSLIB_SRC
|
|
|
|
dns/dns.cpp
|
|
|
|
dns/message.cpp
|
|
|
|
dns/name.cpp
|
|
|
|
dns/query.cpp
|
|
|
|
dns/question.cpp
|
|
|
|
dns/rectypes.cpp
|
|
|
|
dns/rr.cpp
|
|
|
|
dns/serialize.cpp
|
|
|
|
dns/server.cpp
|
|
|
|
dns/string.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(LIB_SRC
|
|
|
|
${DNSLIB_SRC}
|
|
|
|
config.cpp
|
|
|
|
context.cpp
|
|
|
|
crypto/constants.cpp
|
|
|
|
crypto/crypto_libsodium.cpp
|
2019-05-28 00:19:25 +00:00
|
|
|
crypto/crypto_noop.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
crypto/crypto.cpp
|
2019-03-20 14:51:10 +00:00
|
|
|
crypto/ec.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
crypto/encrypted_frame.cpp
|
|
|
|
crypto/encrypted.cpp
|
|
|
|
crypto/types.cpp
|
|
|
|
dht/bucket.cpp
|
|
|
|
dht/context.cpp
|
|
|
|
dht/dht.cpp
|
|
|
|
dht/explorenetworkjob.cpp
|
|
|
|
dht/kademlia.cpp
|
|
|
|
dht/key.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
|
|
|
|
dht/node.cpp
|
|
|
|
dht/publishservicejob.cpp
|
|
|
|
dht/recursiverouterlookup.cpp
|
|
|
|
dht/serviceaddresslookup.cpp
|
|
|
|
dht/taglookup.cpp
|
|
|
|
dht/tx.cpp
|
|
|
|
dht/txholder.cpp
|
|
|
|
dht/txowner.cpp
|
|
|
|
dns.cpp
|
|
|
|
dnsc.cpp
|
|
|
|
dnsd.cpp
|
|
|
|
exit/close_exit.cpp
|
|
|
|
exit/context.cpp
|
|
|
|
exit/endpoint.cpp
|
|
|
|
exit/grant_exit.cpp
|
|
|
|
exit/obtain_exit.cpp
|
|
|
|
exit/policy.cpp
|
|
|
|
exit/reject_exit.cpp
|
|
|
|
exit/session.cpp
|
|
|
|
exit/transfer_traffic.cpp
|
|
|
|
exit/update_exit.cpp
|
|
|
|
handlers/exit.cpp
|
|
|
|
handlers/null.cpp
|
|
|
|
handlers/tun.cpp
|
2019-04-22 12:25:25 +00:00
|
|
|
hook/shell.cpp
|
2019-03-29 15:17:49 +00:00
|
|
|
iwp/linklayer.cpp
|
|
|
|
iwp/outermessage.cpp
|
|
|
|
iwp/iwp.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
link/server.cpp
|
|
|
|
link/session.cpp
|
|
|
|
messages/dht_immediate.cpp
|
2019-03-29 12:19:06 +00:00
|
|
|
messages/dht.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
messages/discard.cpp
|
|
|
|
messages/exit.cpp
|
|
|
|
messages/link_intro.cpp
|
|
|
|
messages/link_message.cpp
|
|
|
|
messages/path_confirm.cpp
|
|
|
|
messages/path_latency.cpp
|
|
|
|
messages/path_transfer.cpp
|
|
|
|
messages/relay.cpp
|
|
|
|
messages/relay_commit.cpp
|
|
|
|
messages/transfer_traffic.cpp
|
|
|
|
net/address_info.cpp
|
|
|
|
net/exit_info.cpp
|
|
|
|
nodedb.cpp
|
|
|
|
path/path.cpp
|
|
|
|
path/path_types.cpp
|
|
|
|
path/pathbuilder.cpp
|
|
|
|
path/pathset.cpp
|
|
|
|
path/transit_hop.cpp
|
|
|
|
pow.cpp
|
|
|
|
profiling.cpp
|
2019-02-11 19:45:42 +00:00
|
|
|
router/abstractrouter.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
router/router.cpp
|
|
|
|
router_contact.cpp
|
|
|
|
router_id.cpp
|
|
|
|
routing/dht_message.cpp
|
|
|
|
routing/handler.cpp
|
|
|
|
routing/message_parser.cpp
|
|
|
|
routing/message.cpp
|
|
|
|
routing/path_confirm.cpp
|
|
|
|
routing/path_latency.cpp
|
|
|
|
routing/path_transfer.cpp
|
|
|
|
rpc/rpc.cpp
|
|
|
|
service/address.cpp
|
2019-04-21 17:41:58 +00:00
|
|
|
service/async_key_exchange.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/config.cpp
|
|
|
|
service/context.cpp
|
2019-04-30 01:06:20 +00:00
|
|
|
service/endpoint_util.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/endpoint.cpp
|
|
|
|
service/handler.cpp
|
2019-04-21 17:41:58 +00:00
|
|
|
service/hidden_service_address_lookup.cpp
|
2019-04-22 18:35:19 +00:00
|
|
|
service/identity.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/info.cpp
|
2019-04-22 18:35:19 +00:00
|
|
|
service/intro_set.cpp
|
|
|
|
service/intro.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/lookup.cpp
|
2019-04-21 16:44:27 +00:00
|
|
|
service/outbound_context.cpp
|
2019-04-19 16:02:32 +00:00
|
|
|
service/pendingbuffer.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/protocol.cpp
|
2019-04-19 16:02:32 +00:00
|
|
|
service/sendcontext.cpp
|
2019-04-21 18:38:30 +00:00
|
|
|
service/session.cpp
|
2019-04-21 17:41:58 +00:00
|
|
|
service/tag_lookup_job.cpp
|
2019-04-22 18:35:19 +00:00
|
|
|
service/tag.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
service/vanity.cpp
|
2019-03-29 14:23:19 +00:00
|
|
|
utp/inbound_message.cpp
|
|
|
|
utp/linklayer.cpp
|
|
|
|
utp/session.cpp
|
|
|
|
utp/utp.cpp
|
2019-02-09 16:16:00 +00:00
|
|
|
)
|
2019-02-11 00:02:20 +00:00
|
|
|
if(TESTNET)
|
2019-03-11 13:01:53 +00:00
|
|
|
set(LIB_SRC ${LIB_SRC} testnet.c)
|
2019-02-11 00:02:20 +00:00
|
|
|
endif()
|
|
|
|
|
2019-03-11 13:01:53 +00:00
|
|
|
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
|
|
|
set(LIBS ${LIBS} libutp)
|
2019-04-19 18:24:33 +00:00
|
|
|
target_link_libraries(${STATIC_LIB} PUBLIC cxxopts ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS})
|
2019-03-11 13:01:53 +00:00
|
|
|
|
2019-06-10 16:26:19 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2019-06-10 16:27:36 +00:00
|
|
|
target_include_directories(${PLATFORM_LIB} SYSTEM PUBLIC /usr/local/include)
|
2019-06-10 16:26:19 +00:00
|
|
|
target_include_directories(${STATIC_LIB} SYSTEM PUBLIC /usr/local/include)
|
|
|
|
endif()
|
|
|
|
|
2019-02-11 00:02:20 +00:00
|
|
|
if(WITH_SHARED)
|
|
|
|
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
|
2019-03-11 13:01:53 +00:00
|
|
|
set(LIBS ${LIBS} Threads::Threads)
|
|
|
|
target_link_libraries(${SHARED_LIB} PUBLIC ${ABYSS_LIB} ${CRYPTOGRAPHY_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ${LIBS})
|
2019-02-11 00:02:20 +00:00
|
|
|
if (WIN32)
|
2019-05-06 02:33:19 +00:00
|
|
|
target_link_libraries(${SHARED_LIB} PUBLIC ${FS_LIB} ws2_32 iphlpapi)
|
2019-02-11 00:02:20 +00:00
|
|
|
else()
|
|
|
|
install(TARGETS ${SHARED_LIB} LIBRARY DESTINATION lib)
|
|
|
|
endif()
|
2019-02-15 20:49:10 +00:00
|
|
|
add_log_tag(${SHARED_LIB})
|
2019-02-11 00:02:20 +00:00
|
|
|
endif()
|
2019-02-15 20:49:10 +00:00
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
if (WARNINGS_AS_ERRORS)
|
2019-04-25 23:21:19 +00:00
|
|
|
set(WARN_FLAGS -Wall -Wextra -Wshadow -Werror)
|
2019-04-24 23:27:31 +00:00
|
|
|
target_compile_options(${UTIL_LIB} PUBLIC ${WARN_FLAGS})
|
|
|
|
target_compile_options(${PLATFORM_LIB} PUBLIC ${WARN_FLAGS})
|
|
|
|
target_compile_options(${STATIC_LIB} PUBLIC ${WARN_FLAGS})
|
|
|
|
endif()
|
2019-02-15 20:49:10 +00:00
|
|
|
add_log_tag(${UTIL_LIB})
|
|
|
|
add_log_tag(${PLATFORM_LIB})
|
|
|
|
add_log_tag(${STATIC_LIB})
|