Unverified Commit d8618cb4 authored by anonimal's avatar anonimal

Build: allow Kovri to be used in super-projects

- Create install/export for targets for super-projects + related fixes
- Patch upstream miniupnpc build + temporarily update local submodule URL/branch
- Allow Makefile to set CMAKE_INSTALL_PREFIX
- Move path detection into CMake + related fixes
- kovri-install: allow super-projects to set root/build
  * This is required for super-projects which are installing via their CMake
    (via *their* build and paths).

Note: Crypto++ doesn't build when we try to build with CMake in super-projects.
However, Crypto++ *will* build if done locally.
parent 200dce59
......@@ -2,13 +2,13 @@
path = deps/cryptopp
url = https://github.com/anonimal/cryptopp.git
branch = kovri
[submodule "deps/miniupnp"]
path = deps/miniupnp
url = https://github.com/anonimal/miniupnp
branch = kovri
[submodule "docs"]
path = docs
url = https://gitlab.com/kovri-project/kovri-docs.git
[submodule "deps/miniupnp"]
path = deps/miniupnp
url = https://github.com/monero-project/miniupnp
branch = monero
[submodule "cmake/cotire"]
path = cmake/cotire
url = https://github.com/sakra/cotire.git
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(kovri CXX)
project(kovri VERSION 0.1.0 LANGUAGES CXX)
set(KOVRI_PROJECT "The Kovri I2P Router Project")
......@@ -34,10 +34,10 @@ set(I2P_NETWORK_ID "2") # "1" is reserved for I2P version less than 0.6.1.10
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.h.in" "${CMAKE_BINARY_DIR}/version.h" @ONLY)
# The interface target for internal usage requirements
add_library(kovri-private INTERFACE)
add_library(kovri-internal INTERFACE)
# Include build directory so we need to git-ignore version file output
target_include_directories(kovri-private INTERFACE ${CMAKE_BINARY_DIR})
target_include_directories(kovri-internal INTERFACE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>)
# Configurable options
option(KOVRI_DATA_PATH "The path to the kovri data folder")
......@@ -271,7 +271,7 @@ if (NOT TARGET Boost::log_setup)
endif()
if(NOT WITH_STATIC)
target_compile_definitions(kovri-private INTERFACE BOOST_ALL_DYN_LINK)
target_compile_definitions(kovri-internal INTERFACE BOOST_ALL_DYN_LINK)
endif()
# Libraries
......@@ -288,8 +288,9 @@ if(WITH_CRYPTOPP)
if(NOT TARGET CryptoPP::CryptoPP)
message(FATAL_ERROR "Could not find Crypto++. See building instructions.")
else()
target_link_libraries(kovri-private INTERFACE CryptoPP::CryptoPP)
target_compile_definitions(kovri-private INTERFACE WITH_CRYPTOPP)
target_compile_definitions(kovri-internal INTERFACE WITH_CRYPTOPP)
target_include_directories(kovri-internal INTERFACE $<BUILD_INTERFACE:${CryptoPP_INCLUDE_DIR}/../>)
target_link_libraries(kovri-internal INTERFACE ${CryptoPP_LIBRARIES})
endif()
endif()
......@@ -311,7 +312,7 @@ find_package(OpenSSL REQUIRED)
if(NOT OPENSSL_FOUND)
message(FATAL_ERROR "Could not find OpenSSL. Please download and install it first!")
else()
target_link_libraries(kovri-private INTERFACE OpenSSL::SSL)
target_link_libraries(kovri-internal INTERFACE ${OPENSSL_LIBRARIES})
endif()
add_subdirectory(deps)
......@@ -338,7 +339,7 @@ if (WITH_PYTHON)
message(FATAL_ERROR "Python not found or requirement not satisfied. See building instructions.")
else()
message(STATUS "Found Python: ${PYTHON_INCLUDE_DIR}, ${PYTHON_LIBRARIES}")
target_include_directories(kovri-private INTERFACE ${PYTHON_INCLUDE_DIRS})
target_include_directories(kovri-internal INTERFACE $<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>)
endif()
endif()
......@@ -357,16 +358,24 @@ endif()
# Directly link IPHLPAPI.lib instead of using `#pragma comment()`
if (WIN32)
target_link_libraries(kovri-private INTERFACE "IPHLPAPI.lib")
target_link_libraries(kovri-internal INTERFACE "IPHLPAPI.lib")
endif()
# Load remaining includes
target_include_directories(kovri-private INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# Use data-path set in Makefile. Code must call upon this definition.
if(KOVRI_DATA_PATH)
target_include_directories(kovri-private INTERFACE KOVRI_CUSTOM_DATA_PATH="${KOVRI_DATA_PATH}")
target_include_directories(kovri-internal INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
# Set data directory if not set (if CMake is not called from Makefile first)
if (NOT KOVRI_DATA_PATH)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" OR ${CMAKE_SYSTEM_NAME} STREQUAL "MSYS")
set(KOVRI_DATA_PATH "$ENV{APPDATA}\\Kovri")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(KOVRI_DATA_PATH "$ENV{HOME}/Library/Application\ Support/Kovri")
else() # Linux, *BSD
set(KOVRI_DATA_PATH "$ENV{HOME}/.kovri")
endif()
endif()
target_compile_definitions(kovri-internal INTERFACE KOVRI_CUSTOM_DATA_PATH="${KOVRI_DATA_PATH}")
# Show summary
message(STATUS "---------------------------------------")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
......@@ -374,7 +383,7 @@ message(STATUS "Compiler vendor : ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Kovri data directory: ${KOVRI_DATA_DIR}")
message(STATUS "Kovri data directory: ${KOVRI_DATA_PATH}")
message(STATUS "Options:")
message(STATUS " BINARY : ${WITH_BINARY}")
message(STATUS " KOVRI UTIL : ${WITH_KOVRI_UTIL}")
......@@ -394,9 +403,6 @@ message(STATUS " INTEGRATION TESTS: ${WITH_INTEGRATION_TESTS}")
message(STATUS " Cotire : ${WITH_COTIRE}")
message(STATUS "---------------------------------------")
# Handle paths nicely
include(GNUInstallDirs)
add_subdirectory(src)
if (WITH_TESTS)
......@@ -405,6 +411,65 @@ if (WITH_TESTS)
endif()
if (WITH_INTEGRATION_TESTS)
target_compile_definitions(kovri-private INTERFACE WITH_INTEGRATION_TESTS)
target_compile_definitions(kovri-internal INTERFACE WITH_INTEGRATION_TESTS)
add_subdirectory(tests/integration_tests)
endif()
## Install
# TODO(unassigned): CPack
# TODO(unassigned): multiple components?
add_library(kovri INTERFACE)
target_link_libraries(kovri INTERFACE kovri-core kovri-client kovri-internal libminiupnpc-static ${OPENSSL_LIBRARIES} ${CryptoPP_LIBRARIES})
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME kovri)
include(GNUInstallDirs)
install(TARGETS kovri kovri-internal libminiupnpc-static miniupnpc-private
EXPORT KovriTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS kovri-core
EXPORT KovriTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/kovri/core)
install(TARGETS kovri-client
EXPORT KovriTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/kovri/client)
install(EXPORT KovriTargets
NAMESPACE kovri::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
COMPONENT kovri)
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/KovriConfig.cmake.in
${PROJECT_BINARY_DIR}/KovriConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/KovriConfigVersion.cmake
COMPATIBILITY AnyNewerVersion)
install(FILES
${PROJECT_BINARY_DIR}/KovriConfig.cmake
${PROJECT_BINARY_DIR}/KovriConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
COMPONENT kovri)
# TODO(unassigned): refactor this into CMake. Currently assumes `make` is not installed.
# Kovri BSD currently build requires `gmake`, not `make`.
find_program(MAKE make gmake nmake)
install(CODE "execute_process(COMMAND ${MAKE} KOVRI_ROOT_DIR=${CMAKE_CURRENT_SOURCE_DIR} KOVRI_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} -C ${CMAKE_CURRENT_SOURCE_DIR} install)"
COMPONENT kovri)
......@@ -26,29 +26,12 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Get custom Kovri data path + set appropriate CMake generator.
# If no path is given, set default path
SHELL := $(shell which bash)
# Set appropriate CMake generator for MSYS2/MinGW
system := $(shell uname)
ifeq ($(KOVRI_DATA_PATH),)
ifeq ($(system), Linux)
data-path = $(HOME)/.kovri
endif
ifeq ($(system), Darwin)
data-path = $(HOME)/Library/Application\ Support/Kovri
endif
ifneq (, $(findstring BSD, $(system))) # We should support other BSD's
data-path = $(HOME)/.kovri
endif
ifeq ($(system), DragonFly)
data-path = $(HOME)/.kovri
endif
ifneq (, $(findstring MINGW, $(system)))
data-path = "$(APPDATA)"\\Kovri
cmake-gen = -G 'MSYS Makefiles'
endif
else
data-path = $(KOVRI_DATA_PATH)
ifneq (, $(findstring MINGW, $(system)))
cmake-gen = -G 'MSYS Makefiles'
endif
# By default cotire enabled
......@@ -62,8 +45,21 @@ else
cmake_cotire = -D WITH_COTIRE=OFF
endif
# Filesystem
build = build/
build-cryptopp = deps/cryptopp/ # No longer using CMake
build-doxygen = doc/Doxygen
# Configure install prefix for superprojects/developers (may as well use CMake directly for this...)
# Note: not to be confused with `make install` which runs an installer script for end-users
ifeq ($(KOVRI_INSTALL_PREFIX),)
install_prefix = $(build)
else
install_prefix = $(KOVRI_INSTALL_PREFIX)
endif
# Our base cmake command
cmake = cmake $(cmake-gen) $(cmake_cotire)
cmake = cmake $(cmake-gen) $(cmake_cotire) -D CMAKE_INSTALL_PREFIX=$(install_prefix)
# Release types
cmake-debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
......@@ -90,11 +86,6 @@ cmake-android = -D ANDROID=1 -D KOVRI_DATA_PATH="/data/local/tmp/.kovri"
cmake-native = -DCMAKE_CXX_FLAGS="-march=native"
cryptopp-native = CXXFLAGS="-march=native -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1" # Refs #699
# Filesystem
build = build/
build-cryptopp = deps/cryptopp/ # No longer using CMake
build-doxygen = doc/Doxygen
# CMake builder macros
define CMAKE
cmake -E make_directory $1
......
......@@ -48,6 +48,8 @@ if (NOT MSVC)
set(BYPRODUCT ${CMAKE_STATIC_LIBRARY_PREFIX}cryptopp${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
message(STATUS "Building Crypto++")
# https://www.cryptopp.com/wiki/GNUmakefile
ExternalProject_Add(cryptopp
SOURCE_DIR ${CRYPTOPP_ROOT}
......@@ -64,6 +66,8 @@ if (NOT MSVC)
IMPORTED_LOCATION "${CRYPTOPP_ROOT}/${BYPRODUCT}"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
set(CryptoPP_LIBRARIES ${CRYPTOPP_ROOT}/${BYPRODUCT})
unset(BYPRODUCT)
unset(ThreadNum)
unset(MAKE_ARGS)
......@@ -109,6 +113,8 @@ else()
set(SED_ARGS_DEBUG "s|<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>|<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>|g")
endif()
message(STATUS "Building Crypto++")
# https://www.cryptopp.com/wiki/Visual_Studio
ExternalProject_Add(cryptopp
SOURCE_DIR ${CRYPTOPP_ROOT}
......@@ -131,9 +137,11 @@ else()
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_CONFIGURATIONS "Debug;Release")
set(CryptoPP_LIBRARIES ${CRYPTOPP_ROOT}/${PLATFORM}/Output/$<CONFIG>/cryptlib.lib)
unset(SED_COMMAND)
unset(MSBUILD_COMMAND)
endif()
unset(library_type)
unset(CRYPTOPP_ROOT)
\ No newline at end of file
unset(CRYPTOPP_ROOT)
# Targets will include libs and headers
include(${CMAKE_CURRENT_LIST_DIR}/KovriTargets.cmake)
# For backwards compat/convenience if needed by client (should be replaced by above targets)
set(Kovri_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
set(Kovri_LIBRARIES ${PROJECT_NAME})
# Copyright (c) 2015-2018, The Kovri I2P Router Project
# Copyright (c) 2015-2019, The Kovri I2P Router Project
#
# All rights reserved.
#
......@@ -47,6 +47,7 @@ endif()
set_property(TARGET libminiupnpc-static APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS MINIUPNP_STATICLIB)
# Use #include <miniupnp/miniupnpc/miniupnpc.h>
set_property(TARGET libminiupnpc-static APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
set_property(TARGET libminiupnpc-static APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
# Suppress warnings from miniupnpc headers
set_property(TARGET libminiupnpc-static APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
set_property(TARGET libminiupnpc-static APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
Subproject commit 6b9b73a567e351b844f96c077f7b752ea92e298a
Subproject commit 5bdb473e3badaedf351bb6fb6eca4419fd3ff888
......@@ -101,7 +101,7 @@ disable-file-log = 0
# ============
#
# Default (with rotation): kovri_0.log, kovri_1.log, etc.
# Default: stored in KOVRI_DATA_DIR
# Default: stored in KOVRI_DATA_PATH
#
# CAUTION: Enter a full path if you choose to customize the filename
#
......@@ -160,7 +160,7 @@ disable-color-log = 0
# Location of tunnels Config file
#
# Default: tunnels.conf
# Default: stored in KOVRI_DATA_DIR
# Default: stored in KOVRI_DATA_PATH
#
#tunnelsconf =
......@@ -249,7 +249,7 @@ disable-ntcp = 0
#
# Note: if the server in your URL is not one of the hard-coded reseed servers,
# either use --enable-https 0 or or put your server's certificate into
# the certificates directory located in KOVRI_DATA_DIR
# the certificates directory located in KOVRI_DATA_PATH
#
#reseed-from =
......
......@@ -115,13 +115,23 @@ shift "$(($OPTIND -1))"
bin_path=$HOME/bin
bin_path_files=(kovri-bash.sh kovri kovri-util)
# TODO(unassigned): these are hacks until the entire install process is moved into CMake.
# These are required for superprojects which are installing via their CMake install (via *their* build).
if [[ -z "$KOVRI_ROOT_DIR" ]]; then
KOVRI_ROOT_DIR="."
fi
if [[ -z "$KOVRI_BUILD_DIR" ]]; then
KOVRI_BUILD_DIR="${KOVRI_ROOT_DIR}/build"
fi
# Set default resources if needed
if [[ -z $resources ]]; then
# TODO: brittle, relies on appropriately placed index
resources=("pkg/client" "pkg/config" \
"contrib/utils/${bin_path_files[0]}" \
"build/${bin_path_files[1]}" \
"build/${bin_path_files[2]}")
resources=("${KOVRI_ROOT_DIR}/pkg/client" "${KOVRI_ROOT_DIR}/pkg/config" \
"${KOVRI_ROOT_DIR}/contrib/utils/${bin_path_files[0]}" \
"${KOVRI_BUILD_DIR}/${bin_path_files[1]}" \
"${KOVRI_BUILD_DIR}/${bin_path_files[2]}")
fi
# Test if resources are available
......@@ -250,7 +260,7 @@ CreatePackage()
if [[ $is_windows == true ]]; then
local _ext=".exe"
fi
package_file="build/${staging_path}${_ext}"
package_file="${KOVRI_BUILD_DIR}/${staging_path}${_ext}"
fi
else
# Ensure proper command line
......@@ -274,7 +284,7 @@ CreatePackage()
fi
"${_program_files}"/Inno\ Setup\ 5/ISCC.exe pkg/installers/windows/Kovri${bitness}.iss
catch "could not create Inno Setup installer"
local _setup_bin="build/KovriSetup${bitness}.exe"
local _setup_bin="${KOVRI_BUILD_DIR}/KovriSetup${bitness}.exe"
echo -n "Moving $_setup_bin to $package_file"
mv $_setup_bin $package_file
catch "could not move package file"
......@@ -353,7 +363,7 @@ if [[ $(tput colors) ]]; then
normal="$(tput sgr0)"
fi
echo "${yellow}The Kovri I2P Router Project (c) 2015-2018${normal}"
echo "${yellow}The Kovri I2P Router Project (c) 2015-2019${normal}"
if [[ $package_option == true ]]; then
CreatePackage
......
......@@ -5,7 +5,8 @@ function(ConfigureBinary BIN_NAME OUT_NAME)
target_link_libraries(${BIN_NAME} PRIVATE
kovri-core
kovri-client
kovri-private)
kovri-internal
pthread)
set_target_properties(${BIN_NAME} PROPERTIES OUTPUT_NAME "${OUT_NAME}")
if(WITH_STATIC)
if(NOT MINGW AND NOT MSVC AND NOT APPLE)
......
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(kovri-client CXX)
add_library(kovri-client
instance.cc
address_book/impl.cc
address_book/storage.cc
api/datagram.cc
api/i2p_control/data.cc
api/i2p_control/server.cc
api/i2p_control/session.cc
api/streaming.cc
context.cc
destination.cc
proxy/http.cc
proxy/socks.cc
reseed.cc
service.cc
tunnel.cc
util/config.cc
util/http.cc
util/json.cc
util/parse.cc
util/zip.cc
util/uri/parser.cc
address_book/impl.h
address_book/storage.h
api/datagram.h
api/i2p_control/data.h
api/i2p_control/server.h
api/i2p_control/session.h
api/streaming.h
context.h
destination.h
instance.h
proxy/http.h
proxy/socks.h
reseed.h
service.h
tunnel.h
util/config.h
util/http.h
util/json.h
util/parse.h
util/zip.h
util/uri/buffer.h
util/uri/error.h
util/uri/parser.h
util/uri/parts.h
util/uri/rfc3986.h)
add_library(kovri-client "")
target_sources(kovri-client
PUBLIC
# API header
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/instance.h>
$<INSTALL_INTERFACE:include/kovri/client/instance.h>
PRIVATE
address_book/impl.cc
address_book/storage.cc
api/datagram.cc
api/i2p_control/data.cc
api/i2p_control/server.cc
api/i2p_control/session.cc
api/streaming.cc
context.cc
destination.cc
instance.cc
proxy/http.cc
proxy/socks.cc
reseed.cc
service.cc
tunnel.cc
util/config.cc
util/http.cc
util/json.cc
util/parse.cc
util/uri/parser.cc
util/zip.cc
target_include_directories(kovri-client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_link_libraries(kovri-client PRIVATE
kovri-core
kovri-private)
address_book/impl.h
address_book/storage.h
api/datagram.h
api/i2p_control/data.h
api/i2p_control/server.h
api/i2p_control/session.h
api/streaming.h
context.h
destination.h
proxy/http.h
proxy/socks.h
reseed.h
service.h
tunnel.h
util/config.h
util/http.h
util/json.h
util/parse.h
util/uri/buffer.h
util/uri/error.h
util/uri/parser.h
util/uri/parts.h
util/uri/rfc3986.h
util/zip.h)
target_include_directories(kovri-client
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include>)
set_target_properties(kovri-client PROPERTIES
PUBLIC_HEADER $<TARGET_PROPERTY:kovri-client,INTERFACE_SOURCES>)
target_link_libraries(kovri-client PUBLIC kovri-core kovri-internal)
if (COMMAND cotire)
set_target_properties(kovri-client PROPERTIES COTIRE_PREFIX_HEADER_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/deps")
cotire(kovri-client)
endif()
install(
TARGETS kovri-client
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR})
# vim: noai:ts=2:sw=2
add_library(kovri::kovri-client ALIAS kovri-client)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(kovri-core CXX)
add_library(kovri-core
instance.cc
router/context.cc
router/garlic.cc
router/i2np.cc
router/identity.cc
router/info.cc
router/lease_set.cc
router/net_db/impl.cc
router/net_db/requests.cc
router/profiling.cc
router/transports/impl.cc
router/transports/ntcp/server.cc
router/transports/ntcp/session.cc
router/transports/ssu/data.cc
router/transports/ssu/packet.cc
router/transports/ssu/server.cc
router/transports/ssu/session.cc
router/transports/upnp.cc
router/tunnel/config.cc
router/tunnel/endpoint.cc
router/tunnel/gateway.cc
router/tunnel/impl.cc
router/tunnel/pool.cc
router/tunnel/transit.cc
util/byte_stream.cc
util/config.cc
util/exception.cc
util/filesystem.cc
util/log.cc
util/mtu.cc
add_library(kovri-core "")
target_sources(kovri-core
PUBLIC
# API header
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/instance.h>
$<INSTALL_INTERFACE:include/kovri/core/instance.h>
PRIVATE
instance.cc
router/context.cc
router/garlic.cc
router/i2np.cc
router/identity.cc
router/info.cc
router/lease_set.cc
router/net_db/impl.cc
router/net_db/requests.cc
router/profiling.cc
router/transports/impl.cc
router/transports/ntcp/server.cc
router/transports/ntcp/session.cc
router/transports/ssu/data.cc
router/transports/ssu/packet.cc
router/transports/ssu/server.cc
router/transports/ssu/session.cc
router/transports/upnp.cc
router/tunnel/config.cc
router/tunnel/endpoint.cc
router/tunnel/gateway.cc
router/tunnel/impl.cc
router/tunnel/pool.cc
router/tunnel/transit.cc
util/byte_stream.cc
util/config.cc
util/exception.cc
util/filesystem.cc
util/log.cc
util/mtu.cc
instance.h
router/context.h
router/garlic.h
router/i2np.h
router/identity.h
router/info.h
router/lease_set.h
router/net_db/impl.h
router/net_db/requests.h
router/profiling.h
router/transports/impl.h
router/transports/ntcp/server.h
router/transports/ntcp/session.h
router/transports/session.h
router/transports/ssu/data.h
router/transports/ssu/packet.h
router/transports/ssu/server.h
router/transports/ssu/session.h
router/transports/upnp.h
router/tunnel/base.h
router/tunnel/config.h
router/tunnel/endpoint.h
router/tunnel/gateway.h
router/tunnel/impl.h
router/tunnel/pool.h
router/tunnel/transit.h
util/buffer.h
util/byte_stream.h
util/config.h
util/exception.h
util/filesystem.h
util/log.h
util/mtu.h
util/queue.h
util/tag.h
util/timestamp.h)
router/context.h
router/garlic.h
router/i2np.h
router/identity.h
router/info.h
router/lease_set.h
router/net_db/impl.h
router/net_db/requests.h
router/profiling.h
router/transports/impl.h
router/transports/ntcp/server.h
router/transports/ntcp/session.h
router/transports/session.h
router/transports/ssu/data.h
router/transports/ssu/packet.h
router/transports/ssu/server.h
router/transports/ssu/session.h
router/transports/upnp.h
router/tunnel/base.h
router/tunnel/config.h
router/tunnel/endpoint.h
router/tunnel/gateway.h
router/tunnel/impl.h
router/tunnel/pool.h
router/tunnel/transit.h
util/buffer.h
util/byte_stream.h
util/config.h
util/exception.h
util/filesystem.h
util/log.h
util/mtu.h
util/queue.h
util/tag.h
util/timestamp.h)
target_include_directories(kovri-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_link_libraries(kovri-core
PUBLIC
Boost::log
PRIVATE
kovri-private
Boost::program_options)
target_include_directories(kovri-core
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include>)
set_target_properties(kovri-core PROPERTIES
PUBLIC_HEADER $<TARGET_PROPERTY:kovri-core,INTERFACE_SOURCES>)
target_link_libraries(kovri-core PUBLIC kovri-internal ${Boost_LIBRARIES})
if(MINGW)
target_link_libraries(kovri-core PUBLIC iphlpapi)
......@@ -131,11 +138,4 @@ if (COMMAND cotire)
cotire(kovri-core)
endif()
# Library building
install(
TARGETS kovri-core
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# vim: noai:ts=2:sw=2
add_library(kovri::kovri-core ALIAS kovri-core)
......@@ -16,7 +16,7 @@ add_executable(kovri-fuzzer
target.h)
target_link_libraries(kovri-fuzzer PRIVATE
kovri-private
kovri-internal
kovri-client)
# Set compiler flags for fuzzing.
......
......@@ -34,7 +34,7 @@ add_library(kovri_integration SHARED
kovri.cc
util.cc)
target_link_libraries(kovri_integration PRIVATE kovri-private
target_link_libraries(kovri_integration PRIVATE kovri-internal
${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
# Use unity targets if they are available
......
......@@ -41,7 +41,7 @@ find_package(Boost REQUIRED COMPONENTS unit_test_framework)
target_link_libraries(kovri-tests PRIVATE
Boost::unit_test_framework
kovri-private
kovri-internal
kovri-client)
if (COMMAND cotire)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment