forked from decenomy/SAPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
563 lines (525 loc) · 19.2 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
cmake_minimum_required(VERSION 3.10)
# Search for and use ccache if available to speed up build times
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Found ccache: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
# Set up wrapper scripts
set(C_LAUNCHER "${CCACHE_PROGRAM}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
endif()
# Search for the cargo and rustc compilers required to build libzcashrust
find_program(CARGO_PROGRAM cargo REQUIRED)
if(CARGO_PROGRAM)
message(STATUS "Found cargo: ${CARGO_PROGRAM}")
endif()
find_program(RUSTC_PROGRAM rustc REQUIRED)
if(RUSTC_PROGRAM)
message(STATUS "Found rustc: ${RUSTC_PROGRAM}")
endif()
project(PIVX)
set(BDB_VER "4.8.30")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/contrib/cmake")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
message(FATAL_ERROR "Native Windows CMake is not supported yet, use WSL instead")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "Compiling on macOS")
set(ENV{target} "Mac")
add_definitions("-DMAC_OSX")
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/qt5)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/[email protected])
list(APPEND CMAKE_PREFIX_PATH /usr/local/Cellar/berkeley-db@4)
#set(OPENSSL_ROOT_DIR "/usr/local/opt/[email protected]/")
#set(ENV{CPPFLAGS} "-I${OPENSSL_ROOT_DIR}/include")
#set(ENV{LDFLAGS} "-L${OPENSSL_ROOT_DIR}/lib")
set(BerkeleyDB_ROOT_DIR "/usr/local/Cellar/berkeley-db@4/${BDB_VER}/")
set(Boost_USE_MULTITHREADED ON)
set(Boost_NO_BOOST_CMAKE ON)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(ENV{target} "Linux")
file(READ "/proc/version" _SYS_VERSION)
string(REGEX MATCH "Microsoft" _SYSTEM_VERSION_PARSED "${_SYS_VERSION}")
if(${_SYSTEM_VERSION_PARSED} MATCHES "Microsoft")
message(STATUS "Compiling on WSL")
set(ENV{DISPLAY} ":0")
set(ENV{LIBGL_ALWAYS_INDIRECT} 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY /home/$ENV{USER}/pivx-run)
message(WARNING "WSL Runtime support requires VcXsrv to be installed and running")
else()
message(STATUS "Compiling on Linux")
endif()
list(APPEND CMAKE_PREFIX_PATH /usr/lib/x86_64-linux-gnu/cmake/Qt5)
set(Qt5core_DIR "/usr/lib/x86_64-linux-gnu/cmake/Qt5/QtCore")
find_path(ENDIAN_INCLUDES endian.h)
if(ENDIAN_INCLUDES)
message(STATUS "Found endian.h: ${ENDIAN_INCLUDES}")
endif()
#add_definitions("-D__BYTE_ORDER -D__LITTLE_ENDIAN -D__GLIBC__ -DHAVE_DECL_BSWAP_16=0 -DHAVE_DECL_BSWAP_32=0 -DHAVE_DECL_BSWAP_64=0")
endif()
# Find Dependencies
find_package(BerkeleyDB ${BDB_VER} REQUIRED)
if(BerkeleyDB_FOUND)
if(NOT ${BerkeleyDB_VERSION} MATCHES "${BDB_VER}")
message(WARNING "BerkeleyDB version other than ${BDB_VER} found!")
set(BDB_CONFIGURE_FLAGS "--with-incompatible-bdb")
endif()
endif()
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
message(STATUS "Found OpenSSL (${OPENSSL_VERSION}): ${OPENSSL_LIBRARIES}")
if(OPENSSL_VERSION VERSION_GREATER_EQUAL 1.1)
message(STATUS "Found unsupported OpenSSL version!")
set(SSL_CONFIGURE_FLAGS "--with-unsupported-ssl")
endif()
endif()
find_package(LibEvent REQUIRED)
find_package(GMP)
if(GMP_FOUND)
else()
message(WARNING "GMP not found, falling back to OpenSSL for bignum!")
set(BIGNUM_CONFIGURE_FLAGS "--with-zerocoin-bignum=openssl")
endif()
find_package(ZMQ)
find_package(Miniupnp)
find_package(Boost COMPONENTS system filesystem thread program_options REQUIRED)
find_package(Sodium REQUIRED)
# run autogen.sh if missing header files from configure on Linux/Mac
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/configure")
else()
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/autogen.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
# run configure if pivx_config.h doesn't exist
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/config/pivx-config.h")
else()
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure ${CONFIGSITE} ${BDB_CONFIGURE_FLAGS} ${BIGNUM_CONFIGURE_FLAGS} ${SSL_CONFIGURE_FLAGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
add_definitions(-DHAVE_CONFIG_H)
ExternalProject_Add (
libunivalue
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/univalue
CONFIGURE_COMMAND ""
BUILD_COMMAND $(MAKE)
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
ExternalProject_Add (
libzcashrust
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CARGO_PROGRAM} build --release
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
ExternalProject_Add (
libsecp256k1
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/secp256k1
CONFIGURE_COMMAND ""
BUILD_COMMAND $(MAKE)
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
set(CRC32C_BUILD_TESTS OFF CACHE BOOL "Build CRC32C's unit tests" FORCE)
set(CRC32C_BUILD_BENCHMARKS OFF CACHE BOOL "Build CRC32C's benchmarks" FORCE)
set(CRC32C_USE_GLOG OFF CACHE BOOL "Build CRC32C's tests with Google Logging" FORCE)
set(CRC32C_INSTALL OFF CACHE BOOL "Install CRC32C's header and library" FORCE)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/crc32c)
set(LEVELDB_BUILD_TESTS OFF CACHE BOOL "Build LevelDB's unit tests" FORCE)
set(LEVELDB_BUILD_BENCHMARKS OFF CACHE BOOL "Build LevelDB's benchmarks" FORCE)
set(LEVELDB_INSTALL OFF CACHE BOOL "Install LevelDB's header and library" FORCE)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/leveldb)
file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
file(GLOB CRYPTO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/crypto/*.h)
file(GLOB PRIMITIVE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/primitives/*.h)
file(GLOB ZMQ_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/zmq/*.h)
file(GLOB SCRIPT_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/script/*.h)
file(GLOB RPC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/rpc/*.h)
file(GLOB COMPAT_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/compat/*.h)
file(GLOB CONSENSUS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/*.h)
file(GLOB CTAES_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/crypto/ctaes/*.h)
file(GLOB ZRUST_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/rust/include/*.h)
file(GLOB SAPLING_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/sapling/*.h)
source_group("BitcoinHeaders" FILES
${HEADERS}
${CRYPTO_HEADERS}
${PRIMITIVE_HEADERS}
${ZMQ_HEADERS}
${SCRIPT_HEADERS}
${RPC_HEADERS}
${COMPAT_HEADERS}
${CONSENSUS_HEADERS}
${CTAES_HEADERS}
${ZRUST_HEADERS}
${SAPLING_HEADERS}
./src/support/cleanse.h
)
set(SERVER_SOURCES
./src/addrdb.cpp
./src/addrman.cpp
./src/bloom.cpp
./src/blocksignature.cpp
./src/chain.cpp
./src/checkpoints.cpp
./src/httprpc.cpp
./src/httpserver.cpp
./src/init.cpp
./src/interface/wallet.cpp
./src/dbwrapper.cpp
./src/legacy/validation_zerocoin_legacy.cpp
./src/main.cpp
./src/merkleblock.cpp
./src/miner.cpp
./src/net.cpp
./src/noui.cpp
./src/policy/fees.cpp
./src/policy/policy.cpp
./src/pow.cpp
./src/rest.cpp
./src/rpc/blockchain.cpp
./src/rpc/masternode.cpp
./src/rpc/budget.cpp
./src/rpc/mining.cpp
./src/rpc/misc.cpp
./src/rpc/net.cpp
./src/rpc/rawtransaction.cpp
./src/rpc/server.cpp
./src/script/sigcache.cpp
./src/script/ismine.cpp
./src/sporkdb.cpp
./src/timedata.cpp
./src/torcontrol.cpp
./src/txdb.cpp
./src/txmempool.cpp
./src/validationinterface.cpp
./src/zpivchain.cpp
)
add_library(SERVER_A STATIC ${BitcoinHeaders} ${SERVER_SOURCES})
if(MINIUPNP_FOUND)
target_compile_definitions(SERVER_A PUBLIC "-DSTATICLIB -DMINIUPNP_STATICLIB")
endif()
target_include_directories(SERVER_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/include
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/helpers/memenv
${CMAKE_CURRENT_SOURCE_DIR}/src/rust/include
${ZMQ_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${BerkeleyDB_INCLUDE_DIRS}
)
if(ZMQ_FOUND)
set(ZMQ_SOURCES
./src/zmq/zmqabstractnotifier.cpp
./src/zmq/zmqnotificationinterface.cpp
./src/zmq/zmqpublishnotifier.cpp
)
add_library(ZMQ_A STATIC ${BitcoinHeaders} ${ZMQ_SOURCES} ${ZMQ_LIB})
target_include_directories(ZMQ_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${ZMQ_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
target_compile_definitions(ZMQ_A PUBLIC "-DZMQ_STATIC")
endif()
set(WALLET_SOURCES
./src/activemasternode.cpp
./src/bip38.cpp
./src/denomination_functions.cpp
./src/wallet/db.cpp
./src/addressbook.cpp
./src/crypter.cpp
./src/swifttx.cpp
./src/masternode.cpp
./src/masternode-budget.cpp
./src/masternode-payments.cpp
./src/masternode-sync.cpp
./src/masternodeconfig.cpp
./src/masternodeman.cpp
./src/messagesigner.cpp
./src/zpiv/mintpool.cpp
./src/wallet/hdchain.cpp
./src/wallet/rpcdump.cpp
./src/zpiv/deterministicmint.cpp
./src/zpiv/zerocoin.cpp
./src/wallet/scriptpubkeyman.cpp
./src/wallet/rpcwallet.cpp
./src/kernel.cpp
./src/legacy/stakemodifier.cpp
./src/wallet/wallet.cpp
./src/wallet/wallet_zerocoin.cpp
./src/wallet/walletdb.cpp
./src/zpiv/zpivwallet.cpp
./src/zpiv/zpivtracker.cpp
./src/zpiv/zpivmodule.cpp
./src/zpiv/zpos.cpp
./src/stakeinput.cpp
)
add_library(WALLET_A STATIC ${BitcoinHeaders} ${WALLET_SOURCES})
target_include_directories(WALLET_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/secp256k1/include
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/include
${OPENSSL_INCLUDE_DIR}
${BerkeleyDB_INCLUDE_DIRS}
)
set(BITCOIN_CRYPTO_SOURCES
./src/crypto/aes.cpp
./src/crypto/sha1.cpp
./src/crypto/sha256.cpp
./src/crypto/sha512.cpp
./src/crypto/chacha20.cpp
./src/crypto/hmac_sha256.cpp
./src/crypto/rfc6979_hmac_sha256.cpp
./src/crypto/hmac_sha512.cpp
./src/crypto/scrypt.cpp
./src/crypto/ripemd160.cpp
./src/crypto/aes_helper.c
./src/crypto/blake.c
./src/crypto/bmw.c
./src/crypto/groestl.c
./src/crypto/jh.c
./src/crypto/keccak.c
./src/crypto/skein.c
./src/crypto/common.h
./src/crypto/sha256.h
./src/crypto/sha512.h
./src/crypto/chacha20.h
./src/crypto/hmac_sha256.h
./src/crypto/rfc6979_hmac_sha256.h
./src/crypto/hmac_sha512.h
./src/crypto/scrypt.h
./src/crypto/sha1.h
./src/crypto/ripemd160.h
./src/crypto/sph_blake.h
./src/crypto/sph_bmw.h
./src/crypto/sph_groestl.h
./src/crypto/sph_jh.h
./src/crypto/sph_keccak.h
./src/crypto/sph_skein.h
./src/crypto/sph_types.h
)
add_library(BITCOIN_CRYPTO_A STATIC ${BITCOIN_CRYPTO_SOURCES})
target_include_directories(BITCOIN_CRYPTO_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${OPENSSL_INCLUDE_DIR})
set(ZEROCOIN_SOURCES
./src/libzerocoin/Accumulator.h
./src/libzerocoin/bignum.h
./src/libzerocoin/bignum.cpp
./src/libzerocoin/Coin.h
./src/libzerocoin/CoinRandomnessSchnorrSignature.h
./src/libzerocoin/CoinSpend.h
./src/libzerocoin/Commitment.h
./src/libzerocoin/Denominations.h
./src/libzerocoin/ParamGeneration.h
./src/libzerocoin/Params.h
./src/libzerocoin/SpendType.h
./src/libzerocoin/ZerocoinDefines.h
./src/libzerocoin/Accumulator.cpp
./src/libzerocoin/Coin.cpp
./src/libzerocoin/CoinRandomnessSchnorrSignature.cpp
./src/libzerocoin/Denominations.cpp
./src/libzerocoin/CoinSpend.cpp
./src/libzerocoin/ParamGeneration.cpp
./src/libzerocoin/Params.cpp
)
if(GMP_FOUND)
list(APPEND ZEROCOIN_SOURCES ./src/libzerocoin/bignum_gmp.cpp)
else()
list(APPEND ZEROCOIN_SOURCES ./src/libzerocoin/bignum_openssl.cpp)
endif()
add_library(ZEROCOIN_A STATIC ${ZEROCOIN_SOURCES})
target_include_directories(ZEROCOIN_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${OPENSSL_INCLUDE_DIR}
)
set(COMMON_SOURCES
./src/allocators.cpp
./src/amount.cpp
./src/base58.cpp
./src/bip38.cpp
./src/consensus/params.cpp
./src/consensus/upgrades.cpp
./src/chainparams.cpp
./src/coins.cpp
./src/key_io.cpp
./src/compressor.cpp
./src/consensus/merkle.cpp
./src/consensus/tx_verify.cpp
./src/consensus/zerocoin_verify.cpp
./src/primitives/block.cpp
./src/zpiv/deterministicmint.cpp
./src/primitives/transaction.cpp
./src/zpiv/zerocoin.cpp
./src/core_read.cpp
./src/core_write.cpp
./src/hash.cpp
./src/invalid.cpp
./src/key.cpp
./src/keystore.cpp
./src/netaddress.cpp
./src/netbase.cpp
./src/protocol.cpp
./src/pubkey.cpp
./src/scheduler.cpp
./src/script/interpreter.cpp
./src/script/script.cpp
./src/script/sign.cpp
./src/script/standard.cpp
./src/script/script_error.cpp
./src/spork.cpp
./src/sporkdb.cpp
)
add_library(COMMON_A STATIC ${BitcoinHeaders} ${COMMON_SOURCES})
target_include_directories(COMMON_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/secp256k1/include
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/include
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
${OPENSSL_INCLUDE_DIR}
${BerkeleyDB_INCLUDE_DIRS}
)
set(UTIL_SOURCES
./src/allocators.cpp
./src/compat/strnlen.cpp
./src/compat/glibc_sanity.cpp
./src/compat/glibcxx_sanity.cpp
./src/chainparamsbase.cpp
./src/clientversion.cpp
./src/fs.cpp
./src/logging.cpp
./src/random.cpp
./src/rpc/protocol.cpp
./src/sync.cpp
./src/threadinterrupt.cpp
./src/blob_uint256.cpp
./src/arith_uint256.cpp
./src/uint256.cpp
./src/util/threadnames.cpp
./src/util.cpp
./src/utilstrencodings.cpp
./src/utilmoneystr.cpp
./src/utiltime.cpp
./src/support/cleanse.cpp
)
add_library(UTIL_A STATIC ${BitcoinHeaders} ${UTIL_SOURCES})
target_include_directories(UTIL_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
${CMAKE_CURRENT_SOURCE_DIR}/src/rust/include
${OPENSSL_INCLUDE_DIR}
)
set(CLI_A_SOURCES ./src/rpc/client.cpp)
add_library(CLI_A STATIC ${BitcoinHeaders} ${CLI_A_SOURCES})
target_include_directories(CLI_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
)
set(SAPLING_SOURCES
./src/bech32.cpp
./src/sapling/util.cpp
./src/sapling/key_io_sapling.cpp
./src/sapling/prf.cpp
./src/sapling/noteencryption.cpp
./src/sapling/address.cpp
./src/sapling/note.cpp
./src/sapling/zip32.cpp
./src/sapling/crypter_sapling.cpp
./src/sapling/saplingscriptpubkeyman.cpp
)
add_library(SAPLING_A STATIC ${BitcoinHeaders} ${SAPLING_SOURCES})
target_include_directories(SAPLING_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/sapling
${CMAKE_CURRENT_SOURCE_DIR}/src/rust/include
${OPENSSL_INCLUDE_DIR}
${BerkeleyDB_INCLUDE_DIRS}
)
link_directories(
${CMAKE_SOURCE_DIR}/src/univalue/.libs
${CMAKE_SOURCE_DIR}/src/secp256k1/.libs
${CMAKE_SOURCE_DIR}/target/release
)
link_directories(${CMAKE_BINARY_DIR})
set(pivx-cli_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivx-cli.cpp)
if($ENV{target} MATCHES "Windows")
list(APPEND pivx-cli_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivx-cli-res.rc)
endif()
add_executable(pivx-cli ${pivx-cli_SOURCES})
add_dependencies(pivx-cli libunivalue libzcashrust)
target_link_libraries(pivx-cli
CLI_A
univalue
UTIL_A
BITCOIN_CRYPTO_A
SAPLING_A
rustzcash
${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} -ldl pthread
)
if($ENV{target} MATCHES "Windows")
target_link_libraries(pivx-cli ${WINDOWS_LDADD})
endif()
set(pivx-tx_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivx-tx.cpp)
if($ENV{target} MATCHES "Windows")
list(APPEND pivx-tx_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivx-tx-res.rc)
endif()
add_executable(pivx-tx ${pivx-tx_SOURCES})
add_dependencies(pivx-tx libunivalue libsecp256k1 libzcashrust)
target_link_libraries(pivx-tx
univalue
COMMON_A
ZEROCOIN_A
UTIL_A
BITCOIN_CRYPTO_A
secp256k1
SAPLING_A
rustzcash
${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} -ldl pthread
)
if($ENV{target} MATCHES "Windows")
target_link_libraries(pivx-tx ${WINDOWS_LDADD})
endif()
if(GMP_FOUND)
target_link_libraries(pivx-tx ${GMP_LIBRARY})
endif()
set(pivxd_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivxd.cpp)
if($ENV{target} MATCHES "Windows")
list(APPEND pivxd_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/pivxd-res.rc)
endif()
add_executable(pivxd ${pivxd_SOURCES} ${BitcoinHeaders})
add_dependencies(pivxd libunivalue libsecp256k1 libzcashrust leveldb crc32c)
target_include_directories(pivxd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/include
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/helpers/memenv
${LIBEVENT_INCLUDE_DIR})
target_link_libraries(pivxd
pthread
SERVER_A
WALLET_A
COMMON_A
univalue
ZEROCOIN_A
UTIL_A
SAPLING_A
BITCOIN_CRYPTO_A
leveldb
crc32c
secp256k1
rustzcash
${BerkeleyDB_LIBRARIES} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${LIBEVENT_LIB} pthread
)
if($ENV{target} MATCHES "Windows")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wstack-protector -fstack-protector-all -fPIE -pipe -O2 -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -pie --static")
target_link_libraries(pivxd ${WINDOWS_LDADD})
endif()
if(GMP_FOUND)
target_link_libraries(pivxd ${GMP_LIBRARY})
target_include_directories(pivxd PUBLIC ${GMP_INCLUDE_DIR})
endif()
if(ZMQ_FOUND)
target_link_libraries(pivxd ZMQ_A ${ZMQ_LIB})
target_include_directories(pivxd PUBLIC ${ZMQ_INCLUDE_DIR})
endif()
if(MINIUPNP_FOUND)
target_compile_definitions(pivxd PUBLIC "-DSTATICLIB -DMINIUPNP_STATICLIB")
target_link_libraries(pivxd ${MINIUPNP_LIBRARY})
target_include_directories(pivxd PUBLIC ${MINIUPNP_INCLUDE_DIR})
endif()
target_link_libraries(pivxd ${sodium_LIBRARY_RELEASE} -ldl -lpthread)
add_subdirectory(src/qt)