forked from majestrate/libonionrequests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (67 loc) · 2.29 KB
/
CMakeLists.txt
File metadata and controls
90 lines (67 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.10) # bionic's cmake version
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "macOS deployment target (Apple clang only)")
set(LANGS CXX C)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
foreach(lang ${LANGS})
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/ccache")
message(STATUS "Enabling ccache for ${lang}")
set(CMAKE_${lang}_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "")
endif()
endforeach()
endif()
project(onionrequests
VERSION 0.0.3
DESCRIPTION "libonionrequests - onionrequests library in C++ with some nice wrappers that dont suck that much"
LANGUAGES ${LANGS})
find_package(PkgConfig REQUIRED)
include(CheckCXXSourceCompiles)
include(CheckLibraryExists)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(WITH_PYBIND "build pybind module" OFF)
option(WITH_NODEJS "build nodejs native bindings" OFF)
option(WITH_JNI "build jni bindings" OFF)
pkg_check_modules(OXENMQ liboxenmq IMPORTED_TARGET REQUIRED)
pkg_check_modules(CRYPTO libcrypto IMPORTED_TARGET REQUIRED)
pkg_check_modules(OXENC liboxenc>=1.0.1 IMPORTED_TARGET REQUIRED)
pkg_check_modules(SPDLOG spdlog IMPORTED_TARGET REQUIRED)
find_package(nlohmann_json REQUIRED)
add_subdirectory(external)
add_library(onionreq
onionreq/channel_encryption.cpp
onionreq/consensus.cpp
onionreq/junk.cpp
onionreq/key_types.cpp
onionreq/signature.cpp
onionreq/sogs_info.cpp
onionreq/snode_info.cpp
onionreq/transport.cpp
onionreq/onion_maker.cpp
onionreq/signal-xed25519.cpp)
target_compile_options(onionreq PUBLIC -fPIC)
target_link_libraries(onionreq PUBLIC
PkgConfig::SPDLOG
PkgConfig::OXENMQ
PkgConfig::CRYPTO
nlohmann_json::nlohmann_json
libsodium-internal)
target_include_directories(onionreq PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(onionreq PRIVATE libsodium-internal)
add_subdirectory(docs)
if(WITH_PYBIND)
add_subdirectory(pybind)
endif()
if(WITH_NODEJS)
add_subdirectory(nodejs)
endif()
if(WITH_JNI)
add_subdirectory(jni)
endif()
option(WITH_TESTS "build tests" ON)
if(WITH_TESTS)
add_subdirectory(tests)
endif()