-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdependencies.cmake
135 lines (113 loc) · 3.12 KB
/
dependencies.cmake
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
set(CMAKE_FOLDER external)
include(FetchContent)
# These options are defined in the restbed library, which we don't control
# cmake-lint: disable=C0103
set(BUILD_SSL
OFF
CACHE INTERNAL "")
set(BUILD_TESTS
OFF
CACHE INTERNAL "")
set(FETCHCONTENT_QUIET
OFF
CACHE INTERNAL "")
# These options are defined in the cpr library, which we don't control
# cmake-lint: disable=C0103
set(BUILD_SHARED_LIBS
OFF
CACHE INTERNAL "")
# cxxopts Library
FetchContent_Declare(
cxxopts
GIT_REPOSITORY https://github.com/jarro2783/cxxopts
GIT_TAG v3.0.0)
# Restbed Library
FetchContent_Declare(
restbed
GIT_REPOSITORY https://github.com/Corvusoft/restbed
GIT_TAG 4.8)
# CPR Library
FetchContent_Declare(
cpr
GIT_REPOSITORY https://github.com/libcpr/cpr
GIT_TAG 1.9.3)
# JSON Library
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.11.2)
# Valijson Library
FetchContent_Declare(
valijson
GIT_REPOSITORY https://github.com/tristanpenman/valijson
GIT_TAG v1.0)
# BLST Library
FetchContent_Declare(
blst
GIT_REPOSITORY https://github.com/supranational/blst
GIT_TAG v0.3.10)
# BLST Library
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-1.12.1)
# csprng Library
FetchContent_Declare(
csprng
GIT_REPOSITORY https://github.com/Duthomhas/CSPRNG
GIT_TAG 8768a94b4b04213c0798b80824a04ae4990e9847)
# Abseil Library
FetchContent_Declare(
abseil
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
GIT_TAG 20230125.0)
# OpenSSL Library
FetchContent_Declare(
openssl
GIT_REPOSITORY https://github.com/openssl/openssl
GIT_TAG openssl-3.0.8)
# Download and extract dependencies.
FetchContent_MakeAvailable(
cxxopts
restbed
cpr
json
valijson
blst
googletest
abseil)
# csprng has a broken CMakeLists.txt file, so manually download it instead
FetchContent_Populate(csprng)
# OpenSSL doesn't support CMake
FetchContent_Populate(openssl)
if(WIN32)
set(LIB_BLST_PATH ${blst_BINARY_DIR}/blst.lib)
set(BLST_BUILD_SCRIPT_PATH ${blst_SOURCE_DIR}/build.bat)
else()
set(LIB_BLST_PATH ${blst_BINARY_DIR}/libblst.a)
set(BLST_BUILD_SCRIPT_PATH ${blst_SOURCE_DIR}/build.sh)
endif(WIN32)
add_custom_command(
OUTPUT ${LIB_BLST_PATH}
WORKING_DIRECTORY ${blst_BINARY_DIR}
COMMAND ${BLST_BUILD_SCRIPT_PATH} -D__BLST_PORTABLE__ -w
COMMENT "Building libblst")
add_custom_target(
libblst
DEPENDS ${LIB_BLST_PATH}
COMMENT "Creating libblst target")
add_library(
gtest_static STATIC
${googletest_SOURCE_DIR}/googletest/src/gtest-all.cc
${googletest_SOURCE_DIR}/googletest/src/gtest_main.cc
${googletest_SOURCE_DIR}/googlemock/src/gmock-all.cc
${googletest_SOURCE_DIR}/googlemock/src/gmock_main.cc)
target_include_directories(
gtest_static
PRIVATE ${googletest_SOURCE_DIR}/googletest
${googletest_SOURCE_DIR}/googletest/include
${googletest_SOURCE_DIR}/googlemock
${googletest_SOURCE_DIR}/googlemock/include)
# Build the csprng library
add_library(csprng STATIC ${csprng_SOURCE_DIR}/source/csprng.cpp)
target_include_directories(csprng PRIVATE ${csprng_SOURCE_DIR}/source)