forked from libbitcoin/libbitcoin-database
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
813 lines (675 loc) · 28.1 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
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
#
# Copyright (c) 2017 Bitprim developers (see AUTHORS)
#
# This file is part of Bitprim.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.4)
# bitprim-database
#==============================================================================
project(bitprim-database
VERSION 0
LANGUAGES CXX C)
# VERSION 0.11.0
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Check for baseline language coverage in the compiler for the C++14 standard.
#------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Process options.
#==============================================================================
# Implement --use-conan
#------------------------------------------------------------------------------
option(USE_CONAN "Use Conan Build Tool." OFF)
option(NO_CONAN_AT_ALL "Conan totally disabled." OFF)
if (NO_CONAN_AT_ALL)
set(USE_CONAN OFF)
endif()
# Inherit --enable-shared and define BOOST_TEST_DYN_LINK.
#------------------------------------------------------------------------------
option(ENABLE_SHARED "" OFF)
# Implement POSITION_INDEPENDENT_CODE
#------------------------------------------------------------------------------
option(ENABLE_POSITION_INDEPENDENT_CODE "Enable POSITION_INDEPENDENT_CODE property" ON)
# Implement --with-tests and declare WITH_TESTS.
#------------------------------------------------------------------------------
option(WITH_TESTS "Compile with unit tests." ON)
# Implement --with-tools and declare WITH_TOOLS.
#------------------------------------------------------------------------------
option(WITH_TOOLS "Compile with tools." OFF)
set(BITPRIM_PROJECT_VERSION "-" CACHE STRING "Specify the Bitprim Project Version.")
# message(${BITPRIM_PROJECT_VERSION})
set(MICROARCHITECTURE "x86_64" CACHE STRING "Specify the Microarchitecture (x86_64|...).")
message( STATUS "Bitprim: Compiling for ${MICROARCHITECTURE}")
# add_definitions(-DBITPRIM_MICROARCHITECTURE=${MICROARCHITECTURE})
# add_definitions(-DBITPRIM_MICROARCHITECTURE_STR="${MICROARCHITECTURE}")
# Implement --with-mining and declare WITH_MEASUREMENTS.
#------------------------------------------------------------------------------
option(WITH_MEASUREMENTS "Measurements enabled." OFF)
if (WITH_MEASUREMENTS)
message(STATUS "Bitprim: MEASUREMENTS enabled")
add_definitions(-DWITH_MEASUREMENTS)
endif()
# Implement --use-domain and declare USE_DOMAIN.
#------------------------------------------------------------------------------
option(USE_DOMAIN "Domain enabled." ON)
if (USE_DOMAIN)
message(STATUS "Bitprim: Using Domain enabled")
add_definitions(-DBITPRIM_USE_DOMAIN)
endif()
# Implement --with-cached-rpc-data and declare WITH_CACHED_RPC_DATA.
#------------------------------------------------------------------------------
option(WITH_CACHED_RPC_DATA "Cached RPC data enabled." OFF)
if (WITH_CACHED_RPC_DATA)
message(STATUS "Bitprim: Cached RPC data enabled")
add_definitions(-DBITPRIM_CACHED_RPC_DATA)
endif()
# Implement and declare DB_TRANSACTION_UNCONFIRMED.
#------------------------------------------------------------------------------
option(DB_TRANSACTION_UNCONFIRMED "DB Transactions Unconfirmed enabled." OFF)
if (DB_TRANSACTION_UNCONFIRMED)
message(STATUS "Bitprim: DB Transactions Unconfirmed enabled")
add_definitions(-DBITPRIM_DB_TRANSACTION_UNCONFIRMED)
endif()
# Implement and declare DB_SPENDS.
#------------------------------------------------------------------------------
option(DB_SPENDS "DB Spends enabled." OFF)
if (DB_SPENDS)
message(STATUS "Bitprim: DB Spends enabled")
add_definitions(-DBITPRIM_DB_SPENDS)
endif()
# Implement and declare DB_HISTORY.
#------------------------------------------------------------------------------
option(DB_HISTORY "DB History enabled." OFF)
if (DB_HISTORY)
message(STATUS "Bitprim: DB History enabled")
add_definitions(-DBITPRIM_DB_HISTORY)
endif()
# Implement and declare DB_STEALTH.
#------------------------------------------------------------------------------
option(DB_STEALTH "DB Stealth enabled." OFF)
if (DB_STEALTH)
message(STATUS "Bitprim: DB Stealth enabled")
add_definitions(-DBITPRIM_DB_STEALTH)
endif()
# Implement and declare DB_UNSPENT_LIBBITCOIN.
#------------------------------------------------------------------------------
option(DB_UNSPENT_LIBBITCOIN "DB Unspent Libbitcoin enabled." OFF)
if (DB_UNSPENT_LIBBITCOIN)
message(STATUS "Bitprim: DB Unspent Libbitcoin enabled")
add_definitions(-DBITPRIM_DB_UNSPENT_LIBBITCOIN)
endif()
# Implement and declare DB_LEGACY.
#------------------------------------------------------------------------------
option(DB_LEGACY "DB Legacy enabled." OFF)
if (DB_LEGACY)
message(STATUS "Bitprim: DB Legacy enabled")
add_definitions(-DBITPRIM_DB_LEGACY)
endif()
# Implement and declare DB_NEW.
#------------------------------------------------------------------------------
option(DB_NEW "DB New enabled." OFF)
if (DB_NEW)
message(STATUS "Bitprim: DB New enabled")
add_definitions(-DBITPRIM_DB_NEW)
endif()
# Implement and declare DB_NEW_BLOCKS.
#------------------------------------------------------------------------------
option(DB_NEW_BLOCKS "DB Blocks New enabled." OFF)
if (DB_NEW_BLOCKS)
message(STATUS "Bitprim: DB Blocks New enabled")
add_definitions(-DBITPRIM_DB_NEW_BLOCKS)
endif()
# Implement and declare DB_NEW_FULL.
#------------------------------------------------------------------------------
option(DB_NEW_FULL "DB New Full enabled." OFF)
if (DB_NEW_FULL)
message(STATUS "Bitprim: DB New Full enabled")
add_definitions(-DBITPRIM_DB_NEW_FULL)
endif()
# Implement --JUST_BITPRIM_SOURCES for linting.
#------------------------------------------------------------------------------
option(JUST_BITPRIM_SOURCES "Just Bitprim source code to be linted." OFF)
if (JUST_BITPRIM_SOURCES)
message(STATUS "Bitprim: Just Bitprim source code to be linted: enabled")
endif()
#------------------------------------------------------------------------------
set(CURRENCY "BCH" CACHE STRING "Specify the Cryptocurrency (BCH|BTC|LTC).")
if (${CURRENCY} STREQUAL "BCH")
add_definitions(-DBITPRIM_CURRENCY_BCH)
elseif (${CURRENCY} STREQUAL "BTC")
add_definitions(-DBITPRIM_CURRENCY_BTC)
elseif (${CURRENCY} STREQUAL "LTC")
add_definitions(-DBITPRIM_CURRENCY_LTC)
else()
message(FATAL_ERROR "Invalid Cryptocurrency: ${CURRENCY}")
endif()
message(STATUS "Bitprim: Cryptocurrency: ${CURRENCY}")
# Conan infrastructure
#==============================================================================
if(EXISTS ${CMAKE_SOURCE_DIR}/ci_utils/cmake/bitprimbuildinfo.cmake)
include(${CMAKE_SOURCE_DIR}/ci_utils/cmake/bitprimbuildinfo.cmake)
else()
message( STATUS "bitprimbuildinfo doent exists")
endif()
# Check dependencies.
#==============================================================================
#------------------------------------------------------------------------------
if (NO_CONAN_AT_ALL)
# Require Boost of at least version 1.56.0 and output ${boost_CPPFLAGS/LDFLAGS}.
#------------------------------------------------------------------------------
if (NOT ENABLE_SHARED)
set(Boost_USE_STATIC_LIBS ON)
endif()
if (MSVC)
find_package(
Boost 1.56.0 REQUIRED
COMPONENTS atomic chrono date_time filesystem iostreams locale log log_setup program_options regex system thread unit_test_framework
)
else()
find_package(
Boost 1.56.0 REQUIRED
COMPONENTS chrono date_time filesystem iostreams locale log program_options regex system thread unit_test_framework
)
endif()
endif()
if (NOT USE_CONAN)
# Require bitprim-core of at least version 0 and output ${bitprim_core_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
if (NOT TARGET bitprim-core)
find_package(bitprim-core 0 REQUIRED)
endif()
endif()
# Set flags.
#==============================================================================
include(CheckCXXCompilerFlag)
# Including common functions
#------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/ci_utils/cmake)
include(BitprimTools)
# Warn on all stuff.
#------------------------------------------------------------------------------
if (NOT MSVC)
_add_c_compile_flag(-Wall _has_all_warning_flag)
else()
_add_c_compile_flag(-W4 _has_all_warning_flag)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
# Warn on extra stuff.
#------------------------------------------------------------------------------
if (NOT MSVC)
_add_c_compile_flag(-Wextra _has_extra_warning_flag)
endif()
# Be really annoying.
#------------------------------------------------------------------------------
_add_c_compile_flag(-Wpedantic _has_pedantic_warning_flag)
if (_has_pedantic_warning_flag)
_add_c_compile_flag(-pedantic _has_pedantic_flag)
endif()
# Conform to style.
#------------------------------------------------------------------------------
_add_cxx_compile_flag(-Wno-missing-braces _has_no_missing_braces_warning_flag)
# Conflict in stdlib under clang. Enabled in clang only.
#------------------------------------------------------------------------------
_add_cxx_compile_flag(-Wno-mismatched-tags _has_no_mismatched_tags_warning_flag)
# Clean up boost 1.55 headers. Enabled in gcc only.
#------------------------------------------------------------------------------
_add_c_compile_flag(-Wno-deprecated-declarations _has_no_deprecated_declarations_warning_flag)
# Protect stack.
#------------------------------------------------------------------------------
_add_link_flag(-fstack-protector _has_stack_protector_flag)
# Protect stack comprehensively.
#------------------------------------------------------------------------------
_add_link_flag(-fstack-protector-all _has_stack_protector_all_flag)
# Hide internal functions from external libs. Enabled in gcc only.
#------------------------------------------------------------------------------
_add_cxx_compile_flag(-fvisibility-hidden _has_visibility_hidden_flag)
# Hide inlines from external libs. Enabled in gcc only.
#------------------------------------------------------------------------------
_add_cxx_compile_flag(-fvisibility-inlines-hidden _has_visibility_inlines_hidden_flag)
# Target Windows Vista. Enabled in msvc only.
#------------------------------------------------------------------------------
if (MSVC) # OR MINGW)
add_definitions(-D_WIN32_WINNT=0x0600)
endif()
# Build
#==============================================================================
# src/bitprim-database.la => ${libdir}
#------------------------------------------------------------------------------
set(MODE STATIC)
if (ENABLE_SHARED)
set(MODE SHARED)
endif()
set(bitprim_database_sources_just_libbitcoin
src/data_base.cpp
src/settings.cpp
src/store.cpp
src/version.cpp
)
if (DB_LEGACY)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/memory/accessor.cpp
src/memory/allocator.cpp
src/memory/memory_map.cpp
# src/mman-win32/mman.c
src/primitives/record_list.cpp
src/primitives/record_manager.cpp
src/primitives/record_multimap_iterable.cpp
src/primitives/record_multimap_iterator.cpp
src/primitives/slab_manager.cpp
src/databases/block_database.cpp
src/databases/transaction_database.cpp
src/result/block_result.cpp
src/result/transaction_result.cpp
)
if (MSVC) # OR MINGW)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/mman-win32/mman.c
)
endif()
endif()
if (DB_TRANSACTION_UNCONFIRMED)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/databases/transaction_unconfirmed_database.cpp
src/result/transaction_unconfirmed_result.cpp
)
endif()
if (DB_SPENDS)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/databases/spend_database.cpp
)
endif()
if (DB_HISTORY)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/databases/history_database.cpp
)
endif()
if (DB_STEALTH)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/databases/stealth_database.cpp
)
endif()
if (DB_UNSPENT_LIBBITCOIN)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/unspent_outputs.cpp
src/unspent_transaction.cpp
)
endif()
if (DB_LEGACY)
set(bitprim_database_sources_just_libbitcoin
${bitprim_database_sources_just_libbitcoin}
src/databases/block_database.cpp
src/databases/transaction_database.cpp
src/result/block_result.cpp
src/result/transaction_result.cpp
)
endif()
set(bitprim_database_sources_just_bitprim
)
if (DB_NEW)
set(bitprim_database_sources_just_bitprim
${bitprim_database_sources_just_bitprim}
src/bitprim/databases/utxo_entry.cpp
)
endif()
if (DB_NEW_FULL)
set(bitprim_database_sources_just_bitprim
${bitprim_database_sources_just_bitprim}
src/bitprim/databases/history_entry.cpp
src/bitprim/databases/transaction_entry.cpp
src/bitprim/databases/transaction_unconfirmed_entry.cpp
)
endif()
if (NOT JUST_BITPRIM_SOURCES)
set(bitprim_database_sources
${bitprim_database_sources_just_libbitcoin}
)
endif()
set(bitprim_database_sources
${bitprim_database_sources}
${bitprim_database_sources_just_bitprim}
)
add_library(bitprim-database ${MODE} ${bitprim_database_sources})
# add_library(bitprim-database ${MODE}
# src/data_base.cpp
# src/settings.cpp
# src/store.cpp
# src/unspent_outputs.cpp
# src/unspent_transaction.cpp
# src/version.cpp
# src/databases/block_database.cpp
# src/databases/history_database.cpp
# src/databases/spend_database.cpp
# src/databases/stealth_database.cpp
# src/databases/transaction_database.cpp
# src/databases/transaction_unconfirmed_database.cpp
# src/memory/accessor.cpp
# src/memory/allocator.cpp
# src/memory/memory_map.cpp
# src/mman-win32/mman.c
# src/primitives/record_list.cpp
# src/primitives/record_manager.cpp
# src/primitives/record_multimap_iterable.cpp
# src/primitives/record_multimap_iterator.cpp
# src/primitives/slab_manager.cpp
# src/result/block_result.cpp
# src/result/transaction_result.cpp
# src/result/transaction_unconfirmed_result.cpp
# )
if (ENABLE_POSITION_INDEPENDENT_CODE)
set_property(TARGET bitprim-database PROPERTY POSITION_INDEPENDENT_CODE ON)
endif(ENABLE_POSITION_INDEPENDENT_CODE)
target_include_directories(bitprim-database PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_definitions(bitprim-database PUBLIC -DBITPRIM_PROJECT_VERSION="\\"${BITPRIM_PROJECT_VERSION}\\"") #TODO(fernando): manage with Conan????
if (NOT ENABLE_SHARED)
target_compile_definitions(bitprim-database PUBLIC -DBCD_STATIC -DBC_STATIC)
endif()
# if (NOT NO_CONAN_AT_ALL)
# target_link_libraries(bitprim-database PUBLIC ${CONAN_LIBS})
# else()
# target_link_libraries(bitprim-database bitprim-core)
# endif()
if (NOT USE_CONAN)
target_link_libraries(bitprim-database PUBLIC bitprim-core)
endif()
if (NOT NO_CONAN_AT_ALL)
target_link_libraries(bitprim-database PUBLIC ${CONAN_LIBS})
endif()
# if (USE_CONAN)
if (MINGW)
target_link_libraries(bitprim-database PUBLIC ws2_32 wsock32) #TODO(fernando): manage with Conan
endif()
# endif()
_group_sources(bitprim-database "${CMAKE_CURRENT_LIST_DIR}")
# Tests
#==============================================================================
if (WITH_TESTS)
enable_testing()
endif()
# local: test/bitprim_database_test
#------------------------------------------------------------------------------
if (WITH_TESTS)
if (DB_LEGACY)
add_executable(bitprim_database_test
test/block_database.cpp
test/data_base.cpp
test/hash_table.cpp
test/history_database.cpp
test/main.cpp
test/spend_database.cpp
test/structure.cpp
test/transaction_database.cpp
)
endif()
if (DB_NEW)
add_executable(bitprim_database_test
test/main.cpp
test/internal_database.cpp
)
endif()
target_link_libraries(bitprim_database_test PUBLIC bitprim-database)
_group_sources(bitprim_database_test "${CMAKE_CURRENT_LIST_DIR}/test")
# _add_tests(bitprim_database_test
# hash_table_tests
# structure_tests
# )
if (DB_LEGACY)
_add_tests(bitprim_database_test
database_tests
data_base_tests
)
endif()
if (DB_NEW)
_add_tests(bitprim_database_test
internal_db_tests
)
endif()
endif()
# Tools
#==============================================================================
# local: tools/block_db/block_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.block_db
tools/block_db/block_db.cpp)
target_link_libraries(tools.block_db bitprim-database)
_group_sources(tools.block_db "${CMAKE_CURRENT_LIST_DIR}/tools/block_db")
endif()
# local: tools/count_records/count_records
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.count_records
tools/count_records/count_records.cpp)
target_link_libraries(tools.count_records bitprim-database)
_group_sources(tools.count_records "${CMAKE_CURRENT_LIST_DIR}/tools/count_records")
endif()
# local: tools/history_db/history_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.history_db
tools/history_db/history_db.cpp)
target_link_libraries(tools.history_db bitprim-database)
_group_sources(tools.history_db "${CMAKE_CURRENT_LIST_DIR}/tools/history_db")
endif()
# local: tools/initchain/initchain_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.initchain_db
tools/initchain/initchain.cpp)
target_link_libraries(tools.initchain_db bitprim-database)
_group_sources(tools.initchain_db "${CMAKE_CURRENT_LIST_DIR}/tools/initchain")
endif()
# local: tools/mmr_add_row/mmr_add_row
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.mmr_add_row
tools/mmr_add_row/mmr_add_row.cpp)
target_link_libraries(tools.mmr_add_row bitprim-database)
_group_sources(tools.mmr_add_row "${CMAKE_CURRENT_LIST_DIR}/tools/mmr_add_row")
endif()
# local: tools/mmr_create/mmr_create
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.mmr_create
tools/mmr_create/mmr_create.cpp)
target_link_libraries(tools.mmr_create bitprim-database)
_group_sources(tools.mmr_create "${CMAKE_CURRENT_LIST_DIR}/tools/mmr_create")
endif()
# local: tools/mmr_delete_last_row/mmr_delete_last_row
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.mmr_delete_last_row
tools/mmr_delete_last_row/mmr_delete_last_row.cpp)
target_link_libraries(tools.mmr_delete_last_row bitprim-database)
_group_sources(tools.mmr_delete_last_row "${CMAKE_CURRENT_LIST_DIR}/tools/mmr_delete_last_row")
endif()
# local: tools/mmr_lookup/mmr_lookup
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.mmr_lookup
tools/mmr_lookup/mmr_lookup.cpp)
target_link_libraries(tools.mmr_lookup bitprim-database)
_group_sources(tools.mmr_lookup "${CMAKE_CURRENT_LIST_DIR}/tools/mmr_lookup")
endif()
# local: tools/read_htdb_record_value/read_htdb_record_value
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.read_htdb_record_value
tools/read_htdb_record_value/read_htdb_record_value.cpp)
target_link_libraries(tools.read_htdb_record_value bitprim-database)
_group_sources(tools.read_htdb_record_value "${CMAKE_CURRENT_LIST_DIR}/tools/read_htdb_record_value")
endif()
# local: tools/read_htdb_slab_value/read_htdb_slab_value
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.read_htdb_slab_value
tools/read_htdb_slab_value/read_htdb_slab_value.cpp)
target_link_libraries(tools.read_htdb_slab_value bitprim-database)
_group_sources(tools.read_htdb_slab_value "${CMAKE_CURRENT_LIST_DIR}/tools/read_htdb_slab_value")
endif()
# local: tools/show_array/show_array
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.show_array
tools/show_array/show_array.cpp)
target_link_libraries(tools.show_array bitprim-database)
_group_sources(tools.show_array "${CMAKE_CURRENT_LIST_DIR}/tools/show_array")
endif()
# local: tools/show_linked_records/show_linked_records
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.show_linked_records
tools/show_linked_records/show_linked_records.cpp)
target_link_libraries(tools.show_linked_records bitprim-database)
_group_sources(tools.show_linked_records "${CMAKE_CURRENT_LIST_DIR}/tools/initchain")
endif()
# local: tools/show_records/show_records
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.show_records
tools/show_records/show_records.cpp)
target_link_libraries(tools.show_records bitprim-database)
_group_sources(tools.show_records "${CMAKE_CURRENT_LIST_DIR}/tools/show_records")
endif()
# local: tools/spend_db/spend_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.spend_db
tools/spend_db/spend_db.cpp)
target_link_libraries(tools.spend_db bitprim-database)
_group_sources(tools.spend_db "${CMAKE_CURRENT_LIST_DIR}/tools/spend_db")
endif()
# local: tools/stealth_db/stealth_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.stealth_db
tools/stealth_db/stealth_db.cpp)
target_link_libraries(tools.stealth_db bitprim-database)
_group_sources(tools.stealth_db "${CMAKE_CURRENT_LIST_DIR}/tools/stealth_db")
endif()
# local: tools/transaction_db/transaction_db
#------------------------------------------------------------------------------
if (WITH_TOOLS)
add_executable(tools.transaction_db
tools/transaction_db/transaction_db.cpp)
target_link_libraries(tools.transaction_db bitprim-database)
_group_sources(tools.transaction_db "${CMAKE_CURRENT_LIST_DIR}/tools/transaction_db")
endif()
# local: tools/unspent_db/unspent_db
#------------------------------------------------------------------------------
# if (WITH_TOOLS)
# add_executable(tools.unspent_db
# tools/unspent_db/unspent_db.cpp)
# target_link_libraries(tools.unspent_db bitprim-database)
# endif()
# local: tools/build_utxo/build_utxo
#------------------------------------------------------------------------------
# if (WITH_TOOLS)
# add_executable(tools.build_utxo
# tools/build_utxo/build_utxo.cpp)
# target_link_libraries(tools.build_utxo bitprim-database)
# _group_sources(tools.transaction_db "${CMAKE_CURRENT_LIST_DIR}/tools/build_utxo")
# endif()
# # local: tools/check_scripts/check_scripts
# #------------------------------------------------------------------------------
# if (WITH_TOOLS)
# add_executable(tools.check_scripts
# tools/check_scripts/check_scripts.cpp)
# target_link_libraries(tools.check_scripts bitprim-database)
# _group_sources(tools.transaction_db "${CMAKE_CURRENT_LIST_DIR}/tools/check_scripts")
# endif()
# Install
#==============================================================================
install(TARGETS bitprim-database
EXPORT bitprim-database
ARCHIVE DESTINATION lib)
set(_bitprim_headers
bitcoin/database/data_base.hpp
bitcoin/database/unspent_outputs.hpp
bitcoin/database/unspent_transaction.hpp
bitcoin/database/databases/block_database.hpp
bitcoin/database/databases/history_database.hpp
bitcoin/database/databases/spend_database.hpp
bitcoin/database/databases/stealth_database.hpp
bitcoin/database/databases/transaction_database.hpp
bitcoin/database/databases/transaction_unconfirmed_database.hpp
bitcoin/database/define.hpp
bitcoin/database/impl/hash_table_header.ipp
bitcoin/database/impl/record_hash_table.ipp
bitcoin/database/impl/record_multimap.ipp
bitcoin/database/impl/record_row.ipp
bitcoin/database/impl/remainder.ipp
bitcoin/database/impl/slab_hash_table.ipp
bitcoin/database/impl/slab_row.ipp
bitcoin/database/memory/accessor.hpp
bitcoin/database/memory/allocator.hpp
bitcoin/database/memory/memory.hpp
bitcoin/database/memory/memory_map.hpp
bitcoin/database/primitives/hash_table_header.hpp
bitcoin/database/primitives/record_hash_table.hpp
bitcoin/database/primitives/record_list.hpp
bitcoin/database/primitives/record_manager.hpp
bitcoin/database/primitives/record_multimap.hpp
bitcoin/database/primitives/record_multimap_iterable.hpp
bitcoin/database/primitives/record_multimap_iterator.hpp
bitcoin/database/primitives/slab_hash_table.hpp
bitcoin/database/primitives/slab_manager.hpp
bitcoin/database/result/block_result.hpp
bitcoin/database/result/transaction_result.hpp
bitcoin/database/result/transaction_unconfirmed_result.hpp
bitcoin/database/settings.hpp
bitcoin/database/store.hpp
bitcoin/database/version.hpp
bitcoin/database.hpp)
foreach (_header ${_bitprim_headers})
get_filename_component(_directory "${_header}" DIRECTORY)
install(FILES "include/${_header}" DESTINATION "include/${_directory}")
endforeach()
# Export
#==============================================================================
include(CMakePackageConfigHelpers)
export(EXPORT bitprim-database
FILE "${CMAKE_CURRENT_BINARY_DIR}/bitprim-databaseTargets.cmake")
export(PACKAGE bitprim-database)
if (UNIX)
set(_config_package_location "lib/cmake")
elseif (WIN32)
set(_config_package_location "cmake")
endif()
install(EXPORT bitprim-database
FILE bitprim-databaseTargets.cmake
DESTINATION ${_config_package_location})
configure_file(bitprim-databaseConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/bitprim-databaseConfig.cmake"
@ONLY)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/bitprim-databaseConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/bitprim-databaseConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/bitprim-databaseConfigVersion.cmake"
DESTINATION ${_config_package_location})