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
|
|
|
|
2018-11-06 22:48:17 +00:00
|
|
|
option(USE_LIBABYSS "enable libabyss" )
|
|
|
|
option(USE_AVX2 "enable avx2 code" )
|
2019-01-19 03:08:32 +00:00
|
|
|
option(USE_NETNS "enable networking namespace support. Linux only" )
|
2018-12-12 04:51:22 +00:00
|
|
|
option(AMD_RYZEN_HACK "hack for AMD Ryzen FPU bug (support FMA3 and FMA4 in FPU, but does not show in CPUID)" )
|
|
|
|
option(STATIC_LINK "emit fully linked binaries" )
|
2018-12-13 23:16:44 +00:00
|
|
|
option(NON_PC_TARGET "non-pc target build: iphone, andriod, embedded non-i386 SBC, etc" )
|
2018-12-12 04:51:22 +00:00
|
|
|
option(SHADOW "use shadow testing framework. linux only" )
|
|
|
|
option(ASAN "use address sanitiser, if your system has it" )
|
|
|
|
option(JEMALLOC "use jemalloc. Not required on BSD" )
|
|
|
|
option(DEBIAN "build for debian" )
|
|
|
|
option(TESTNET "testnet build" )
|
2019-01-08 22:30:21 +00:00
|
|
|
option(WITH_SHARED "build shared library")
|
2019-01-12 01:19:24 +00:00
|
|
|
option(WITH_COVERAGE "generate coverage data")
|
2018-06-15 13:42:49 +00:00
|
|
|
|
2018-12-03 14:39:30 +00:00
|
|
|
if(WIN32)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2018-12-25 02:38:43 +00:00
|
|
|
ENABLE_LANGUAGE(RC)
|
2018-12-03 14:39:30 +00:00
|
|
|
else()
|
2019-01-13 14:10:38 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(WIN32)
|
|
|
|
|
2018-10-28 18:57:04 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
2018-06-15 13:42:49 +00:00
|
|
|
|
2018-12-12 04:51:22 +00:00
|
|
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
2019-01-19 03:20:24 +00:00
|
|
|
message( FATAL_ERROR "shadow-framework is Linux only" )
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
2018-12-03 14:39:30 +00:00
|
|
|
|
2018-12-12 04:51:22 +00:00
|
|
|
if (STATIC_LINK AND SHADOW)
|
|
|
|
message(FATAL_ERROR "the shadow-framework build cannot be linked statically!")
|
|
|
|
endif(STATIC_LINK AND SHADOW)
|
2018-12-03 14:39:30 +00:00
|
|
|
|
2019-01-19 03:20:24 +00:00
|
|
|
if (WIN32 AND NOT STATIC_LINK)
|
|
|
|
message("Shared object builds are not yet supported for Windows, linking statically")
|
|
|
|
set(STATIC_LINK ON)
|
|
|
|
endif(WIN32 AND NOT STATIC_LINK)
|
|
|
|
|
2018-10-28 02:07:25 +00:00
|
|
|
# turns off those annoying warnings for
|
|
|
|
# target-specific crypto code paths not
|
|
|
|
# applicable to the host's FPU -rick
|
2018-11-19 08:36:39 +00:00
|
|
|
add_compile_options(-Wall -Wextra -Werror -Wno-unknown-pragmas -Wno-unknown-warning-option)
|
2018-11-09 12:25:14 +00:00
|
|
|
# vla are evil
|
|
|
|
add_compile_options(-Wvla)
|
2018-10-28 02:07:25 +00:00
|
|
|
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
|
|
|
|
2019-01-12 01:19:24 +00:00
|
|
|
if (WITH_COVERAGE)
|
|
|
|
if (USING_CLANG)
|
|
|
|
add_compile_options( -fprofile-instr-generate -fcoverage-mapping )
|
|
|
|
link_libraries( -fprofile-instr-generate )
|
|
|
|
else()
|
|
|
|
add_compile_options( --coverage -g0 )
|
|
|
|
link_libraries( --coverage )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-12-12 04:51:22 +00:00
|
|
|
# these vars are set by the cmake toolchain spec
|
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-12-12 04:51:22 +00:00
|
|
|
if (USING_CLANG) # windows only, also set by toolchain file
|
|
|
|
option(NO_LIBGCC "use compiler-rt instead" OFF)
|
|
|
|
add_compile_options(-Wno-unused-command-line-argument -Wno-c++11-narrowing)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
|
|
|
|
if (NO_LIBGCC)
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc_eh ${CMAKE_CXX_STANDARD_LIBRARIES}")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc_eh ${CMAKE_C_STANDARD_LIBRARIES}")
|
|
|
|
endif(NO_LIBGCC)
|
|
|
|
else()
|
|
|
|
# found it. this is GNU only
|
|
|
|
add_compile_options(-Wno-cast-function-type)
|
|
|
|
endif(USING_CLANG)
|
|
|
|
endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
2018-11-19 13:39:35 +00:00
|
|
|
|
2018-11-08 16:50:34 +00:00
|
|
|
if(WIN32)
|
2018-12-12 04:51:22 +00:00
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-cast-function-type>)
|
|
|
|
set(FS_LIB stdc++fs)
|
2018-11-08 16:50:34 +00:00
|
|
|
endif(WIN32)
|
|
|
|
|
2018-08-09 13:55:51 +00:00
|
|
|
if(DEBIAN)
|
|
|
|
add_definitions(-DDEBIAN)
|
2018-11-22 14:33:41 +00:00
|
|
|
else()
|
2018-12-12 04:51:22 +00:00
|
|
|
if(NOT ANDROID)
|
2018-12-13 23:16:44 +00:00
|
|
|
if(NOT NON_PC_TARGET)
|
|
|
|
if (NOT USE_AVX2)
|
2019-01-04 22:56:46 +00:00
|
|
|
set(CRYPTO_FLAGS -march=nocona -mtune=native -mfpmath=sse)
|
2018-12-12 04:51:22 +00:00
|
|
|
else()
|
|
|
|
set(CRYPTO_FLAGS -march=haswell -mtune=native -mfpmath=sse)
|
|
|
|
endif(NOT USE_AVX2)
|
2018-12-13 23:16:44 +00:00
|
|
|
endif(NOT NON_PC_TARGET)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(NOT ANDROID)
|
|
|
|
endif(DEBIAN)
|
|
|
|
|
|
|
|
# only needed if using AVX2
|
|
|
|
if(AMD_RYZEN_HACK AND USE_AVX2)
|
|
|
|
set(CRYPTO_FLAGS -march=native -mfpmath=sse -mavx -mavx2 -mfma)
|
|
|
|
endif(AMD_RYZEN_HACK AND USE_AVX2)
|
2018-08-09 13:55:51 +00:00
|
|
|
|
2019-01-08 22:30:21 +00:00
|
|
|
if(WITH_SHARED)
|
|
|
|
set(CRYPTO_FLAGS ${CRYPTO_FLAGS} -fPIC)
|
|
|
|
endif()
|
|
|
|
|
2018-10-28 18:57:04 +00:00
|
|
|
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)
|
2018-11-19 13:39:35 +00:00
|
|
|
if(USING_CLANG)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
|
|
|
else()
|
2018-11-19 14:43:46 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static -Wl,--whole-archive -Wl,--no-whole-archive")
|
2018-11-19 13:47:14 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(USING_CLANG)
|
|
|
|
endif(STATIC_LINK)
|
2018-06-15 13:42:49 +00:00
|
|
|
|
2018-11-19 13:39:35 +00:00
|
|
|
if(USE_NETNS)
|
|
|
|
add_definitions(-DNETNS=1)
|
|
|
|
else()
|
|
|
|
add_definitions(-DNETNS=0)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(USE_NETNS)
|
2018-06-06 17:02:57 +00:00
|
|
|
|
2018-10-21 14:19:49 +00:00
|
|
|
if(TESTNET)
|
|
|
|
add_definitions(-DTESTNET=1)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(TESTNET)
|
2018-10-21 14:19:49 +00:00
|
|
|
|
2018-11-13 15:16:14 +00:00
|
|
|
if(NOT DEBIAN)
|
2018-12-12 04:51:22 +00:00
|
|
|
set(OPTIMIZE_FLAGS -O3)
|
|
|
|
set(DEBUG_FLAGS -O0 -g3)
|
|
|
|
endif(NOT DEBIAN)
|
2018-06-15 13:42:49 +00:00
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
if(ASAN)
|
2019-01-03 21:54:26 +00:00
|
|
|
set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=thread -fno-omit-frame-pointer)
|
2018-06-01 17:47:37 +00:00
|
|
|
set(OPTIMIZE_FLAGS "-O0")
|
2018-05-27 16:45:04 +00:00
|
|
|
endif(ASAN)
|
2018-05-22 15:54:19 +00:00
|
|
|
|
2018-06-06 12:59:15 +00:00
|
|
|
if(SHADOW)
|
2018-12-12 04:51:22 +00:00
|
|
|
set(WITH_STATIC OFF)
|
|
|
|
add_compile_options(-fPIC)
|
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}'")
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(EXISTS "${SHADOW_ROOT}")
|
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${SHADOW_ROOT}/share/cmake/Modules")
|
|
|
|
include_directories(${CMAKE_MODULE_PATH})
|
|
|
|
include(ShadowTools)
|
2018-10-28 18:57:04 +00:00
|
|
|
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-12-12 04:51:22 +00:00
|
|
|
else()
|
|
|
|
set(WITH_STATIC ON)
|
|
|
|
endif(SHADOW)
|
2018-06-01 17:47:37 +00:00
|
|
|
|
2018-09-20 19:24:13 +00:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
|
|
|
|
set(OPTIMIZE_FLAGS "")
|
2018-10-28 18:57:04 +00:00
|
|
|
add_compile_options( ${DEBUG_FLAGS} )
|
2019-01-03 21:25:09 +00:00
|
|
|
link_libraries( ${DEBUG_FLAGS} )
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
|
2018-09-20 19:24:13 +00:00
|
|
|
|
2018-12-13 23:16:44 +00:00
|
|
|
# Add non-386 target-specific options here
|
|
|
|
if(NON_PC_TARGET)
|
2018-11-08 12:31:50 +00:00
|
|
|
add_definitions(-DRPI)
|
|
|
|
set(WITH_STATIC ON)
|
2018-12-13 23:16:44 +00:00
|
|
|
endif(NON_PC_TARGET)
|
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-05-28 13:49:44 +00:00
|
|
|
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}")
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(NOT GIT_VERSION)
|
2018-05-28 13:49:44 +00:00
|
|
|
|
|
|
|
if(RELEASE_MOTTO)
|
|
|
|
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
|
2019-01-19 03:08:32 +00:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DRELEASE_MOTTO=${RELEASE_MOTTO})
|
|
|
|
endif(WIN32)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(RELEASE_MOTTO)
|
2018-05-28 13:49:44 +00:00
|
|
|
|
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)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(JEMALLOC)
|
2018-09-19 12:22:34 +00:00
|
|
|
|
2019-01-05 13:45:05 +00:00
|
|
|
|
2018-10-28 02:07:25 +00:00
|
|
|
# FS_LIB should resolve to nothing on all other platforms
|
|
|
|
# it is only required on win32 -rick
|
2018-11-19 13:39:35 +00:00
|
|
|
set(LIBS ${LIBS} ${MALLOC_LIB} ${FS_LIB})
|
2018-05-22 18:41:38 +00:00
|
|
|
|
2018-11-06 14:06:09 +00:00
|
|
|
if(ANDROID)
|
|
|
|
set(LIBS ${LIBS} log)
|
2018-12-12 04:51:22 +00:00
|
|
|
add_definitions(-DANDROID)
|
|
|
|
set(ANDROID_PLATFORM_SRC llarp/android/ifaddrs.c)
|
|
|
|
endif(ANDROID)
|
2018-11-19 13:39:35 +00:00
|
|
|
|
2018-07-30 04:38:14 +00:00
|
|
|
set(LIB lokinet)
|
2019-01-08 22:30:21 +00:00
|
|
|
set(SHARED_LIB ${LIB}-shared)
|
2018-05-27 18:03:10 +00:00
|
|
|
set(STATIC_LIB ${LIB}-static)
|
2018-10-23 11:45:14 +00:00
|
|
|
set(CRYPTOGRAPHY_LIB ${LIB}-cryptography)
|
2019-01-10 19:41:51 +00:00
|
|
|
set(UTIL_LIB ${LIB}-util)
|
2018-10-23 11:45:14 +00:00
|
|
|
set(PLATFORM_LIB ${LIB}-platform)
|
|
|
|
set(ANDROID_LIB ${LIB}android)
|
2018-06-29 12:14:20 +00:00
|
|
|
set(TT_ROOT vendor/libtuntap-master)
|
|
|
|
add_definitions(-D${CMAKE_SYSTEM_NAME})
|
2018-07-30 04:38:14 +00:00
|
|
|
|
2018-12-12 04:51:22 +00:00
|
|
|
if(UNIX)
|
2018-09-04 12:41:25 +00:00
|
|
|
add_definitions(-DUNIX)
|
|
|
|
add_definitions(-DPOSIX)
|
2018-12-10 14:20:35 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2018-06-29 12:14:20 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
2018-08-05 23:39:29 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
2018-06-29 12:14:20 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
2018-06-29 12:14:20 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
2018-08-16 22:36:15 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
|
2018-06-29 12:14:20 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
2018-06-29 12:14:20 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
2018-10-28 02:07:25 +00:00
|
|
|
# TODO: _actually_ port to solaris/illumos (it's fairly complete...except for TUN) -rick
|
2018-08-16 22:36:15 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
2018-06-29 12:14:20 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Your operating system is not supported yet")
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2018-08-24 18:40:56 +00:00
|
|
|
elseif(WIN32)
|
2018-07-30 04:38:14 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-windows.c)
|
2019-01-11 01:19:36 +00:00
|
|
|
set(EV_SRC llarp/ev/ev_win32.cpp)
|
2018-11-19 07:55:19 +00:00
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500)
|
2018-07-30 04:38:14 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "What operating system _are_ you building on/for?")
|
2018-06-29 12:14:20 +00:00
|
|
|
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
|
2018-08-08 19:37:33 +00:00
|
|
|
${TT_ROOT}/tuntap_log.cpp
|
|
|
|
${LIBTUNTAP_IMPL})
|
2018-09-24 10:25:29 +00:00
|
|
|
|
|
|
|
if (UNIX)
|
2018-12-12 04:51:22 +00:00
|
|
|
set(LIBTUNTAP_SRC
|
|
|
|
${TT_ROOT}/tuntap-unix.c
|
|
|
|
${LIBTUNTAP_SRC_BASE})
|
2018-09-29 08:16:54 +00:00
|
|
|
else()
|
2018-12-12 04:51:22 +00:00
|
|
|
set(LIBTUNTAP_SRC ${LIBTUNTAP_SRC_BASE})
|
2018-09-29 08:16:54 +00:00
|
|
|
endif(UNIX)
|
2018-07-13 13:14:42 +00:00
|
|
|
|
2018-08-26 12:51:22 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set(ISOLATE_PROC_SRC llarp/linux/netns.cpp)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2018-08-26 12:51:22 +00:00
|
|
|
|
2018-10-23 15:50:22 +00:00
|
|
|
if(NOT WIN32)
|
2018-10-23 11:45:14 +00:00
|
|
|
set(CXX_COMPAT_SRC
|
2018-07-13 13:14:42 +00:00
|
|
|
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)
|
2018-10-23 15:50:22 +00:00
|
|
|
endif(NOT WIN32)
|
2018-08-26 12:51:22 +00:00
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
set(LIB_UTIL_SRC
|
|
|
|
llarp/constants/defaults.cpp
|
2019-01-13 22:39:10 +00:00
|
|
|
llarp/constants/link_layer.cpp
|
2019-01-10 19:41:51 +00:00
|
|
|
llarp/constants/proto.cpp
|
|
|
|
llarp/constants/version.cpp
|
|
|
|
llarp/util/aligned.cpp
|
|
|
|
llarp/util/bencode.cpp
|
|
|
|
llarp/util/bits.cpp
|
|
|
|
llarp/util/buffer.cpp
|
2019-01-13 22:39:10 +00:00
|
|
|
llarp/util/codel.cpp
|
2019-01-10 19:41:51 +00:00
|
|
|
llarp/util/common.cpp
|
|
|
|
llarp/util/encode.cpp
|
|
|
|
llarp/util/endian.cpp
|
|
|
|
llarp/util/fs.cpp
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/util/ini.cpp
|
2019-01-10 19:41:51 +00:00
|
|
|
llarp/util/logger.c
|
|
|
|
llarp/util/logger.cpp
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/util/logic.cpp
|
2019-01-10 19:41:51 +00:00
|
|
|
llarp/util/mem.cpp
|
|
|
|
llarp/util/queue_manager.cpp
|
|
|
|
llarp/util/queue.cpp
|
|
|
|
llarp/util/str.cpp
|
|
|
|
llarp/util/string_view.cpp
|
|
|
|
llarp/util/thread_pool.cpp
|
|
|
|
llarp/util/threading.cpp
|
|
|
|
llarp/util/threadpool.cpp
|
|
|
|
llarp/util/time.cpp
|
|
|
|
llarp/util/timer.cpp
|
|
|
|
llarp/util/types.cpp
|
|
|
|
)
|
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
# for networking
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/ev/ev.cpp
|
2019-01-11 01:42:02 +00:00
|
|
|
llarp/net/net.cpp
|
|
|
|
llarp/net/net_addr.cpp
|
|
|
|
llarp/net/net_inaddr.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}
|
2018-09-19 12:22:34 +00:00
|
|
|
# tun
|
2018-08-15 15:36:34 +00:00
|
|
|
${LIBTUNTAP_SRC}
|
2018-10-23 11:45:14 +00:00
|
|
|
# c++17 compat code
|
|
|
|
${CXX_COMPAT_SRC}
|
2018-11-19 07:55:19 +00:00
|
|
|
# win32 inline code
|
2019-01-11 01:22:21 +00:00
|
|
|
llarp/win32/win32_inet.c
|
|
|
|
llarp/win32/win32_intrnl.c
|
|
|
|
llarp/win32/win32_upoll.c
|
2018-07-13 13:14:42 +00:00
|
|
|
)
|
|
|
|
|
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-28 18:57:04 +00:00
|
|
|
|
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)
|
|
|
|
|
2018-10-28 18:57:04 +00:00
|
|
|
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
|
|
|
|
2018-10-23 17:40:27 +00:00
|
|
|
add_library(${CRYPTOGRAPHY_LIB} STATIC ${CRYPTOGRAPHY_SRC})
|
2018-10-23 11:29:37 +00:00
|
|
|
|
2018-09-04 12:41:25 +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)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(WIN32)
|
2018-09-04 12:41:25 +00:00
|
|
|
|
2018-12-03 22:22:59 +00:00
|
|
|
set(DNSLIB_SRC
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/dns/dotlokilookup.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dns/dns.cpp
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/dns/iptracker.cpp
|
2018-12-03 22:22:59 +00:00
|
|
|
llarp/dns/message.cpp
|
|
|
|
llarp/dns/name.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dns/query.cpp
|
2018-12-03 22:22:59 +00:00
|
|
|
llarp/dns/question.cpp
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/dns/rectypes.cpp
|
2018-12-03 22:22:59 +00:00
|
|
|
llarp/dns/rr.cpp
|
|
|
|
llarp/dns/serialize.cpp
|
|
|
|
llarp/dns/server.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dns/string.cpp
|
2018-12-03 22:22:59 +00:00
|
|
|
)
|
|
|
|
|
2018-09-04 12:41:25 +00:00
|
|
|
|
|
|
|
set(LIB_SRC
|
2018-12-03 22:22:59 +00:00
|
|
|
${DNSLIB_SRC}
|
2018-12-15 16:21:52 +00:00
|
|
|
${EV_SRC}
|
2018-09-04 12:41:25 +00:00
|
|
|
${UTP_SRC}
|
2018-05-16 13:56:51 +00:00
|
|
|
llarp/config.cpp
|
2018-05-27 17:44:01 +00:00
|
|
|
llarp/context.cpp
|
2019-01-13 16:30:07 +00:00
|
|
|
llarp/crypto/constants.cpp
|
2019-01-13 14:00:50 +00:00
|
|
|
llarp/crypto/crypto_libsodium.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/crypto/crypto.cpp
|
|
|
|
llarp/crypto/encrypted_frame.cpp
|
2019-01-13 22:39:10 +00:00
|
|
|
llarp/crypto/encrypted.cpp
|
2019-01-13 16:30:07 +00:00
|
|
|
llarp/crypto/types.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dht/bucket.cpp
|
2018-07-11 13:20:14 +00:00
|
|
|
llarp/dht/context.cpp
|
2019-01-13 22:39:10 +00:00
|
|
|
llarp/dht/dht.cpp
|
2019-01-22 01:14:02 +00:00
|
|
|
llarp/dht/explorenetworkjob.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dht/kademlia.cpp
|
|
|
|
llarp/dht/key.cpp
|
2019-01-22 01:14:02 +00:00
|
|
|
llarp/dht/localtaglookup.cpp
|
|
|
|
llarp/dht/localrouterlookup.cpp
|
|
|
|
llarp/dht/localserviceaddresslookup.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dht/message.cpp
|
|
|
|
llarp/dht/messages/findintro.cpp
|
|
|
|
llarp/dht/messages/findrouter.cpp
|
|
|
|
llarp/dht/messages/gotintro.cpp
|
|
|
|
llarp/dht/messages/gotrouter.cpp
|
|
|
|
llarp/dht/messages/pubintro.cpp
|
|
|
|
llarp/dht/node.cpp
|
2019-01-22 01:14:02 +00:00
|
|
|
llarp/dht/publishservicejob.cpp
|
|
|
|
llarp/dht/recursiverouterlookup.cpp
|
|
|
|
llarp/dht/serviceaddresslookup.cpp
|
|
|
|
llarp/dht/taglookup.cpp
|
|
|
|
llarp/dht/tx.cpp
|
|
|
|
llarp/dht/txholder.cpp
|
2019-01-19 18:16:40 +00:00
|
|
|
llarp/dht/txowner.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/dns.cpp
|
|
|
|
llarp/dnsc.cpp
|
|
|
|
llarp/dnsd.cpp
|
2018-11-12 16:43:40 +00:00
|
|
|
llarp/exit/close_exit.cpp
|
|
|
|
llarp/exit/context.cpp
|
|
|
|
llarp/exit/endpoint.cpp
|
|
|
|
llarp/exit/grant_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
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/exit/update_exit.cpp
|
2018-11-12 16:43:40 +00:00
|
|
|
llarp/handlers/exit.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/handlers/null.cpp
|
2018-08-08 19:37:33 +00:00
|
|
|
llarp/handlers/tun.cpp
|
2018-09-04 12:41:25 +00:00
|
|
|
llarp/link/curvecp.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/link/encoder.cpp
|
2019-01-05 13:45:05 +00:00
|
|
|
llarp/link/iwp.cpp
|
2018-09-03 13:10:56 +00:00
|
|
|
llarp/link/server.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/link/session.cpp
|
2018-09-04 12:41:25 +00:00
|
|
|
llarp/link/utp.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/messages/dht.cpp
|
|
|
|
llarp/messages/dht_immediate.cpp
|
|
|
|
llarp/messages/discard.cpp
|
|
|
|
llarp/messages/exit.cpp
|
|
|
|
llarp/messages/link_intro.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/messages/link_message.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/messages/path_confirm.cpp
|
|
|
|
llarp/messages/path_latency.cpp
|
|
|
|
llarp/messages/path_transfer.cpp
|
|
|
|
llarp/messages/relay.cpp
|
|
|
|
llarp/messages/relay_commit.cpp
|
|
|
|
llarp/messages/transfer_traffic.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/net/address_info.cpp
|
|
|
|
llarp/net/exit_info.cpp
|
|
|
|
llarp/net/ip.cpp
|
2019-01-11 01:42:02 +00:00
|
|
|
llarp/net/net_int.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/nodedb.cpp
|
2019-01-11 01:19:36 +00:00
|
|
|
llarp/path/path.cpp
|
|
|
|
llarp/path/path_types.cpp
|
|
|
|
llarp/path/pathbuilder.cpp
|
|
|
|
llarp/path/pathset.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/path/transit_hop.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/pow.cpp
|
|
|
|
llarp/profiling.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/router/router.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/router_contact.cpp
|
|
|
|
llarp/router_id.cpp
|
2018-06-29 14:25:09 +00:00
|
|
|
llarp/routing/dht_message.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/routing/handler.cpp
|
2018-06-22 13:59:28 +00:00
|
|
|
llarp/routing/message_parser.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/routing/message.cpp
|
2018-06-22 13:59:28 +00:00
|
|
|
llarp/routing/path_confirm.cpp
|
2018-06-26 16:23:43 +00:00
|
|
|
llarp/routing/path_latency.cpp
|
2018-06-29 14:25:09 +00:00
|
|
|
llarp/routing/path_transfer.cpp
|
2019-01-14 21:46:07 +00:00
|
|
|
llarp/rpc/rpc.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/service/Identity.cpp
|
|
|
|
llarp/service/Intro.cpp
|
|
|
|
llarp/service/IntroSet.cpp
|
2018-07-16 03:32:13 +00:00
|
|
|
llarp/service/address.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/service/config.cpp
|
2018-07-11 16:11:19 +00:00
|
|
|
llarp/service/context.cpp
|
|
|
|
llarp/service/endpoint.cpp
|
2018-12-15 16:21:52 +00:00
|
|
|
llarp/service/handler.cpp
|
|
|
|
llarp/service/info.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-12-15 16:21:52 +00:00
|
|
|
llarp/service/types.cpp
|
|
|
|
llarp/service/vanity.cpp
|
|
|
|
llarp/testnet.c
|
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
|
2018-07-24 01:06:13 +00:00
|
|
|
llarp/dns.cpp
|
2018-07-16 12:47:13 +00:00
|
|
|
llarp/dnsc.cpp
|
|
|
|
llarp/dnsd.cpp
|
2018-09-22 10:17:22 +00:00
|
|
|
llarp/dns_iptracker.cpp
|
|
|
|
llarp/dns_dotlokilookup.cpp
|
2018-11-18 23:08:02 +00:00
|
|
|
llarp/dns_rectypes.cpp
|
2019-01-11 01:42:02 +00:00
|
|
|
llarp/net/net.cpp
|
2018-07-16 12:47:13 +00:00
|
|
|
daemon/dns.cpp
|
|
|
|
)
|
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
set(TEST_SRC
|
2019-01-15 00:42:50 +00:00
|
|
|
# helpers
|
|
|
|
test/main.cpp
|
2019-01-22 23:50:26 +00:00
|
|
|
test/dht/mock_context.cpp
|
2019-01-15 00:42:50 +00:00
|
|
|
test/test_util.cpp
|
|
|
|
# actual test cases
|
|
|
|
test/crypto/test_llarp_crypto_types.cpp
|
2019-01-13 14:00:50 +00:00
|
|
|
test/crypto/test_llarp_crypto.cpp
|
2019-01-19 01:41:08 +00:00
|
|
|
test/dht/test_llarp_dht_bucket.cpp
|
2019-01-22 23:50:26 +00:00
|
|
|
test/dht/test_llarp_dht_explorenetworkjob.cpp
|
2019-01-19 01:41:08 +00:00
|
|
|
test/dht/test_llarp_dht_kademlia.cpp
|
2019-01-11 01:42:02 +00:00
|
|
|
test/dht/test_llarp_dht_key.cpp
|
2019-01-22 23:50:26 +00:00
|
|
|
test/dht/test_llarp_dht_tx.cpp
|
2019-01-19 18:16:10 +00:00
|
|
|
test/dht/test_llarp_dht_txowner.cpp
|
2019-01-11 00:12:43 +00:00
|
|
|
test/dns/test_llarp_dns_dns.cpp
|
|
|
|
test/exit/test_llarp_exit_context.cpp
|
|
|
|
test/link/test_llarp_link.cpp
|
2019-01-11 01:42:02 +00:00
|
|
|
test/net/test_llarp_net_inaddr.cpp
|
|
|
|
test/net/test_llarp_net.cpp
|
2019-01-11 00:12:43 +00:00
|
|
|
test/routing/llarp_routing_transfer_traffic.cpp
|
|
|
|
test/routing/test_llarp_routing_obtainexitmessage.cpp
|
|
|
|
test/service/test_llarp_service_address.cpp
|
|
|
|
test/service/test_llarp_service_identity.cpp
|
|
|
|
test/test_llarp_dns.cpp
|
|
|
|
test/test_llarp_dnsd.cpp
|
|
|
|
test/test_llarp_encrypted_frame.cpp
|
|
|
|
test/test_llarp_router_contact.cpp
|
2019-01-13 14:00:50 +00:00
|
|
|
test/test_llarp_router.cpp
|
2019-01-11 00:12:43 +00:00
|
|
|
test/util/test_llarp_util_aligned.cpp
|
|
|
|
test/util/test_llarp_util_bencode.cpp
|
|
|
|
test/util/test_llarp_util_encode.cpp
|
2019-01-22 14:13:26 +00:00
|
|
|
test/util/test_llarp_util_ini.cpp
|
2019-01-11 00:12:43 +00:00
|
|
|
test/util/test_llarp_util_queue_manager.cpp
|
|
|
|
test/util/test_llarp_util_queue.cpp
|
|
|
|
test/util/test_llarp_util_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)
|
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
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)
|
2018-10-27 22:57:19 +00:00
|
|
|
#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)
|
2018-10-27 12:41:04 +00:00
|
|
|
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
|
|
|
|
2018-10-27 12:41:04 +00:00
|
|
|
if(USE_LIBABYSS)
|
2018-11-01 12:47:14 +00:00
|
|
|
add_definitions(-DUSE_ABYSS=1)
|
2018-10-27 12:41:04 +00:00
|
|
|
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)
|
2018-10-27 13:51:02 +00:00
|
|
|
add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC})
|
2018-10-27 12:41:04 +00:00
|
|
|
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)
|
2018-11-02 20:43:53 +00:00
|
|
|
|
2019-01-23 22:16:16 +00:00
|
|
|
if (NOT WIN32)
|
|
|
|
target_link_libraries(${ABYSS_EXE} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} Threads::Threads)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${ABYSS_EXE} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi Threads::Threads)
|
|
|
|
endif(NOT WIN32)
|
2018-11-02 20:43:53 +00:00
|
|
|
|
2019-01-11 00:12:43 +00:00
|
|
|
set(TEST_SRC ${TEST_SRC} test/test_libabyss.cpp)
|
2018-11-02 17:45:39 +00:00
|
|
|
# for freebsd
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
include_directories(/usr/local/include)
|
2018-12-12 04:51:22 +00:00
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
endif(USE_LIBABYSS)
|
2018-10-24 18:02:42 +00:00
|
|
|
|
|
|
|
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-12-12 04:51:22 +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-12-12 04:51:22 +00:00
|
|
|
add_subdirectory(${GTEST_DIR})
|
2019-01-19 03:08:32 +00:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_executable(${TEST_EXE} ${TEST_SRC})
|
|
|
|
add_executable(${EXE} ${EXE_SRC})
|
|
|
|
else()
|
|
|
|
add_executable(${TEST_EXE} ${TEST_SRC} llarp/constants/version.rc)
|
|
|
|
add_executable(${EXE} ${EXE_SRC} llarp/constants/version.rc)
|
|
|
|
endif(NOT WIN32)
|
2019-01-15 00:42:50 +00:00
|
|
|
|
|
|
|
target_include_directories(${TEST_EXE} PRIVATE test)
|
2018-12-12 04:51:22 +00:00
|
|
|
target_include_directories(${TEST_EXE} PRIVATE ${GTEST_DIR}/include ${GTEST_DIR})
|
2019-01-15 00:42:50 +00:00
|
|
|
|
2018-12-12 04:51:22 +00:00
|
|
|
install(TARGETS ${EXE} RUNTIME DESTINATION bin)
|
2018-12-16 22:31:32 +00:00
|
|
|
if(WIN32)
|
2018-12-17 04:07:00 +00:00
|
|
|
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap.exe DESTINATION bin)
|
2018-12-16 22:31:32 +00:00
|
|
|
else()
|
2018-12-17 04:07:00 +00:00
|
|
|
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap DESTINATION bin)
|
2018-12-16 22:31:32 +00:00
|
|
|
endif()
|
2019-01-19 03:08:32 +00:00
|
|
|
|
2018-12-16 22:28:09 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
install(CODE "execute_process(COMMAND setcap cap_net_admin,cap_net_bind_service=+eip ${CMAKE_INSTALL_PREFIX}/bin/lokinet)")
|
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2018-10-19 11:41:36 +00:00
|
|
|
|
2019-01-08 22:30:21 +00:00
|
|
|
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
2019-01-10 19:41:51 +00:00
|
|
|
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
2019-01-08 22:30:21 +00:00
|
|
|
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
|
2019-01-19 03:08:32 +00:00
|
|
|
|
2019-01-08 22:30:21 +00:00
|
|
|
if(USE_LIBABYSS)
|
2019-01-10 19:41:51 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} ${UTIL_LIB} Threads::Threads ${ABYSS_LIB})
|
2019-01-08 22:30:21 +00:00
|
|
|
else()
|
2019-01-10 19:41:51 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} ${UTIL_LIB} Threads::Threads)
|
2019-01-08 22:30:21 +00:00
|
|
|
endif(USE_LIBABYSS)
|
2019-01-19 03:08:32 +00:00
|
|
|
|
2019-01-08 22:30:21 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
if(NON_PC_TARGET)
|
|
|
|
target_link_libraries(${PLATFORM_LIB} -lrt)
|
2018-10-27 12:41:04 +00:00
|
|
|
else()
|
2019-01-08 22:30:21 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} -lcap)
|
|
|
|
endif(NON_PC_TARGET)
|
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2019-01-19 03:08:32 +00:00
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
target_link_libraries(${STATIC_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB})
|
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB})
|
2019-01-22 23:58:24 +00:00
|
|
|
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gmock gtest ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB})
|
2019-01-08 22:30:21 +00:00
|
|
|
if (WIN32)
|
2019-01-10 19:41:51 +00:00
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
2019-01-22 23:58:24 +00:00
|
|
|
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gmock gtest ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
2019-01-08 22:30:21 +00:00
|
|
|
endif(WIN32)
|
2019-01-10 19:41:51 +00:00
|
|
|
|
2019-01-08 22:30:21 +00:00
|
|
|
|
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-12-12 04:51:22 +00:00
|
|
|
endif(ANDROID)
|
2018-07-13 13:14:42 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
if(WITH_SHARED)
|
2019-01-08 22:30:21 +00:00
|
|
|
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
|
2019-01-10 19:41:51 +00:00
|
|
|
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB} Threads::Threads)
|
2019-01-21 15:45:18 +00:00
|
|
|
install(TARGETS ${SHARED_LIB} LIBRARY DESTINATION lib)
|
2018-07-26 01:00:15 +00:00
|
|
|
endif(WITH_SHARED)
|
2019-01-22 23:58:24 +00:00
|
|
|
endif(SHADOW)
|