2018-05-16 13:56:51 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.10)
|
|
|
|
|
2018-08-12 17:22:29 +00:00
|
|
|
set(PROJECT_NAME lokinet)
|
2018-06-14 14:04:42 +00:00
|
|
|
project(${PROJECT_NAME})
|
|
|
|
|
2018-06-06 13:17:03 +00:00
|
|
|
macro(add_cflags)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGN}")
|
|
|
|
endmacro(add_cflags)
|
2018-06-06 17:02:57 +00:00
|
|
|
|
2018-06-15 13:42:49 +00:00
|
|
|
macro(add_cxxflags)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGN}")
|
|
|
|
endmacro(add_cxxflags)
|
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
2018-08-24 18:40:56 +00:00
|
|
|
if (MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("/std:c++17" COMPILER_SUPPORTS_CXX17)
|
|
|
|
else()
|
2018-07-26 01:00:15 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
|
|
|
|
2018-09-06 11:46:19 +00:00
|
|
|
option(HAVE_CXX17_FILESYSTEM "Disable if your C++ compiler and runtime library lacks std::[experimental::]filesystem" ON)
|
2018-07-30 04:38:14 +00:00
|
|
|
|
|
|
|
if(COMPILER_SUPPORTS_CXX11 AND NOT HAVE_CXX17_FILESYSTEM)
|
2018-06-15 13:42:49 +00:00
|
|
|
add_cxxflags("-std=c++11")
|
2018-07-30 04:38:14 +00:00
|
|
|
elseif(COMPILER_SUPPORTS_CXX17 AND HAVE_CXX17_FILESYSTEM)
|
2018-08-24 18:40:56 +00:00
|
|
|
if (MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
add_cxxflags("/std:c++17")
|
|
|
|
else()
|
2018-07-26 01:00:15 +00:00
|
|
|
add_cxxflags("-std=c++17")
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
|
|
|
add_definitions(-DUSE_CXX17_FILESYSTEM)
|
2018-06-15 13:42:49 +00:00
|
|
|
else()
|
2018-07-26 01:00:15 +00:00
|
|
|
message(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or C++17 support. Please use a different C++ compiler.")
|
2018-06-15 13:42:49 +00:00
|
|
|
endif()
|
|
|
|
|
2018-09-07 20:54:50 +00:00
|
|
|
add_cxxflags("-fpermissive")
|
|
|
|
|
2018-08-09 13:55:51 +00:00
|
|
|
if(DEBIAN)
|
|
|
|
add_definitions(-DDEBIAN)
|
|
|
|
endif()
|
|
|
|
|
2018-07-27 03:30:15 +00:00
|
|
|
if(ANDROID)
|
2018-07-24 03:27:32 +00:00
|
|
|
set(THREAD_LIB "-pthread")
|
2018-07-30 04:38:14 +00:00
|
|
|
# finally removed pthread dependency for MSC++
|
2018-08-24 18:40:56 +00:00
|
|
|
elseif(MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
set(THREAD_LIB)
|
2018-07-27 03:30:15 +00:00
|
|
|
else()
|
|
|
|
set(THREAD_LIB pthread)
|
|
|
|
endif()
|
2018-07-16 23:26:58 +00:00
|
|
|
|
2018-09-09 19:52:38 +00:00
|
|
|
if(MSVC)
|
2018-08-24 18:40:56 +00:00
|
|
|
option (BUILD_AVX2 "Enable AVX2 FPU vector instructions." OFF)
|
|
|
|
if (BUILD_AVX2)
|
|
|
|
add_cflags("/arch:AVX2")
|
|
|
|
add_cxxflags("/arch:AVX2")
|
|
|
|
else()
|
|
|
|
add_cflags("/arch:SSE2")
|
|
|
|
add_cxxflags("/arch:SSE2")
|
|
|
|
endif(BUILD_AVX2)
|
2018-09-09 19:52:38 +00:00
|
|
|
endif()
|
2018-08-13 15:44:14 +00:00
|
|
|
|
2018-06-15 13:42:49 +00:00
|
|
|
if(STATIC_LINK)
|
|
|
|
add_cflags("-static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
|
|
|
|
add_cxxflags("-static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
|
|
|
|
endif()
|
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
if(SHADOW)
|
|
|
|
set(WITH_STATIC OFF)
|
|
|
|
else()
|
|
|
|
set(WITH_STATIC ON)
|
|
|
|
endif()
|
|
|
|
|
2018-08-24 18:40:56 +00:00
|
|
|
if (NOT MSVC)
|
2018-07-16 01:32:48 +00:00
|
|
|
add_cflags("-Wall")
|
|
|
|
add_cxxflags("-Wall")
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
2018-07-16 01:32:48 +00:00
|
|
|
|
2018-08-24 18:40:56 +00:00
|
|
|
if (MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
set(OPTIMIZE_FLAGS "-Od")
|
|
|
|
set(DEBUG_FLAGS "-ZI")
|
|
|
|
else()
|
2018-06-20 12:34:48 +00:00
|
|
|
set(OPTIMIZE_FLAGS "-O0")
|
2018-07-30 04:38:14 +00:00
|
|
|
set(DEBUG_FLAGS "-g")
|
|
|
|
endif()
|
2018-06-15 13:42:49 +00:00
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
if(ASAN)
|
2018-06-06 12:46:26 +00:00
|
|
|
set(DEBUG_FLAGS "${DEBUG_FLAGS} -fsanitize=address -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-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)
|
2018-06-15 13:42:49 +00:00
|
|
|
add_cxxflags("-fno-inline -fno-strict-aliasing")
|
2018-06-06 17:02:57 +00:00
|
|
|
add_cflags("-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-06-01 17:47:37 +00:00
|
|
|
|
2018-08-24 18:40:56 +00:00
|
|
|
if (MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
add_cflags("-wd4996 -wd4244 -MP ${OPTIMIZE_FLAGS}")
|
|
|
|
add_cxxflags("-wd4996 -wd4244 -MP ${OPTIMIZE_FLAGS}")
|
|
|
|
else()
|
2018-06-18 22:03:50 +00:00
|
|
|
add_cflags("-Wall -Wno-deprecated-declarations ${OPTIMIZE_FLAGS}")
|
|
|
|
add_cxxflags("-Wall -Wno-deprecated-declarations ${OPTIMIZE_FLAGS}")
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
2018-06-15 13:42:49 +00:00
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
|
|
|
|
add_cflags("${DEBUG_FLAGS}")
|
|
|
|
add_cxxflags("${DEBUG_FLAGS}")
|
|
|
|
endif()
|
2018-05-16 13:56:51 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
if(SHADOW)
|
|
|
|
add_cflags("-fPIC")
|
2018-06-15 13:42:49 +00:00
|
|
|
add_cxxflags("-fPIC")
|
2018-06-06 17:02:57 +00:00
|
|
|
endif()
|
|
|
|
|
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}")
|
|
|
|
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-07-16 04:55:46 +00:00
|
|
|
if(SODIUM_INCLUDE_DIR)
|
|
|
|
include_directories(${SODIUM_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(SODIUM_LIBRARIES)
|
|
|
|
set(SODIUM_LIB ${SODIUM_LIBRARIES})
|
|
|
|
else()
|
|
|
|
find_library (
|
2018-07-26 01:00:15 +00:00
|
|
|
SODIUM_LIB
|
|
|
|
NAMES sodium libsodium
|
|
|
|
HINTS "/usr/local/lib"
|
2018-07-16 04:55:46 +00:00
|
|
|
)
|
|
|
|
endif()
|
2018-05-29 12:15:48 +00:00
|
|
|
|
2018-09-06 11:46:19 +00:00
|
|
|
if(JEMALLOC)
|
|
|
|
set(MALLOC_LIB jemalloc)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LIBS ${SODIUM_LIB} ${THREAD_LIB} ${MALLOC_LIB})
|
|
|
|
if(HAVE_CXX17_FILESYSTEM)
|
|
|
|
set(LIBS ${LIBS} stdc++fs)
|
|
|
|
endif()
|
2018-05-22 18:41:38 +00:00
|
|
|
|
2018-07-30 04:38:14 +00:00
|
|
|
set(LIB lokinet)
|
2018-05-27 18:03:10 +00:00
|
|
|
set(SHARED_LIB ${LIB})
|
|
|
|
set(STATIC_LIB ${LIB}-static)
|
2018-05-16 13:56:51 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
if (UNIX)
|
2018-09-04 12:41:25 +00:00
|
|
|
add_definitions(-DUNIX)
|
|
|
|
add_definitions(-DPOSIX)
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
|
|
|
|
2018-06-29 12:14:20 +00:00
|
|
|
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)
|
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)
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
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)
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2018-08-16 22:36:15 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
|
2018-06-29 12:14:20 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Your operating system is not supported yet")
|
|
|
|
endif()
|
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)
|
2018-08-03 01:33:48 +00:00
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
2018-09-07 20:54:50 +00:00
|
|
|
add_definitions(-DWIN32)
|
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-06-29 16:06:07 +00:00
|
|
|
if(TUNTAP)
|
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-07-30 04:38:14 +00:00
|
|
|
if (UNIX)
|
2018-08-24 18:40:56 +00:00
|
|
|
set(LIBTUNTAP_SRC
|
2018-08-08 19:37:33 +00:00
|
|
|
${TT_ROOT}/tuntap-unix.c
|
2018-08-15 15:36:34 +00:00
|
|
|
${LIBTUNTAP_SRC_BASE})
|
2018-07-30 04:38:14 +00:00
|
|
|
endif()
|
2018-06-29 16:06:07 +00:00
|
|
|
else()
|
|
|
|
set(LIBTUNTAP_SRC "")
|
|
|
|
endif()
|
2018-06-29 12:14:20 +00:00
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
#if(BACKPORT)
|
|
|
|
#else()
|
|
|
|
#set(CPP_BACKPORT_SRC "")
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
set(CPP_BACKPORT_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-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()
|
|
|
|
|
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
set(LIB_PLATFORM_SRC
|
|
|
|
# for outpug
|
|
|
|
llarp/logger.cpp
|
2018-07-16 12:47:13 +00:00
|
|
|
# needed for threading
|
|
|
|
llarp/logic.cpp
|
2018-07-13 13:14:42 +00:00
|
|
|
# for zero (for net.hpp stuff for llarp::addr stuff)
|
|
|
|
llarp/mem.cpp
|
|
|
|
# for networking
|
|
|
|
llarp/ev.cpp
|
2018-07-16 12:47:13 +00:00
|
|
|
# for timer
|
|
|
|
llarp/time.cpp
|
|
|
|
# for logic
|
|
|
|
llarp/timer.cpp
|
2018-07-13 13:14:42 +00:00
|
|
|
# for threading
|
|
|
|
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}
|
2018-08-24 18:40:56 +00:00
|
|
|
# tun
|
2018-08-15 15:36:34 +00:00
|
|
|
${LIBTUNTAP_SRC}
|
2018-07-30 04:38:14 +00:00
|
|
|
# win32 inline procs
|
|
|
|
llarp/win32_inet.c
|
|
|
|
llarp/win32_intrnl.c
|
|
|
|
contrib/msc/getopt.c
|
|
|
|
contrib/msc/getopt1.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
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(crypto/libntrup/include)
|
|
|
|
|
|
|
|
set(NTRU_SRC
|
|
|
|
${NTRU_AVX_SRC}
|
|
|
|
${NTRU_REF_SRC}
|
2018-08-14 12:44:34 +00:00
|
|
|
crypto/libntrup/src/ntru.cpp
|
2018-08-13 15:44:14 +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)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
set(LIB_SRC
|
|
|
|
${UTP_SRC}
|
2018-08-13 23:22:31 +00:00
|
|
|
${NTRU_SRC}
|
2018-05-22 15:54:19 +00:00
|
|
|
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
|
2018-05-27 17:44:01 +00:00
|
|
|
llarp/context.cpp
|
2018-05-20 14:54:52 +00:00
|
|
|
llarp/crypto_async.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
|
2018-06-21 11:28:22 +00:00
|
|
|
llarp/encode.cpp
|
2018-06-10 14:05:48 +00:00
|
|
|
llarp/encrypted_frame.cpp
|
2018-05-28 13:49:44 +00:00
|
|
|
llarp/exit_info.cpp
|
2018-07-09 04:09:54 +00:00
|
|
|
llarp/exit_route.cpp
|
2018-08-17 19:49:58 +00:00
|
|
|
llarp/ip.cpp
|
2018-05-16 13:56:51 +00:00
|
|
|
llarp/link_intro.cpp
|
2018-05-25 17:52:10 +00:00
|
|
|
llarp/link_message.cpp
|
2018-05-16 13:56:51 +00:00
|
|
|
llarp/net.cpp
|
|
|
|
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
|
2018-06-25 15:12:08 +00:00
|
|
|
llarp/pathset.cpp
|
2018-09-13 16:41:53 +00:00
|
|
|
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
|
2018-05-27 13:42:55 +00:00
|
|
|
llarp/router_contact.cpp
|
2018-05-16 13:56:51 +00:00
|
|
|
llarp/router.cpp
|
2018-07-05 15:44:06 +00:00
|
|
|
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
|
2018-07-11 13:20:14 +00:00
|
|
|
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
|
2018-07-11 13:20:14 +00:00
|
|
|
llarp/dht/find_router.cpp
|
|
|
|
llarp/dht/got_intro.cpp
|
|
|
|
llarp/dht/got_router.cpp
|
|
|
|
llarp/dht/publish_intro.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-09-03 13:10:56 +00:00
|
|
|
llarp/link/server.cpp
|
2018-09-04 12:41:25 +00:00
|
|
|
llarp/link/utp.cpp
|
2018-06-29 14:25:09 +00:00
|
|
|
llarp/routing/dht_message.cpp
|
2018-06-22 13:59:28 +00:00
|
|
|
llarp/routing/message_parser.cpp
|
|
|
|
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
|
2018-07-16 03:32:13 +00:00
|
|
|
llarp/service/address.cpp
|
2018-07-11 16:11:19 +00:00
|
|
|
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
|
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
|
|
|
|
llarp/net.cpp
|
|
|
|
daemon/dns.cpp
|
|
|
|
)
|
|
|
|
|
2018-07-13 13:14:42 +00:00
|
|
|
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
|
2018-08-13 23:22:31 +00:00
|
|
|
test/pq_unittest.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-09-03 11:41:04 +00:00
|
|
|
set(ALL_SRC ${CLIENT_SRC} ${RC_SRC} ${EXE_SRC} ${DNS_SRC} ${LIB_PLATFORM_SRC} ${LIB_SRC} ${TEST_SRC} ${CPP_BACKPORT_SRC})
|
2018-07-30 22:35:54 +00:00
|
|
|
|
|
|
|
foreach(F ${ALL_SRC})
|
|
|
|
set_source_files_properties(${F} PROPERTIES COMPILE_FLAGS -DLOG_TAG=\\\"${F}\\\")
|
|
|
|
endforeach(F)
|
|
|
|
|
2018-07-27 04:07:22 +00:00
|
|
|
set(LIB lokinet)
|
|
|
|
set(SHARED_LIB ${LIB})
|
|
|
|
set(STATIC_LIB ${LIB}-static)
|
2018-09-03 11:41:04 +00:00
|
|
|
set(BACKPORT_LIB ${LIB}-backport)
|
|
|
|
set(PLATFORM_LIB ${LIB}-platform)
|
|
|
|
set(ANDROID_LIB ${LIB}android)
|
2018-07-13 13:14:42 +00:00
|
|
|
|
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-05-16 13:56:51 +00:00
|
|
|
include_directories(include)
|
2018-06-14 19:22:26 +00:00
|
|
|
include_directories(vendor/cppbackport-master/lib)
|
2018-07-13 13:14:42 +00:00
|
|
|
include_directories(${sodium_INCLUDE_DIR})
|
2018-06-06 12:59:15 +00:00
|
|
|
|
2018-09-18 23:44:23 +00:00
|
|
|
if (MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
include_directories(contrib/msc/include)
|
|
|
|
endif()
|
|
|
|
|
2018-09-03 11:41:04 +00:00
|
|
|
set(RC_EXE rcutil)
|
|
|
|
set(DNS_EXE dns)
|
|
|
|
|
|
|
|
|
2018-06-06 12:59:15 +00:00
|
|
|
if(SHADOW)
|
2018-08-24 18:40:56 +00:00
|
|
|
add_shadow_plugin(shadow-plugin-${SHARED_LIB} ${EXE_SRC} ${LIB_SRC} ${LIB_PLATFORM_SRC} ${CPP_BACKPORT_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-03 11:41:04 +00:00
|
|
|
add_executable(${RC_EXE} ${RC_SRC})
|
2018-08-24 18:40:56 +00:00
|
|
|
add_executable(${EXE} ${EXE_SRC})
|
|
|
|
add_executable(${CLIENT_EXE} ${CLIENT_SRC})
|
2018-09-03 11:41:04 +00:00
|
|
|
add_executable(${DNS_EXE} ${DNS_SRC})
|
2018-08-24 18:40:56 +00:00
|
|
|
add_subdirectory(${GTEST_DIR})
|
|
|
|
include_directories(${GTEST_DIR}/include ${GTEST_DIR})
|
|
|
|
add_executable(${TEST_EXE} ${TEST_SRC})
|
|
|
|
|
2018-09-18 23:44:23 +00:00
|
|
|
if (MSVC)
|
2018-08-24 18:40:56 +00:00
|
|
|
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ws2_32 iphlpapi)
|
2018-09-09 19:52:38 +00:00
|
|
|
elseif (MINGW)
|
|
|
|
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} stdc++fs iphlpapi ws2_32)
|
2018-08-24 18:40:56 +00:00
|
|
|
else()
|
|
|
|
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB})
|
2018-09-18 23:44:23 +00:00
|
|
|
endif(MSVC)
|
2018-06-23 00:00:44 +00:00
|
|
|
|
2018-08-24 18:40:56 +00:00
|
|
|
if(WITH_STATIC)
|
2018-06-06 17:02:57 +00:00
|
|
|
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
2018-07-30 04:38:14 +00:00
|
|
|
if(NOT HAVE_CXX17_FILESYSTEM)
|
2018-09-03 11:41:04 +00:00
|
|
|
add_library(${BACKPORT_LIB} STATIC ${CPP_BACKPORT_SRC})
|
2018-07-30 04:38:14 +00:00
|
|
|
endif(NOT HAVE_CXX17_FILESYSTEM)
|
2018-09-03 11:41:04 +00:00
|
|
|
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
|
|
|
|
target_link_libraries(${PLATFORM_LIB} ${THREAD_LIB})
|
2018-08-26 12:51:22 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${PLATFORM_LIB} -lcap)
|
2018-08-26 12:51:22 +00:00
|
|
|
endif()
|
2018-07-30 04:38:14 +00:00
|
|
|
if(NOT HAVE_CXX17_FILESYSTEM)
|
2018-09-03 11:43:34 +00:00
|
|
|
target_link_libraries(${STATIC_LIB} ${LIBS} ${PLATFORM_LIB} ${BACKPORT_LIB})
|
2018-07-26 01:00:15 +00:00
|
|
|
else()
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${STATIC_LIB} ${LIBS} ${PLATFORM_LIB})
|
2018-07-30 04:38:14 +00:00
|
|
|
endif(NOT HAVE_CXX17_FILESYSTEM)
|
2018-06-06 17:02:57 +00:00
|
|
|
if(NOT WITH_SHARED)
|
2018-07-30 04:38:14 +00:00
|
|
|
if(NOT HAVE_CXX17_FILESYSTEM)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB})
|
|
|
|
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB})
|
|
|
|
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB})
|
2018-07-26 01:00:15 +00:00
|
|
|
if (MINGW)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
|
|
|
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
|
|
|
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
2018-08-24 18:40:56 +00:00
|
|
|
elseif(MSVC)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
|
|
|
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
|
|
|
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${BACKPORT_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
2018-07-26 01:00:15 +00:00
|
|
|
endif(MINGW)
|
|
|
|
else()
|
2018-09-03 11:41:04 +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})
|
2018-07-26 01:00:15 +00:00
|
|
|
if (MINGW)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
|
|
|
target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
|
|
|
target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 stdc++fs iphlpapi)
|
2018-08-24 18:40:56 +00:00
|
|
|
elseif(MSVC)
|
2018-09-03 11:41:04 +00:00
|
|
|
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)
|
2018-07-26 01:00:15 +00:00
|
|
|
endif(MINGW)
|
2018-07-30 04:38:14 +00:00
|
|
|
endif(NOT HAVE_CXX17_FILESYSTEM)
|
2018-07-26 01:00:15 +00:00
|
|
|
if (MINGW)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} ${THREAD_LIB} ws2_32 stdc++fs iphlpapi)
|
2018-07-26 01:00:15 +00:00
|
|
|
elseif(WIN32)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} ${THREAD_LIB} ws2_32 iphlpapi)
|
2018-07-26 01:00:15 +00:00
|
|
|
endif(MINGW)
|
2018-09-03 11:41:04 +00:00
|
|
|
target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} ${THREAD_LIB})
|
2018-07-26 01:00:15 +00:00
|
|
|
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)
|
|
|
|
target_link_libraries(${ANDROID_LIB} ${STATIC_LIB} ${LIBS} log)
|
2018-08-05 23:48:59 +00:00
|
|
|
endif()
|
2018-07-13 13:14:42 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
if(WITH_SHARED)
|
2018-07-30 04:38:14 +00:00
|
|
|
if(HAVE_CXX17_FILESYSTEM)
|
2018-07-27 04:07:22 +00:00
|
|
|
set(LIB_SRC ${LIB_SRC} ${CPP_BACKPORT_SRC})
|
2018-07-30 04:38:14 +00:00
|
|
|
endif(HAVE_CXX17_FILESYSTEM)
|
2018-07-27 04:07:22 +00:00
|
|
|
add_library(${SHARED_LIB} SHARED ${LIB_SRC} ${LIB_PLATFORM_SRC})
|
|
|
|
if (MINGW)
|
2018-07-30 04:38:14 +00:00
|
|
|
set(${LIBS} ${LIBS} ws2_32 stdc++fs iphlpapi)
|
2018-08-24 18:40:56 +00:00
|
|
|
elseif(MSVC)
|
2018-07-30 04:38:14 +00:00
|
|
|
set(${LIBS} ${LIBS} ws2_32 iphlpapi)
|
2018-07-27 04:07:22 +00:00
|
|
|
endif(MINGW)
|
|
|
|
target_link_libraries(${SHARED_LIB} ${LIBS} ${THREAD_LIB})
|
|
|
|
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} ${THREAD_LIB})
|
2018-07-26 01:00:15 +00:00
|
|
|
endif(WITH_SHARED)
|
2018-07-26 01:45:09 +00:00
|
|
|
endif(SHADOW)
|