2019-12-12 03:32:27 +01:00
|
|
|
include(Version)
|
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
set(LIB_UTIL_SRC
|
2019-07-02 23:28:28 +02:00
|
|
|
config/config.cpp
|
|
|
|
config/ini.cpp
|
2019-11-22 04:57:41 +01:00
|
|
|
config/key_manager.cpp
|
2019-08-12 13:20:57 +02:00
|
|
|
constants/limits.cpp
|
2019-12-12 03:32:27 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/bencode.cpp
|
|
|
|
util/buffer.cpp
|
|
|
|
util/encode.cpp
|
|
|
|
util/fs.cpp
|
2019-02-16 00:04:04 +01:00
|
|
|
util/json.cpp
|
2019-09-01 14:10:49 +02:00
|
|
|
util/logging/android_logger.cpp
|
|
|
|
util/logging/file_logger.cpp
|
|
|
|
util/logging/json_logger.cpp
|
|
|
|
util/logging/logger.cpp
|
2020-02-23 00:01:36 +01:00
|
|
|
util/logging/logger_internal.cpp
|
2019-09-01 14:10:49 +02:00
|
|
|
util/logging/loglevel.cpp
|
|
|
|
util/logging/ostream_logger.cpp
|
|
|
|
util/logging/syslog_logger.cpp
|
|
|
|
util/logging/win32_logger.cpp
|
2019-11-15 20:40:43 +01:00
|
|
|
util/lokinet_init.c
|
2019-02-09 17:16:00 +01:00
|
|
|
util/mem.cpp
|
2019-03-21 00:18:32 +01:00
|
|
|
util/printer.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/str.cpp
|
2019-09-01 15:26:16 +02:00
|
|
|
util/thread/logic.cpp
|
|
|
|
util/thread/queue_manager.cpp
|
|
|
|
util/thread/thread_pool.cpp
|
|
|
|
util/thread/threading.cpp
|
|
|
|
util/thread/threadpool.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/time.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
2019-12-12 03:32:27 +01:00
|
|
|
|
|
|
|
add_dependencies(${UTIL_LIB} genversion)
|
|
|
|
|
2019-12-26 19:06:02 +01:00
|
|
|
target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${CURL_INCLUDE_DIRS})
|
2019-07-24 17:25:40 +02:00
|
|
|
if(ANDROID)
|
|
|
|
set(LOG_LIB log)
|
|
|
|
endif()
|
|
|
|
|
2019-12-26 20:56:17 +01:00
|
|
|
target_link_libraries(${UTIL_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${LOG_LIB} ${CURL_LIBRARIES})
|
2020-02-13 18:42:16 +01:00
|
|
|
target_link_libraries(${UTIL_LIB} PUBLIC
|
|
|
|
nlohmann_json::nlohmann_json
|
2020-02-13 20:39:34 +01:00
|
|
|
ghc_filesystem
|
2020-02-19 22:58:01 +01:00
|
|
|
optional-lite
|
2020-02-23 00:01:36 +01:00
|
|
|
date::date
|
2020-02-13 18:42:16 +01:00
|
|
|
)
|
2019-04-11 17:17:58 +02:00
|
|
|
|
2019-02-11 01:02:20 +01:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set(ISOLATE_PROC_SRC linux/netns.cpp)
|
|
|
|
endif()
|
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
# for networking
|
|
|
|
ev/ev.cpp
|
2019-04-08 14:01:52 +02:00
|
|
|
ev/pipe.cpp
|
2019-10-04 20:10:58 +02:00
|
|
|
ev/vpnio.cpp
|
2019-12-12 00:18:09 +01:00
|
|
|
ev/ev_libuv.cpp
|
2019-06-11 18:44:05 +02:00
|
|
|
net/ip.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
net/net.cpp
|
|
|
|
net/net_addr.cpp
|
2019-06-11 18:44:05 +02:00
|
|
|
net/net_int.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
# for android shim
|
|
|
|
${ANDROID_PLATFORM_SRC}
|
|
|
|
# process isolation implementation
|
|
|
|
${ISOLATE_PROC_SRC}
|
|
|
|
# tun
|
|
|
|
${LIBTUNTAP_SRC}
|
|
|
|
${EV_SRC}
|
|
|
|
)
|
|
|
|
|
2019-03-05 17:21:56 +01:00
|
|
|
if (WIN32)
|
2019-06-12 15:20:00 +02:00
|
|
|
set(LIB_PLATFORM_SRC
|
2019-12-11 22:31:49 +01:00
|
|
|
ev/ev_win32.cpp
|
2019-06-12 15:20:00 +02:00
|
|
|
${LIB_PLATFORM_SRC}
|
|
|
|
win32/win32_inet.c
|
2019-12-11 23:02:01 +01:00
|
|
|
win32/win32_intrnl.c)
|
2019-03-05 17:21:56 +01:00
|
|
|
endif(WIN32)
|
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
|
2019-09-12 20:19:25 +02:00
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${UTIL_LIB} Threads::Threads ${LIBS})
|
2019-02-09 17:16:00 +01:00
|
|
|
|
2019-02-11 01:02:20 +01:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
if(NON_PC_TARGET)
|
|
|
|
add_import_library(rt)
|
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC rt)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
2019-02-14 01:22:21 +01:00
|
|
|
target_link_libraries(${PLATFORM_LIB} PUBLIC iphlpapi)
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
2019-02-09 17:16:00 +01:00
|
|
|
set(DNSLIB_SRC
|
|
|
|
dns/message.cpp
|
|
|
|
dns/name.cpp
|
|
|
|
dns/question.cpp
|
|
|
|
dns/rr.cpp
|
|
|
|
dns/serialize.cpp
|
|
|
|
dns/server.cpp
|
|
|
|
)
|
|
|
|
|
2020-01-21 18:31:48 +01:00
|
|
|
set(CONSENSUS_SRC
|
|
|
|
consensus/table.cpp
|
|
|
|
)
|
|
|
|
|
2019-02-09 17:16:00 +01:00
|
|
|
set(LIB_SRC
|
2020-01-21 18:31:48 +01:00
|
|
|
${CONSENSUS_SRC}
|
2019-02-09 17:16:00 +01:00
|
|
|
${DNSLIB_SRC}
|
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
|
|
|
|
dht/publishservicejob.cpp
|
|
|
|
dht/recursiverouterlookup.cpp
|
|
|
|
dht/serviceaddresslookup.cpp
|
|
|
|
dht/taglookup.cpp
|
|
|
|
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-04-22 14:25:25 +02:00
|
|
|
hook/shell.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-08-07 18:33:29 +02:00
|
|
|
link/factory.cpp
|
2019-06-26 23:39:29 +02:00
|
|
|
link/link_manager.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
|
|
|
|
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
|
|
|
|
pow.cpp
|
|
|
|
profiling.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
|
|
|
|
router_contact.cpp
|
|
|
|
router_id.cpp
|
2020-01-25 17:28:07 +01:00
|
|
|
router_version.cpp
|
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
|
2019-02-09 17:16:00 +01:00
|
|
|
rpc/rpc.cpp
|
|
|
|
service/address.cpp
|
2019-04-21 19:41:58 +02:00
|
|
|
service/async_key_exchange.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
service/config.cpp
|
|
|
|
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
|
2019-02-09 17:16:00 +01:00
|
|
|
service/lookup.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
|
2019-04-21 19:41:58 +02:00
|
|
|
service/tag_lookup_job.cpp
|
2019-04-22 20:35:19 +02:00
|
|
|
service/tag.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
)
|
2019-02-11 01:02:20 +01:00
|
|
|
if(TESTNET)
|
2019-03-11 14:01:53 +01:00
|
|
|
set(LIB_SRC ${LIB_SRC} testnet.c)
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
|
|
|
|
2019-03-11 14:01:53 +01:00
|
|
|
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
2019-12-26 19:06:02 +01:00
|
|
|
target_include_directories(${STATIC_LIB} PUBLIC ${CURL_INCLUDE_DIRS})
|
2019-12-26 20:56:17 +01:00
|
|
|
target_link_libraries(${STATIC_LIB} PUBLIC cxxopts ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB})
|
2019-03-11 14:01:53 +01:00
|
|
|
|
2019-06-10 18:26:19 +02:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2019-06-10 18:27:36 +02:00
|
|
|
target_include_directories(${PLATFORM_LIB} SYSTEM PUBLIC /usr/local/include)
|
2019-06-10 18:26:19 +02:00
|
|
|
target_include_directories(${STATIC_LIB} SYSTEM PUBLIC /usr/local/include)
|
|
|
|
endif()
|
|
|
|
|
2019-02-11 01:02:20 +01:00
|
|
|
if(WITH_SHARED)
|
|
|
|
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
|
2019-03-11 14:01:53 +01:00
|
|
|
set(LIBS ${LIBS} Threads::Threads)
|
|
|
|
target_link_libraries(${SHARED_LIB} PUBLIC ${ABYSS_LIB} ${CRYPTOGRAPHY_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ${LIBS})
|
2019-02-11 01:02:20 +01:00
|
|
|
if (WIN32)
|
2019-12-12 20:58:46 +01:00
|
|
|
target_link_libraries(${SHARED_LIB} PUBLIC ws2_32 iphlpapi)
|
2019-02-11 01:02:20 +01:00
|
|
|
else()
|
|
|
|
install(TARGETS ${SHARED_LIB} LIBRARY DESTINATION lib)
|
|
|
|
endif()
|
2019-02-15 21:49:10 +01:00
|
|
|
add_log_tag(${SHARED_LIB})
|
2019-02-11 01:02:20 +01:00
|
|
|
endif()
|
2019-02-15 21:49:10 +01:00
|
|
|
|
2019-04-25 01:27:31 +02:00
|
|
|
if (WARNINGS_AS_ERRORS)
|
2020-02-07 05:12:42 +01:00
|
|
|
set(WARN_FLAGS -Wall -Wextra -Werror)
|
2019-04-25 01:27:31 +02: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 21:49:10 +01:00
|
|
|
add_log_tag(${UTIL_LIB})
|
|
|
|
add_log_tag(${PLATFORM_LIB})
|
|
|
|
add_log_tag(${STATIC_LIB})
|