This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
59 lines (49 loc) · 1.74 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(BinanceChain)
set (CMAKE_CXX_STANDARD 14)
find_package(Boost REQUIRED)
find_package(Protobuf REQUIRED)
include(ExternalProject)
ExternalProject_Add(
nlohmann_json
PREFIX "nlohmann"
URL https://github.com/nlohmann/json/releases/download/v3.5.0/include.zip
URL_HASH SHA256=3564da9c5b0cf2e032f97c69baedf10ddbc98030c337d0327a215ea72259ea21
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_property(nlohmann_json SOURCE_DIR)
set(JSON_INCLUDE_DIR ${SOURCE_DIR})
ExternalProject_Add(
pcg
PREFIX "pcg"
URL http://www.pcg-random.org/downloads/pcg-cpp-0.98.zip
URL_HASH SHA256=de46a88aad4dfe54ef53f66beba56fd0ab3e94aaaa9860cd828b3f1daee13aaf
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_property(pcg SOURCE_DIR)
set(PCG_INCLUDE_DIR ${SOURCE_DIR}/include)
# Protobuf
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS src/dex.proto)
# Source files
file(GLOB_RECURSE sources src/crypto/*.c src/crypto/*.h src/*.cpp src/*.h)
add_library(BinanceChain ${sources} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(BinanceChain PRIVATE protobuf Boost::boost)
add_dependencies(BinanceChain nlohmann_json pcg)
# Define headers for this library. PUBLIC headers are used for compiling the
# library, and will be added to consumers' build paths.
target_include_directories(BinanceChain
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${JSON_INCLUDE_DIR}
${PCG_INCLUDE_DIR}
)
add_subdirectory(tests)