lokinet/CMakeLists.txt

628 lines
18 KiB
CMake
Raw Normal View History

2018-11-06 14:27:25 +00:00
# Lowest version - android ndk 3.6.0
cmake_minimum_required(VERSION 3.6.0)
2018-05-16 13:56:51 +00:00
2018-08-12 17:22:29 +00:00
set(PROJECT_NAME lokinet)
2018-10-23 11:29:37 +00:00
project(${PROJECT_NAME} C CXX ASM)
2018-06-14 14:04:42 +00:00
option(USE_LIBABYSS "enable libabyss" )
option(USE_AVX2 "enable avx2 code" )
2018-06-15 13:42:49 +00:00
2018-11-18 14:43:32 +00:00
# Require C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2018-06-15 13:42:49 +00:00
# turns off those annoying warnings for
# target-specific crypto code paths not
# applicable to the host's FPU -rick
add_compile_options(-Wall -Wextra -Werror -Wno-unknown-pragmas)
2018-11-09 12:25:14 +00:00
# vla are evil
add_compile_options(-Wvla)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
2018-11-02 07:56:42 +00:00
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
2018-09-07 20:54:50 +00:00
2018-09-25 08:31:29 +00:00
if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
2018-11-08 01:03:05 +00:00
# dynamic linking does this all the time
2018-11-09 12:49:29 +00:00
if(CMAKE_HOST_WIN32)
2018-11-08 01:03:05 +00:00
add_compile_options(-Wno-cast-function-type)
2018-11-09 12:49:29 +00:00
endif()
2018-09-25 08:31:29 +00:00
if (USING_CLANG)
add_compile_options(-Wno-unused-command-line-argument -Wno-c++11-narrowing)
2018-09-25 08:31:29 +00:00
# because clang is insane enough to inline whole sections of the C++ library!
# May have been fixed in llvm-7.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition --rtlib=libgcc")
endif(USING_CLANG)
endif()
2018-08-09 13:55:51 +00:00
if(DEBIAN)
add_definitions(-DDEBIAN)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
2018-07-16 23:26:58 +00:00
2018-06-15 13:42:49 +00:00
if(STATIC_LINK)
2018-11-08 12:31:50 +00:00
add_compile_options(-static)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static" )
2018-06-15 13:42:49 +00:00
endif()
# This is now configurable in ini
#if(DNS_PORT)
# add_definitions(-DDNS_PORT=${DNS_PORT})
#endif()
2018-06-06 17:02:57 +00:00
if(SHADOW)
set(WITH_STATIC OFF)
else()
set(WITH_STATIC ON)
endif()
if(TESTNET)
add_definitions(-DTESTNET=1)
endif()
2018-11-02 07:56:42 +00:00
set(OPTIMIZE_FLAGS -O3)
set(DEBUG_FLAGS -O0 -g3)
2018-06-15 13:42:49 +00:00
if(ASAN)
2018-06-06 12:46:26 +00:00
set(DEBUG_FLAGS "${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(OPTIMIZE_FLAGS "-O0")
endif(ASAN)
2018-06-06 12:59:15 +00:00
if(SHADOW)
2018-06-06 17:02:57 +00:00
if("${SHADOW_ROOT}" STREQUAL "")
set(SHADOW_ROOT "$ENV{HOME}/.shadow")
endif("${SHADOW_ROOT}" STREQUAL "")
if(EXISTS "${SHADOW_ROOT}")
message(STATUS "SHADOW_ROOT = ${SHADOW_ROOT}")
else()
message(FATAL_ERROR "SHADOW_ROOT path does not exist: '${SHADOW_ROOT}'")
endif()
set(CMAKE_MODULE_PATH "${SHADOW_ROOT}/share/cmake/Modules")
include_directories(${CMAKE_MODULE_PATH})
include(ShadowTools)
add_compile_options( -fno-inline -fno-strict-aliasing )
2018-06-06 12:59:15 +00:00
add_definitions(-DTESTNET=true)
2018-06-06 17:02:57 +00:00
add_definitions(-DSHADOW_TESTNET)
include_directories(${SHADOW_ROOT}/include)
2018-06-06 12:59:15 +00:00
endif()
2018-09-20 19:24:13 +00:00
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(OPTIMIZE_FLAGS "")
add_compile_options( ${DEBUG_FLAGS} )
2018-09-20 19:24:13 +00:00
endif()
2018-11-06 14:06:09 +00:00
if(NOT ANDROID)
2018-11-08 12:31:50 +00:00
if (USE_AVX2)
2018-11-02 07:51:33 +00:00
set(CRYPTO_FLAGS -march=native)
set(CMAKE_ASM_FLAGS "-march=native ${CMAKE_ASM_FLAGS} $ENV{ASFLAGS}")
2018-11-02 07:56:42 +00:00
else()
2018-11-08 12:31:50 +00:00
if(WIN32)
set(CRYPTO_FLAGS -march=core2)
set(CMAKE_ASM_FLAGS "-march=core2 ${CMAKE_ASM_FLAGS} $ENV{ASFLAGS}")
2018-11-08 12:31:50 +00:00
endif()
endif()
endif()
if(RPI)
add_definitions(-DRPI)
set(WITH_STATIC ON)
2018-11-06 14:06:09 +00:00
endif()
2018-10-23 11:29:37 +00:00
2018-11-02 07:51:33 +00:00
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
2018-06-15 13:42:49 +00:00
2018-06-06 17:02:57 +00:00
if(SHADOW)
2018-11-02 07:51:33 +00:00
add_compile_options(-fPIC)
2018-06-06 17:02:57 +00:00
endif()
if(NOT GIT_VERSION)
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION)
add_definitions(-DGIT_REV="${GIT_VERSION}")
endif()
if(RELEASE_MOTTO)
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
endif()
2018-08-12 17:22:29 +00:00
set(EXE lokinet)
2018-07-09 04:09:54 +00:00
set(EXE_SRC daemon/main.cpp)
2018-05-16 13:56:51 +00:00
2018-09-20 19:24:13 +00:00
# HeapAlloc(2) on Windows was significantly revamped in 2009
# but the old algorithm isn't too bad either
# this is _the_ system allocator on BSD UNIX
# openbsd replaced it with a secure/randomised malloc not too
# long ago
2018-09-06 11:46:19 +00:00
if(JEMALLOC)
set(MALLOC_LIB jemalloc)
endif()
if (WIN32)
set(FS_LIB stdc++fs)
endif(WIN32)
# FS_LIB should resolve to nothing on all other platforms
# it is only required on win32 -rick
set(LIBS Threads::Threads ${MALLOC_LIB} ${FS_LIB})
2018-11-06 14:06:09 +00:00
if(ANDROID)
set(LIBS ${LIBS} log)
endif()
set(LIB lokinet)
2018-05-27 18:03:10 +00:00
set(SHARED_LIB ${LIB})
set(STATIC_LIB ${LIB}-static)
2018-10-23 11:45:14 +00:00
set(CRYPTOGRAPHY_LIB ${LIB}-cryptography)
set(PLATFORM_LIB ${LIB}-platform)
set(ANDROID_LIB ${LIB}android)
2018-05-16 13:56:51 +00:00
set(TT_ROOT vendor/libtuntap-master)
add_definitions(-D${CMAKE_SYSTEM_NAME})
if (UNIX)
add_definitions(-DUNIX)
add_definitions(-DPOSIX)
endif()
if(UNIX)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
2018-08-05 23:39:29 +00:00
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
# TODO: _actually_ port to solaris/illumos (it's fairly complete...except for TUN) -rick
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
else()
message(FATAL_ERROR "Your operating system is not supported yet")
endif()
elseif(WIN32)
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-windows.c)
2018-11-09 14:48:43 +00:00
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x600 -D_WIN32_WINNT=0x600)
else()
message(FATAL_ERROR "What operating system _are_ you building on/for?")
endif(UNIX)
2018-08-15 15:36:34 +00:00
set(LIBTUNTAP_SRC_BASE
2018-08-20 19:12:12 +00:00
${TT_ROOT}/tuntap.cpp
${TT_ROOT}/tuntap_log.cpp
${LIBTUNTAP_IMPL})
2018-09-24 10:25:29 +00:00
if (UNIX)
set(LIBTUNTAP_SRC
${TT_ROOT}/tuntap-unix.c
2018-08-15 15:36:34 +00:00
${LIBTUNTAP_SRC_BASE})
else()
set(LIBTUNTAP_SRC ${LIBTUNTAP_SRC_BASE})
endif(UNIX)
2018-07-24 02:34:12 +00:00
if(ANDROID)
2018-07-24 03:17:52 +00:00
add_definitions(-DANDROID)
2018-07-24 02:34:12 +00:00
set(ANDROID_PLATFORM_SRC llarp/android/ifaddrs.c)
endif()
2018-08-26 12:51:22 +00:00
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(ISOLATE_PROC_SRC llarp/linux/netns.cpp)
endif()
if(NOT WIN32)
2018-10-23 11:45:14 +00:00
set(CXX_COMPAT_SRC
vendor/cppbackport-master/lib/fs/rename.cpp
vendor/cppbackport-master/lib/fs/filestatus.cpp
vendor/cppbackport-master/lib/fs/filetype.cpp
vendor/cppbackport-master/lib/fs/cleanpath.cpp
vendor/cppbackport-master/lib/fs/perms.cpp
vendor/cppbackport-master/lib/fs/equivalent.cpp
vendor/cppbackport-master/lib/fs/current_path.cpp
vendor/cppbackport-master/lib/fs/basename.cpp
vendor/cppbackport-master/lib/fs/tempdir.cpp
vendor/cppbackport-master/lib/fs/create_directory.cpp
vendor/cppbackport-master/lib/fs/path.cpp
vendor/cppbackport-master/lib/fs/remove.cpp
vendor/cppbackport-master/lib/fs/diriter.cpp
vendor/cppbackport-master/lib/fs/copyfile.cpp
vendor/cppbackport-master/lib/fs/absolute.cpp
vendor/cppbackport-master/lib/fs/direntry.cpp
)
2018-10-23 13:18:48 +00:00
include_directories(vendor/cppbackport-master/lib)
endif(NOT WIN32)
2018-08-26 12:51:22 +00:00
set(LIB_PLATFORM_SRC
# string stuff
llarp/str.cpp
# for outpug
llarp/logger.cpp
2018-07-16 12:47:13 +00:00
# needed for threading
llarp/logic.cpp
# for zero (for net.hpp stuff for llarp::addr stuff)
llarp/mem.cpp
# for networking
llarp/ev.cpp
2018-11-03 13:10:21 +00:00
llarp/net.cpp
llarp/net_addr.cpp
llarp/net_inaddr.cpp
2018-07-16 12:47:13 +00:00
# for timer
llarp/time.cpp
# for logic
llarp/timer.cpp
# for threading
llarp/queue_manager.cpp
llarp/thread_pool.cpp
llarp/threadpool.cpp
2018-07-24 02:34:12 +00:00
# for android shim
${ANDROID_PLATFORM_SRC}
2018-08-26 12:51:22 +00:00
# process isolation implementation
${ISOLATE_PROC_SRC}
# tun
2018-08-15 15:36:34 +00:00
${LIBTUNTAP_SRC}
2018-10-01 02:26:47 +00:00
# win32 inline code
llarp/win32_inet.c
llarp/win32_intrnl.c
2018-10-23 11:45:14 +00:00
# c++17 compat code
${CXX_COMPAT_SRC}
)
2018-08-13 15:44:14 +00:00
set(NTRU_AVX_SRC
crypto/libntrup/src/avx/randomsmall.c
crypto/libntrup/src/avx/weight.c
crypto/libntrup/src/avx/swap.c
crypto/libntrup/src/avx/rq_round3.c
crypto/libntrup/src/avx/rq_recip3.c
crypto/libntrup/src/avx/small.c
crypto/libntrup/src/avx/randomweightw.c
crypto/libntrup/src/avx/dec.c
crypto/libntrup/src/avx/r3_recip.c
crypto/libntrup/src/avx/keypair.c
crypto/libntrup/src/avx/rq_rounded.c
crypto/libntrup/src/avx/mult.c
crypto/libntrup/src/avx/enc.c
crypto/libntrup/src/avx/int32_sort.c
crypto/libntrup/src/avx/rq.c
crypto/libntrup/src/avx/rq_mod3.c
)
set(NTRU_REF_SRC
crypto/libntrup/src/ref/randomsmall.c
crypto/libntrup/src/ref/swap.c
crypto/libntrup/src/ref/rq_round3.c
crypto/libntrup/src/ref/rq_recip3.c
crypto/libntrup/src/ref/small.c
crypto/libntrup/src/ref/rq_mult.c
crypto/libntrup/src/ref/randomweightw.c
crypto/libntrup/src/ref/random32.c
crypto/libntrup/src/ref/dec.c
crypto/libntrup/src/ref/r3_mult.c
crypto/libntrup/src/ref/r3_recip.c
crypto/libntrup/src/ref/keypair.c
crypto/libntrup/src/ref/rq_rounded.c
crypto/libntrup/src/ref/enc.c
crypto/libntrup/src/ref/int32_sort.c
crypto/libntrup/src/ref/rq.c
)
2018-07-24 02:34:12 +00:00
2018-10-23 11:29:37 +00:00
include_directories(crypto/include)
2018-07-24 02:34:12 +00:00
2018-08-13 15:44:14 +00:00
set(NTRU_SRC
${NTRU_AVX_SRC}
${NTRU_REF_SRC}
2018-08-14 12:44:34 +00:00
crypto/libntrup/src/ntru.cpp
2018-10-23 11:29:37 +00:00
)
set(SHA512_SRC
crypto/sha512/sha512.c)
set(CHACHA_SRC
crypto/chacha20/ref/chacha20_ref.c
crypto/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
crypto/chacha20/dolbeau/chacha20_dolbeau-avx2.c
crypto/chacha20/stream_chacha20.c
crypto/salsa20/ref/salsa20_ref.c
2018-10-23 13:36:20 +00:00
crypto/salsa20/core_salsa_ref.c
2018-10-23 11:29:37 +00:00
crypto/salsa20/stream_salsa20.c
crypto/salsa20/xmm6/salsa20_xmm6-asm.S
crypto/salsa20/xmm6/salsa20_xmm6.c
crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c
crypto/salsa20/xmm6int/salsa20_xmm6int-sse2.c
crypto/xchacha20/hchacha.c
crypto/xchacha20/stream_xchacha20.c)
2018-10-23 11:29:37 +00:00
set(CSRNG_SRC
crypto/csrng/randombytes_salsa20_random.c
crypto/csrng/randombytes.c)
set(CRYPTO_MEM_SRC
crypto/secmem/secmem.c)
set(BLAKE2B_SRC
crypto/blake2b/blake2b-compress-avx2.c
crypto/blake2b/blake2b-compress-ref.c
crypto/blake2b/blake2b-compress-sse41.c
crypto/blake2b/blake2b-compress-ssse3.c
crypto/blake2b/blake2b-ref.c
crypto/blake2b/generichash_blake2b.c)
set(X25519_SRC
2018-10-23 11:29:37 +00:00
crypto/curve25519/crypto_scalarmult.c
crypto/curve25519/ref10/x25519_ref10.c
crypto/curve25519/ref10/ed25519_ref10.c
crypto/curve25519/sandy2x/fe51_invert.c
crypto/curve25519/sandy2x/ladder_base.S
crypto/curve25519/sandy2x/curve25519_sandy2x.c
crypto/curve25519/sandy2x/consts.S
crypto/curve25519/sandy2x/fe51_nsquare.S
crypto/curve25519/sandy2x/fe51_mul.S
crypto/curve25519/sandy2x/fe51_pack.S
crypto/curve25519/sandy2x/fe_frombytes_sandy2x.c
crypto/curve25519/sandy2x/sandy2x.S
crypto/curve25519/sandy2x/ladder.S
crypto/curve25519/scalarmult_curve25519.c
crypto/ed25519/crypto_box.c
crypto/ed25519/crypto_sign.c
crypto/ed25519/ref10/open.c
crypto/ed25519/ref10/obsolete.c
crypto/ed25519/ref10/keypair.c
crypto/ed25519/ref10/sign.c
crypto/ed25519/sign_ed25519.c)
set(CRYPTOGRAPHY_SRC
crypto/libsodium/init.c
crypto/libsodium/runtime.c
crypto/verify/crypto_verify.c
${CRYPTO_MEM_SRC}
${CSRNG_SRC}
${BLAKE2B_SRC}
${CHACHA_SRC}
${ED25519_SRC}
${X25519_SRC}
2018-10-23 11:45:14 +00:00
${SHA512_SRC}
${NTRU_SRC})
2018-10-23 11:29:37 +00:00
add_library(${CRYPTOGRAPHY_LIB} STATIC ${CRYPTOGRAPHY_SRC})
2018-10-23 11:29:37 +00:00
2018-08-13 15:44:14 +00:00
set(UTP_SRC
libutp/utp_callbacks.cpp
libutp/utp_utils.cpp
libutp/utp_internal.cpp
libutp/utp_api.cpp
libutp/utp_packedsockaddr.cpp
libutp/utp_hash.cpp
)
if(WIN32)
set(UTP_SRC ${UTP_SRC} libutp/libutp_inet_ntop.cpp)
endif()
set(LIB_SRC
${UTP_SRC}
llarp/address_info.cpp
2018-07-09 04:09:54 +00:00
llarp/bencode.cpp
2018-05-16 13:56:51 +00:00
llarp/buffer.cpp
llarp/config.cpp
llarp/context.cpp
2018-05-16 13:56:51 +00:00
llarp/crypto_libsodium.cpp
2018-06-01 14:08:54 +00:00
llarp/dht.cpp
2018-07-27 04:07:22 +00:00
llarp/dns.cpp
2018-07-16 12:47:13 +00:00
llarp/dnsc.cpp
llarp/dnsd.cpp
llarp/dns_iptracker.cpp
llarp/dns_dotlokilookup.cpp
2018-06-21 11:28:22 +00:00
llarp/encode.cpp
2018-06-10 14:05:48 +00:00
llarp/encrypted_frame.cpp
llarp/exit_info.cpp
2018-07-09 04:09:54 +00:00
llarp/exit_route.cpp
llarp/ip.cpp
2018-05-16 13:56:51 +00:00
llarp/link_intro.cpp
llarp/link_message.cpp
2018-05-16 13:56:51 +00:00
llarp/nodedb.cpp
2018-06-10 14:05:48 +00:00
llarp/path.cpp
2018-06-18 22:03:50 +00:00
llarp/pathbuilder.cpp
llarp/pathset.cpp
llarp/profiling.cpp
2018-06-18 22:03:50 +00:00
llarp/proofofwork.cpp
2018-06-01 14:08:54 +00:00
llarp/relay_commit.cpp
2018-06-08 13:12:17 +00:00
llarp/relay_up_down.cpp
llarp/router_contact.cpp
2018-05-16 13:56:51 +00:00
llarp/router.cpp
2018-10-19 11:41:36 +00:00
llarp/rpc.cpp
llarp/service.cpp
2018-06-22 00:25:30 +00:00
llarp/transit_hop.cpp
2018-06-06 17:02:57 +00:00
llarp/testnet.c
llarp/dht/context.cpp
llarp/dht/decode.cpp
llarp/dht/dht_immediate.cpp
2018-07-12 18:21:44 +00:00
llarp/dht/find_intro.cpp
llarp/dht/find_router.cpp
llarp/dht/got_intro.cpp
llarp/dht/got_router.cpp
llarp/dht/publish_intro.cpp
llarp/exit/close_exit.cpp
llarp/exit/context.cpp
llarp/exit/endpoint.cpp
llarp/exit/grant_exit.cpp
llarp/exit/update_exit.cpp
llarp/exit/obtain_exit.cpp
llarp/exit/policy.cpp
llarp/exit/reject_exit.cpp
llarp/exit/session.cpp
llarp/exit/transfer_traffic.cpp
llarp/handlers/exit.cpp
llarp/handlers/tun.cpp
llarp/link/curvecp.cpp
llarp/link/server.cpp
llarp/link/utp.cpp
llarp/routing/dht_message.cpp
llarp/routing/message_parser.cpp
llarp/routing/path_confirm.cpp
2018-06-26 16:23:43 +00:00
llarp/routing/path_latency.cpp
llarp/routing/path_transfer.cpp
2018-07-16 03:32:13 +00:00
llarp/service/address.cpp
llarp/service/context.cpp
llarp/service/endpoint.cpp
2018-07-18 03:10:21 +00:00
llarp/service/lookup.cpp
2018-07-19 04:58:39 +00:00
llarp/service/protocol.cpp
2018-07-17 07:30:03 +00:00
llarp/service/tag.cpp
2018-07-16 03:32:13 +00:00
llarp/service/info.cpp
2018-08-15 15:36:34 +00:00
2018-05-16 13:56:51 +00:00
)
2018-09-03 11:41:04 +00:00
set(RC_SRC
daemon/rcutil.cpp
)
2018-07-16 12:47:13 +00:00
set(DNS_SRC
llarp/dns.cpp
2018-07-16 12:47:13 +00:00
llarp/dnsc.cpp
llarp/dnsd.cpp
llarp/dns_iptracker.cpp
llarp/dns_dotlokilookup.cpp
2018-07-16 12:47:13 +00:00
llarp/net.cpp
daemon/dns.cpp
)
set(TEST_SRC
2018-06-14 14:04:42 +00:00
test/main.cpp
2018-07-06 16:08:30 +00:00
test/base32_unittest.cpp
2018-06-14 14:04:42 +00:00
test/dht_unittest.cpp
2018-06-20 12:34:48 +00:00
test/encrypted_frame_unittest.cpp
2018-07-06 16:08:30 +00:00
test/hiddenservice_unittest.cpp
test/traffic_transfer_unittest.cpp
test/obtain_exit_unittest.cpp
test/pq_unittest.cpp
2018-10-16 15:27:52 +00:00
test/net_unittest.cpp
2018-10-11 11:51:13 +00:00
test/test_dns_unit.cpp
test/test_dnsc_unit.cpp
test/test_dnsd_unit.cpp
2018-11-17 21:07:04 +00:00
test/test_llarp_queue.cpp
test/test_llarp_queue_manager.cpp
test/test_llarp_thread_pool.cpp
2018-06-14 14:04:42 +00:00
)
2018-07-30 22:35:54 +00:00
2018-06-14 14:04:42 +00:00
set(TEST_EXE testAll)
set(GTEST_DIR test/gtest)
2018-06-23 00:00:44 +00:00
set(CLIENT_EXE llarpc)
set(CLIENT_SRC
2018-06-23 00:00:44 +00:00
client/main.cpp
)
2018-10-25 17:19:53 +00:00
include_directories(include)
2018-06-15 13:42:49 +00:00
# TODO: exclude this from includes and expose stuff properly for rcutil
2018-06-14 19:28:27 +00:00
include_directories(llarp)
#include_directories(include)
#include_directories(vendor/cppbackport-master/lib)
#include_directories(${sodium_INCLUDE_DIR})
2018-06-06 12:59:15 +00:00
2018-09-03 11:41:04 +00:00
set(RC_EXE rcutil)
set(DNS_EXE dns)
set(ALL_SRC ${CLIENT_SRC} ${RC_SRC} ${EXE_SRC} ${DNS_SRC} ${LIB_PLATFORM_SRC} ${LIB_SRC} ${TEST_SRC})
2018-10-19 11:41:36 +00:00
if(USE_LIBABYSS)
2018-11-01 12:47:14 +00:00
add_definitions(-DUSE_ABYSS=1)
set(ABYSS libabyss)
set(ABYSS_LIB abyss)
set(ABYSS_EXE ${ABYSS_LIB}-main)
include_directories(${ABYSS}/include)
set(ABYSS_SRC
${ABYSS}/src/http.cpp
${ABYSS}/src/client.cpp
${ABYSS}/src/server.cpp
${ABYSS}/src/json.cpp)
add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC})
set(ALL_SRC ${ALL_SRC} ${ABYSS_SRC} ${ABYSS}/main.cpp)
2018-11-01 12:47:14 +00:00
add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp)
if (NOT WIN32)
2018-11-01 12:47:14 +00:00
target_link_libraries(${ABYSS_EXE} ${PLATFORM_LIB})
else()
target_link_libraries(${ABYSS_EXE} ${PLATFORM_LIB} ws2_32 iphlpapi)
endif(NOT WIN32)
2018-11-02 17:08:01 +00:00
set(TEST_SRC ${TEST_SRC} test/jsonrpc_unittest.cpp)
2018-11-02 17:45:39 +00:00
# for freebsd
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
include_directories(/usr/local/include)
endif()
endif()
foreach(F ${ALL_SRC})
set_source_files_properties(${F} PROPERTIES COMPILE_FLAGS -DLOG_TAG=\\\"${F}\\\")
endforeach(F)
2018-09-03 11:41:04 +00:00
2018-06-06 12:59:15 +00:00
if(SHADOW)
2018-10-23 11:45:14 +00:00
add_shadow_plugin(shadow-plugin-${SHARED_LIB} ${EXE_SRC} ${LIB_SRC} ${LIB_PLATFORM_SRC} ${CPP_BACKPORT_SRC} ${ABYSS_SRC} ${CRYPTOGRAPHY_SRC})
target_link_libraries(shadow-plugin-${SHARED_LIB} ${LIBS})
install(TARGETS shadow-plugin-${SHARED_LIB} DESTINATION plugins)
2018-06-06 17:02:57 +00:00
else()
2018-09-25 08:31:29 +00:00
add_executable(${RC_EXE} ${RC_SRC})
add_executable(${EXE} ${EXE_SRC})
add_executable(${CLIENT_EXE} ${CLIENT_SRC})
2018-09-25 08:31:29 +00:00
add_executable(${DNS_EXE} ${DNS_SRC})
add_subdirectory(${GTEST_DIR})
include_directories(${GTEST_DIR}/include ${GTEST_DIR})
add_executable(${TEST_EXE} ${TEST_SRC})
2018-10-19 11:41:36 +00:00
if(WITH_STATIC)
2018-06-06 17:02:57 +00:00
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
2018-09-03 11:41:04 +00:00
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
if(USE_LIBABYSS)
target_link_libraries(${PLATFORM_LIB} Threads::Threads ${ABYSS_LIB})
else()
target_link_libraries(${PLATFORM_LIB} Threads::Threads)
endif()
2018-08-26 12:51:22 +00:00
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
2018-11-08 12:31:50 +00:00
if(RPI)
target_link_libraries(${PLATFORM_LIB} -lrt)
else()
target_link_libraries(${PLATFORM_LIB} -lcap)
endif()
2018-08-26 12:51:22 +00:00
endif()
2018-10-23 11:45:14 +00:00
target_link_libraries(${STATIC_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${PLATFORM_LIB})
2018-06-06 17:02:57 +00:00
if(NOT WITH_SHARED)
2018-10-23 11:29:37 +00:00
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${PLATFORM_LIB})
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB})
2018-10-23 11:29:37 +00:00
if (WIN32)
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
2018-10-23 11:29:37 +00:00
endif(WIN32)
2018-09-20 19:24:13 +00:00
if (WIN32)
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} Threads::Threads ws2_32 iphlpapi)
2018-09-20 19:24:13 +00:00
endif(WIN32)
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} Threads::Threads)
endif(NOT WITH_SHARED)
endif(WITH_STATIC)
2018-08-05 23:48:59 +00:00
if(ANDROID)
2018-09-03 11:41:04 +00:00
add_library(${ANDROID_LIB} SHARED jni/lokinet_android.cpp)
2018-11-06 14:06:09 +00:00
target_link_libraries(${ANDROID_LIB} ${STATIC_LIB} ${LIBS})
2018-08-05 23:48:59 +00:00
endif()
2018-06-06 17:02:57 +00:00
if(WITH_SHARED)
2018-10-23 11:45:14 +00:00
add_library(${SHARED_LIB} SHARED ${LIB_SRC} ${LIB_PLATFORM_SRC} ${CRYPTOGRAPHY_SRC})
2018-09-20 19:24:13 +00:00
if (WIN32)
set(${LIBS} ${LIBS} ws2_32 iphlpapi)
2018-09-20 19:24:13 +00:00
endif(WIN32)
target_link_libraries(${SHARED_LIB} ${LIBS} Threads::Threads)
2018-07-27 04:07:22 +00:00
target_link_libraries(${EXE} ${SHARED_LIB})
2018-09-03 11:41:04 +00:00
target_link_libraries(${RC_EXE} ${SHARED_LIB})
target_link_libraries(${DNS_EXE} ${SHARED_LIB} Threads::Threads)
endif(WITH_SHARED)
endif(SHADOW)