-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
653 lines (611 loc) · 22.3 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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
cmake_minimum_required(VERSION 3.14)
# 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 HINTS ~/.cargo/bin)
if(CARGO_PROGRAM)
message(STATUS "Found cargo: ${CARGO_PROGRAM}")
endif()
find_program(RUSTC_PROGRAM rustc REQUIRED HINTS ~/.cargo/bin)
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 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 ")
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 /opt/homebrew/opt/qt5)
list(APPEND CMAKE_PREFIX_PATH /usr/local/Cellar/berkeley-db@4 /opt/homebrew/Cellar/berkeley-db@4)
# Homebrew default path for apple silicon CPUs is different than for intel CPUs
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm")
set(BerkeleyDB_ROOT_DIR "/opt/homebrew/Cellar/berkeley-db@4/${BDB_VER}/")
else()
set(BerkeleyDB_ROOT_DIR "/usr/local/Cellar/berkeley-db@4/${BDB_VER}/" )
endif()
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(LibEvent REQUIRED)
find_package(GMP REQUIRED)
find_package(ZMQ)
find_package(Miniupnp)
find_package(NAT-PMP)
find_package(Boost COMPONENTS system filesystem thread 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}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
# error out if configure fails
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/config/pivx-config.h")
else()
execute_process(COMMAND cat config.log WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
message(FATAL_ERROR "configure script didn't finish properly see config.log output above")
endif()
add_definitions(-DHAVE_CONFIG_H)
# Option to enable debug flags. append `-DDEBUG=ON` to your cmake command
# Ex: `cmake -DDEBUG=ON ..`
option(DEBUG "Use debug compiler flags and macros" OFF)
if(DEBUG)
add_definitions(-DDEBUG -DDEBUG_LOCKORDER)
endif()
# Check for thread_local support in the compiler.
# This is required for DEBUG_LOCKCONTENTION
include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#if defined(_MSC_VER) && !defined(__thread)
#define __thread __declspec(thread)
#endif
int main() {
static __thread int tls;
(void)tls;
}
" HAVE_THREAD_LOCAL)
if(HAVE_THREAD_LOCAL)
add_definitions(-DHAVE_THREAD_LOCAL)
if(DEBUG)
add_definitions(-DDEBUG_LOCKCONTENTION)
endif()
endif()
unset(DEBUG CACHE)
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)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/chiabls)
FetchContent_GetProperties(relic)
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)
file(GLOB IMMER_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/immer/*.h)
file(GLOB EVO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/evo/*.h)
file(GLOB BLS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/bls/*.h)
file(GLOB LLMQ_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/llmq/*.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}
${IMMER_HEADERS}
${EVO_HEADERS}
${BLS_HEADERS}
${LLMQ_HEADERS}
./src/support/cleanse.h
./src/support/events.h
)
set(SERVER_SOURCES
./src/addrdb.cpp
./src/addrman.cpp
./src/bloom.cpp
./src/blocksignature.cpp
./src/chain.cpp
./src/checkpoints.cpp
./src/consensus/tx_verify.cpp
./src/flatfile.cpp
./src/httprpc.cpp
./src/httpserver.cpp
./src/indirectmap.h
./src/init.cpp
./src/tiertwo/init.cpp
./src/interfaces/handler.cpp
./src/interfaces/wallet.cpp
./src/dbwrapper.cpp
./src/legacy/validation_zerocoin_legacy.cpp
./src/mapport.cpp
./src/merkleblock.cpp
./src/miner.cpp
./src/blockassembler.cpp
./src/net.cpp
./src/net_processing.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/rpcevo.cpp
./src/rpc/rpcquorums.cpp
./src/rpc/server.cpp
./src/script/sigcache.cpp
./src/script/ismine.cpp
./src/shutdown.cpp
./src/sporkdb.cpp
./src/timedata.cpp
./src/torcontrol.cpp
./src/sapling/sapling_txdb.cpp
./src/sapling/sapling_validation.cpp
./src/txdb.cpp
./src/txmempool.cpp
./src/validation.cpp
./src/validationinterface.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
${CMAKE_CURRENT_SOURCE_DIR}/src/chiabls/src
${relic_SOURCE_DIR}/include
${relic_BINARY_DIR}/include
${ZMQ_INCLUDE_DIR} ${LIBEVENT_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})
target_compile_definitions(ZMQ_A PUBLIC "-DZMQ_STATIC")
endif()
set(WALLET_SOURCES
./src/bip38.cpp
./src/wallet/db.cpp
./src/addressbook.cpp
./src/crypter.cpp
./src/wallet/hdchain.cpp
./src/wallet/rpcdump.cpp
./src/wallet/fees.cpp
./src/wallet/init.cpp
./src/wallet/scriptpubkeyman.cpp
./src/wallet/rpcwallet.cpp
./src/kernel.cpp
./src/legacy/stakemodifier.cpp
./src/wallet/wallet.cpp
./src/wallet/walletdb.cpp
./src/wallet/walletutil.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
${CMAKE_CURRENT_SOURCE_DIR}/src/chiabls/src
${relic_SOURCE_DIR}/include
${relic_BINARY_DIR}/include
${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/sha3.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/siphash.cpp
./src/crypto/siphash.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)
set(ZEROCOIN_SOURCES
./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/Coin.cpp
./src/libzerocoin/CoinRandomnessSchnorrSignature.cpp
./src/libzerocoin/Denominations.cpp
./src/libzerocoin/CoinSpend.cpp
./src/libzerocoin/ParamGeneration.cpp
./src/libzerocoin/Params.cpp
)
add_library(ZEROCOIN_A STATIC ${ZEROCOIN_SOURCES})
target_include_directories(ZEROCOIN_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(COMMON_SOURCES
./src/activemasternode.cpp
./src/base58.cpp
./src/bip38.cpp
./src/bls/bls_ies.cpp
./src/bls/bls_worker.cpp
./src/bls/bls_wrapper.cpp
./src/bls/key_io.cpp
./src/budget/budgetdb.cpp
./src/budget/budgetmanager.cpp
./src/budget/budgetproposal.cpp
./src/budget/budgetvote.cpp
./src/budget/finalizedbudget.cpp
./src/budget/finalizedbudgetvote.cpp
./src/budget/budgetutil.cpp
./src/consensus/params.cpp
./src/consensus/upgrades.cpp
./src/chainparams.cpp
./src/coins.cpp
./src/key_io.cpp
./src/compressor.cpp
./src/evo/deterministicmns.cpp
./src/evo/evonotificationinterface.cpp
./src/evo/evodb.cpp
./src/evo/providertx.cpp
./src/evo/specialtx_validation.cpp
./src/llmq/quorums_blockprocessor.cpp
./src/llmq/quorums_commitment.cpp
./src/llmq/quorums_connections.cpp
./src/llmq/quorums_debug.cpp
./src/llmq/quorums_dkgsessionhandler.cpp
./src/llmq/quorums_dkgsessionmgr.cpp
./src/llmq/quorums_dkgsession.cpp
./src/llmq/quorums_init.cpp
./src/llmq/quorums_utils.cpp
./src/consensus/merkle.cpp
./src/consensus/zerocoin_verify.cpp
./src/primitives/block.cpp
./src/primitives/transaction.cpp
./src/core_read.cpp
./src/core_write.cpp
./src/hash.cpp
./src/invalid.cpp
./src/key.cpp
./src/keystore.cpp
./src/masternode.cpp
./src/masternode-payments.cpp
./src/masternode-sync.cpp
./src/masternodeconfig.cpp
./src/masternodeman.cpp
./src/messagesigner.cpp
./src/netaddress.cpp
./src/netbase.cpp
./src/policy/feerate.cpp
./src/protocol.cpp
./src/pubkey.cpp
./src/saltedhasher.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
./src/tiertwo_networksync.cpp
./src/tiertwo/masternode_meta_manager.cpp
./src/evo/mnauth.cpp
./src/tiertwo/net_masternodes.cpp
./src/tiertwo/netfulfilledman.cpp
./src/tiertwo/tiertwo_sync_state.cpp
./src/warnings.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
${CMAKE_CURRENT_SOURCE_DIR}/src/chiabls/src
${relic_SOURCE_DIR}/include
${relic_BINARY_DIR}/include
${BerkeleyDB_INCLUDE_DIRS}
)
set(UTIL_SOURCES
./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/randomenv.cpp
./src/rpc/protocol.cpp
./src/sync.cpp
./src/threadinterrupt.cpp
./src/arith_uint256.cpp
./src/uint256.cpp
./src/util/asmap.cpp
./src/util/threadnames.cpp
./src/util/blockstatecatcher.h
./src/util/system.cpp
./src/util/validation.cpp
./src/utilstrencodings.cpp
./src/utilmoneystr.cpp
./src/utiltime.cpp
./src/support/lockedpool.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
)
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/sapling_util.cpp
./src/sapling/key_io_sapling.cpp
./src/destination_io.cpp
./src/sapling/sapling_core_write.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/incrementalmerkletree.cpp
./src/sapling/transaction_builder.cpp
./src/sapling/saplingscriptpubkeyman.cpp
./src/sapling/sapling_operation.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
${CMAKE_CURRENT_SOURCE_DIR}/src/univalue/include
${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 bls)
target_link_libraries(pivx-cli
CLI_A
univalue
UTIL_A
BITCOIN_CRYPTO_A
SAPLING_A
rustzcash
bls
${Boost_LIBRARIES} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} -ldl pthread
)
if($ENV{target} MATCHES "Windows")
target_link_libraries(pivx-cli ${WINDOWS_LDADD})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(pivx-cli "-framework Cocoa")
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 bls)
target_link_libraries(pivx-tx
univalue
COMMON_A
ZEROCOIN_A
UTIL_A
BITCOIN_CRYPTO_A
secp256k1
bls
SAPLING_A
rustzcash
${Boost_LIBRARIES} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} ${GMP_LIBRARY} -ldl pthread
)
if($ENV{target} MATCHES "Windows")
target_link_libraries(pivx-tx ${WINDOWS_LDADD})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(pivx-tx "-framework Cocoa")
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 bls)
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}
${GMP_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
bls
rustzcash
${BerkeleyDB_LIBRARIES} ${Boost_LIBRARIES} ${LIBEVENT_LIB} ${GMP_LIBRARY} 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(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()
if(NAT-PMP_FOUND)
target_link_libraries(pivxd ${NAT-PMP_LIBRARY})
target_include_directories(pivxd PUBLIC ${NAT-PMP_INCLUDE_DIR})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(pivxd "-framework Cocoa")
endif()
target_link_libraries(pivxd ${sodium_LIBRARY_RELEASE} -ldl -lpthread)
add_subdirectory(src/qt)
add_subdirectory(src/test)
add_subdirectory(src/bench)