lokinet/CMakeLists.txt

87 lines
2.0 KiB
CMake
Raw Normal View History

2018-05-16 13:56:51 +00:00
cmake_minimum_required(VERSION 2.8.10)
set(WITH_SHARED OFF)
set(DEBUG_FLAGS "")
set(OPTIMIZE_FLAGS "-Os")
if(ASAN)
set(DEBUG_FLAGS "${DEBUG_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
set(OPTIMIZE_FLAGS "-O0")
endif(ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall ${DEBUG_FLAGS} ${OPTIMIZE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall ${DEBUG_FLAGS} ${OPTIMIZE_FLAGS}")
2018-05-16 13:56:51 +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-05-16 13:56:51 +00:00
set(EXE llarpd)
2018-05-20 16:15:16 +00:00
set(EXE_SRC daemon/main.cpp)
2018-05-16 13:56:51 +00:00
2018-05-29 14:45:37 +00:00
if(SODIUM_INCLUDE_DIR)
include_directories(${SODIUM_INCLUDE_DIR})
endif()
2018-05-29 14:26:43 +00:00
2018-05-29 14:45:37 +00:00
if(SODIUM_LIBRARIES)
set(SODIUM_LIB ${SODIUM_LIBRARIES})
else()
set(SODIUM_LIB sodium)
endif()
2018-05-29 12:15:48 +00:00
set(LIBS ${SODIUM_LIB} pthread stdc++fs)
2018-05-16 13:56:51 +00:00
set(LIB llarp)
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
set(LIB_SRC
llarp/address_info.cpp
llarp/bencode.c
2018-05-16 13:56:51 +00:00
llarp/buffer.cpp
llarp/config.cpp
llarp/context.cpp
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-05-16 13:56:51 +00:00
llarp/ev.cpp
llarp/exit_info.cpp
2018-05-16 13:56:51 +00:00
llarp/exit_route.c
2018-05-18 14:40:06 +00:00
llarp/iwp_link.cpp
llarp/logger.cpp
2018-05-16 15:49:16 +00:00
llarp/link.c
2018-05-16 13:56:51 +00:00
llarp/link_intro.cpp
llarp/link_message.cpp
llarp/logic.cpp
2018-05-16 13:56:51 +00:00
llarp/mem.cpp
llarp/net.cpp
llarp/nodedb.cpp
2018-06-01 14:08:54 +00:00
llarp/relay_commit.cpp
llarp/router_contact.cpp
2018-05-16 13:56:51 +00:00
llarp/router.cpp
llarp/router_identity.c
llarp/threadpool.cpp
llarp/time.cpp
llarp/timer.cpp
)
include_directories(include)
2018-05-27 18:03:10 +00:00
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
if(WITH_SHARED)
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
target_link_libraries(${SHARED_LIB} ${LIBS})
endif()
2018-05-27 18:03:10 +00:00
2018-05-16 13:56:51 +00:00
add_executable(${EXE} ${EXE_SRC})
2018-05-29 14:38:05 +00:00
target_link_libraries(${STATIC_LIB} ${LIBS})
target_link_libraries(${EXE} ${STATIC_LIB})
2018-05-21 12:51:38 +00:00
add_executable(rcutil daemon/rcutil.cpp)
2018-05-27 18:03:10 +00:00
target_link_libraries(rcutil ${STATIC_LIB} ${LIBS})