forked from pmem/pmdk-convert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1571 lines (1353 loc) · 58.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
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
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Copyright 2018-2019, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include(${CMAKE_SOURCE_DIR}/utils/utils.cmake)
cmake_minimum_required(VERSION 3.3)
project(pmdk-convert C CXX)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 7)
set(VERSION_PATCH 0)
#set(VERSION_PRERELEASE rc0)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
if (VERSION_PATCH GREATER 0)
set(VERSION ${VERSION}.${VERSION_PATCH})
endif()
if (VERSION_PRERELEASE)
set(VERSION ${VERSION}-${VERSION_PRERELEASE})
endif()
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
include(FindThreads)
if(WIN32)
set(MIN_VERSION 1.4 CACHE STRING "First supported version (major.minor)")
else()
set(MIN_VERSION 1.0 CACHE STRING "First supported version (major.minor)")
endif()
set(MAX_VERSION 1.7)
set(MAX_STABLE 1.7)
if(MIN_VERSION VERSION_GREATER_EQUAL MAX_VERSION)
message(FATAL_ERROR "ERROR: Minimum PMDK version cannot be greater than or equal to maximum PMDK version")
endif()
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+" "\\1" MIN_VERSION_MAJOR "${MIN_VERSION}")
STRING(REGEX REPLACE "^[0-9]+\\.([0-9]+)" "\\1" MIN_VERSION_MINOR "${MIN_VERSION}")
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+" "\\1" MAX_VERSION_MAJOR "${MAX_VERSION}")
STRING(REGEX REPLACE "^[0-9]+\\.([0-9]+)" "\\1" MAX_VERSION_MINOR "${MAX_VERSION}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif (NOT CMAKE_BUILD_TYPE)
include(CheckCCompilerFlag)
include(GNUInstallDirs)
if(NOT MSVC)
find_package(PkgConfig QUIET)
endif()
set(CMAKE_C_STANDARD 99)
# Checks whether flag is supported by current C compiler and appends
# it to the relevant cmake variable.
# 1st argument is a flag
# 2nd (optional) argument is a build type (debug, release, relwithdebinfo)
macro(add_c_flag flag)
string(REPLACE - _ flag2 ${flag})
string(REPLACE " " _ flag2 ${flag2})
string(REPLACE = "_" flag2 ${flag2})
set(check_name "C_HAS_${flag2}")
check_c_compiler_flag("${flag}" "${check_name}")
if (${${check_name}})
if (${ARGC} EQUAL 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
else()
set(CMAKE_C_FLAGS_${ARGV1} "${CMAKE_C_FLAGS_${ARGV1}} ${flag}")
endif()
endif()
endmacro()
if(NOT MSVC)
add_c_flag(-fno-common)
add_c_flag(-Wall)
add_c_flag(-Wconversion)
add_c_flag(-Wmissing-field-initializers)
add_c_flag(-Wmissing-prototypes)
add_c_flag(-Wmissing-variable-declarations)
add_c_flag(-Wpointer-arith)
add_c_flag(-Wsign-compare)
add_c_flag(-Wsign-conversion)
add_c_flag(-Wunused-macros)
add_c_flag(-Wunreachable-code-return)
# Place each function or data item into its own section. Will be used to strip unneeded symbols.
add_c_flag(-fdata-sections)
add_c_flag(-ffunction-sections)
add_c_flag(-ggdb DEBUG)
add_c_flag(-DDEBUG DEBUG)
add_c_flag(-ggdb RELWITHDEBINFO)
add_c_flag(-fno-omit-frame-pointer RELWITHDEBINFO)
check_c_compiler_flag(-Wl,-z,relro LINKER_HAS_RELRO)
if(LINKER_HAS_RELRO)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro")
endif()
check_c_compiler_flag(-Wl,--warn-common LINKER_HAS_WARN_COMMON)
if(LINKER_HAS_WARN_COMMON)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--warn-common")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--warn-common")
endif()
add_c_flag("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" RELEASE)
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
function(version_supported ver ver_next RESULT)
if (${MIN_VERSION} VERSION_GREATER ${ver})
set(${RESULT} 0 PARENT_SCOPE)
return()
endif()
if (${ver_next} VERSION_GREATER ${MAX_VERSION})
set(${RESULT} 0 PARENT_SCOPE)
return()
endif()
set(${RESULT} 1 PARENT_SCOPE)
return()
endfunction(version_supported)
# disabled by default:
set(BUILD_13 0)
set(BUILD_15 0)
if (${MIN_VERSION} EQUAL 1.0)
set(BUILD_CONVERT_V1 1)
set(BUILD_CONVERT_V2 1)
set(BUILD_CONVERT_V3 1)
set(BUILD_13 1)
set(BUILD_CONVERT_V4 1)
set(BUILD_CONVERT_V5 1)
set(BUILD_CONVERT_V6 1)
set(BUILD_15 1)
elseif (${MIN_VERSION} EQUAL 1.1)
set(BUILD_CONVERT_V2 1)
set(BUILD_CONVERT_V3 1)
set(BUILD_13 1)
set(BUILD_CONVERT_V4 1)
set(BUILD_CONVERT_V5 1)
set(BUILD_15 1)
elseif (${MIN_VERSION} EQUAL 1.2)
set(BUILD_CONVERT_V3 1)
set(BUILD_13 1)
set(BUILD_CONVERT_V4 1)
set(BUILD_CONVERT_V5 1)
set(BUILD_15 1)
set(BUILD_CONVERT_V6 1)
elseif (${MIN_VERSION} EQUAL 1.3)
set(BUILD_13 1)
set(BUILD_CONVERT_V4 1)
set(BUILD_CONVERT_V5 1)
set(BUILD_15 1)
set(BUILD_CONVERT_V6 1)
elseif (${MIN_VERSION} EQUAL 1.4)
set(BUILD_CONVERT_V4 1)
set(BUILD_CONVERT_V5 1)
set(BUILD_15 1)
set(BUILD_CONVERT_V6 1)
elseif (${MIN_VERSION} EQUAL 1.5)
set(BUILD_CONVERT_V5 1)
set(BUILD_15 1)
set(BUILD_CONVERT_V6 1)
elseif (${MIN_VERSION} EQUAL 1.6)
set(BUILD_CONVERT_V5 1)
set(BUILD_CONVERT_V6 1)
elseif (${MIN_VERSION} EQUAL 1.7)
set(BUILD_CONVERT_V6 1)
endif()
add_executable(check_license EXCLUDE_FROM_ALL utils/check_license/check-license.c)
# Generates cstyle-$name target and attaches it as a dependency of global
# "cstyle" target. This target verifies C style of files in current source dir.
# If more arguments are used, then they are used as files to be checked
# instead.
# ${name} must be unique.
function(add_cstyle name)
if(${ARGC} EQUAL 1)
add_custom_target(cstyle-${name}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/utils/cstyle
${CMAKE_CURRENT_SOURCE_DIR}/*.c
${CMAKE_CURRENT_SOURCE_DIR}/*.h)
else()
add_custom_target(cstyle-${name}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/utils/cstyle ${ARGN})
endif()
add_dependencies(cstyle cstyle-${name})
endfunction()
# Generates check-whitespace-$name target and attaches it as a dependency
# of global "check-whitespace" target. This target verifies C files in current
# source dir do not have any whitespace errors.
# If more arguments are used, then they are used as files to be checked
# instead.
# ${name} must be unique.
function(add_check_whitespace name)
if(${ARGC} EQUAL 1)
add_custom_target(check-whitespace-${name}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/utils/check_whitespace
${CMAKE_CURRENT_SOURCE_DIR}/*.c
${CMAKE_CURRENT_SOURCE_DIR}/*.h)
else()
add_custom_target(check-whitespace-${name}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/utils/check_whitespace ${ARGN})
endif()
add_dependencies(check-whitespace check-whitespace-${name})
endfunction()
add_custom_target(checkers ALL)
add_custom_target(cstyle)
add_custom_target(check-whitespace)
add_custom_target(check-license
COMMAND ${CMAKE_SOURCE_DIR}/utils/check_license/check-headers.sh
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}/check_license
${CMAKE_SOURCE_DIR}/LICENSE
-a)
add_custom_target(md2man
COMMAND ${CMAKE_SOURCE_DIR}/utils/md2man/md2man.sh
${CMAKE_SOURCE_DIR}/doc/pmdk-convert/pmdk-convert.1.md
${CMAKE_SOURCE_DIR}/utils/md2man/default.man
${CMAKE_SOURCE_DIR}/doc/generated/pmdk-convert.1
)
if (NOT WIN32)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/doc/generated/pmdk-convert.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()
add_dependencies(check-license check_license)
add_cstyle(main)
add_cstyle(check_license ${CMAKE_SOURCE_DIR}/utils/check_license/*.c)
add_check_whitespace(check_license ${CMAKE_SOURCE_DIR}/utils/check_license/*.c)
add_check_whitespace(src)
add_check_whitespace(other
${CMAKE_SOURCE_DIR}/utils/check_license/*.sh
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/CMakeLists.txt
${CMAKE_SOURCE_DIR}/tests/CMakeLists.txt
${CMAKE_SOURCE_DIR}/*.cmake
${CMAKE_SOURCE_DIR}/tests/*.cmake
# ${CMAKE_SOURCE_DIR}/utils/*.sh
# ${CMAKE_SOURCE_DIR}/*.spec
# ${CMAKE_SOURCE_DIR}/debian/*
# ${CMAKE_SOURCE_DIR}/debian/*/*
# ${CMAKE_SOURCE_DIR}/doc/*.md
)
option(DEVELOPER_MODE "enable developer checks" OFF)
if(DEVELOPER_MODE)
add_dependencies(checkers cstyle)
add_dependencies(checkers check-whitespace)
add_dependencies(checkers check-license)
endif(DEVELOPER_MODE)
function(uncompress file)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_SOURCE_DIR}/${file}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RET)
if(RET)
message(FATAL_ERROR "Couldn't uncompress ${file}")
endif()
endfunction()
function(get_pmdk ver hash dstdir)
set(pkg ${CMAKE_SOURCE_DIR}/${ver}.tar.gz)
if (EXISTS ${pkg})
file(SHA256 ${pkg} pkg_hash)
if (NOT ${pkg_hash} STREQUAL ${hash})
message(STATUS "Hash for version ${ver} doesn't match the expected value.")
if (EXISTS ${CMAKE_SOURCE_DIR}/${dstdir})
message(STATUS "Removing ${CMAKE_SOURCE_DIR}/${dstdir}.")
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/${dstdir})
endif()
message(STATUS "Removing ${pkg}.")
file(REMOVE ${pkg})
endif()
endif()
if (NOT EXISTS ${pkg})
if (EXISTS ${CMAKE_SOURCE_DIR}/${dstdir})
message(STATUS "Removing ${CMAKE_SOURCE_DIR}/${dstdir}.")
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/${dstdir})
endif()
message(STATUS "Downloading ${ver}.tar.gz")
if (${ver} STREQUAL "1.0" OR ${ver} STREQUAL "1.1")
file(DOWNLOAD https://github.com/pmem/pmdk/archive/${ver}.tar.gz ${CMAKE_SOURCE_DIR}/${ver}.tar.gz
EXPECTED_HASH SHA256=${hash})
else()
file(DOWNLOAD https://github.com/pmem/pmdk/releases/download/${ver}/pmdk-${ver}.tar.gz ${CMAKE_SOURCE_DIR}/${ver}.tar.gz
EXPECTED_HASH SHA256=${hash})
endif()
message(STATUS "Downloading ${ver}.tar.gz DONE")
endif()
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/${dstdir})
message(STATUS "Uncompressing ${ver}.tar.gz")
uncompress(${ver}.tar.gz)
message(STATUS "Uncompressing ${ver}.tar.gz DONE")
file(RENAME ${CMAKE_SOURCE_DIR}/pmdk-${ver} ${CMAKE_SOURCE_DIR}/${dstdir})
endif()
endfunction()
if(BUILD_CONVERT_V6)
set(VER17 1.7)
get_pmdk(${VER17} 865ce1b422bc83109cb4a63dcff8fd1077eea3617e668faf6a043208d8be03ca ${VER17})
function(build_libpmem_convert)
set(LIBPMEM_SOURCES
${MAX_STABLE}/src/common/alloc.c
${MAX_STABLE}/src/common/file.c
${MAX_STABLE}/src/common/mmap.c
${MAX_STABLE}/src/common/out.c
${MAX_STABLE}/src/common/util.c
${MAX_STABLE}/src/libpmem/libpmem.c
${MAX_STABLE}/src/libpmem/memops_generic.c
${MAX_STABLE}/src/libpmem/pmem.c
)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64
OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64
OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
set(LIBPMEM_SOURCES ${LIBPMEM_SOURCES}
${MAX_STABLE}/src/libpmem/x86_64/init.c
${MAX_STABLE}/src/libpmem/x86_64/cpu.c
)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(LIBPMEM_SOURCES ${LIBPMEM_SOURCES}
${MAX_STABLE}/src/libpmem/aarch64/init.c
)
else()
message(FATAL_ERROR "Unknown architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif()
if(WIN32)
set(LIBPMEM_SOURCES ${LIBPMEM_SOURCES}
${MAX_STABLE}/src/libpmem/libpmem_main.c
${MAX_STABLE}/src/libpmem/pmem_windows.c
${MAX_STABLE}/src/windows/win_mmap.c
${MAX_STABLE}/src/common/file_windows.c
${MAX_STABLE}/src/common/fs_windows.c
${MAX_STABLE}/src/common/mmap_windows.c
${MAX_STABLE}/src/common/os_auto_flush_windows.c
${MAX_STABLE}/src/common/os_deep_windows.c
${MAX_STABLE}/src/common/os_windows.c
${MAX_STABLE}/src/common/os_thread_windows.c
${MAX_STABLE}/src/common/util_windows.c
)
else()
set(LIBPMEM_SOURCES ${LIBPMEM_SOURCES}
${MAX_STABLE}/src/libpmem/pmem_posix.c
${MAX_STABLE}/src/common/file_posix.c
${MAX_STABLE}/src/common/fs_posix.c
${MAX_STABLE}/src/common/mmap_posix.c
${MAX_STABLE}/src/common/os_auto_flush_linux.c
${MAX_STABLE}/src/common/os_deep_linux.c
${MAX_STABLE}/src/common/os_posix.c
${MAX_STABLE}/src/common/os_thread_posix.c
${MAX_STABLE}/src/common/util_posix.c
)
endif()
if(MSVC)
FILE(READ ${MAX_STABLE}/src/libpmem/libpmem.def DEFFILE)
string(REPLACE "libpmem" "libpmem-convert" DEFFILE "${DEFFILE}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libpmem.def "${DEFFILE}")
add_library(libpmem-convert SHARED ${LIBPMEM_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/libpmem.def)
target_link_libraries(libpmem-convert PRIVATE ntdll.lib)
else()
add_library(libpmem-convert SHARED ${LIBPMEM_SOURCES})
FILE(READ ${MAX_STABLE}/src/libpmem/libpmem.link.in LINKFILE)
string(REPLACE "fault_injection;" "" LINKFILE "${LINKFILE}")
FILE(WRITE ${MAX_STABLE}/src/libpmem/libpmem.link "${LINKFILE}")
target_link_libraries(libpmem-convert PRIVATE -Wl,--version-script=${CMAKE_SOURCE_DIR}/${MAX_STABLE}/src/libpmem/libpmem.link)
endif()
# remove lib prefix from library name
set_target_properties(libpmem-convert PROPERTIES PREFIX "")
target_compile_definitions(libpmem-convert PRIVATE SRCVERSION="${MAX_STABLE}")
target_compile_definitions(libpmem-convert PRIVATE PMDK_UTF8_API)
target_compile_definitions(libpmem-convert PRIVATE _PMEMOBJ_INTRNL)
target_compile_definitions(libpmem-convert PRIVATE SSE2_AVAILABLE=0)
target_compile_definitions(libpmem-convert PRIVATE AVX_AVAILABLE=0)
target_compile_definitions(libpmem-convert PRIVATE AVX512F_AVAILABLE=0)
target_include_directories(libpmem-convert PRIVATE ${MAX_STABLE}/src/include)
target_include_directories(libpmem-convert PRIVATE ${MAX_STABLE}/src/common)
target_include_directories(libpmem-convert PRIVATE ${MAX_STABLE}/src/libpmem)
if(MSVC)
target_include_directories(libpmem-convert PRIVATE ${MAX_STABLE}/src/windows/include/)
target_include_directories(libpmem-convert PRIVATE include/)
target_compile_options(libpmem-convert PRIVATE /FI"${CMAKE_SOURCE_DIR}/${MAX_STABLE}/src/windows/include/platform.h")
endif()
target_link_libraries(libpmem-convert PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endfunction(build_libpmem_convert)
build_libpmem_convert()
set(PMEM_INCLUDE_DIRS ${MAX_STABLE}/src/include)
set(PMEM_LIBRARIES libpmem-convert)
install(TARGETS libpmem-convert
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pmdk-convert/)
function(build_libpmempool_convert)
set(LIBPMEMPOOL_SOURCES
${MAX_STABLE}/src/libpmempool/check_backup.c
${MAX_STABLE}/src/libpmempool/check_bad_blocks.c
${MAX_STABLE}/src/libpmempool/check_blk.c
${MAX_STABLE}/src/libpmempool/check_btt_info.c
${MAX_STABLE}/src/libpmempool/check_btt_map_flog.c
${MAX_STABLE}/src/libpmempool/check.c
${MAX_STABLE}/src/libpmempool/check_log.c
${MAX_STABLE}/src/libpmempool/check_pool_hdr.c
${MAX_STABLE}/src/libpmempool/check_sds.c
${MAX_STABLE}/src/libpmempool/check_util.c
${MAX_STABLE}/src/libpmempool/check_write.c
${MAX_STABLE}/src/libpmempool/feature.c
${MAX_STABLE}/src/libpmempool/libpmempool.c
${MAX_STABLE}/src/libpmempool/pool.c
${MAX_STABLE}/src/libpmempool/replica.c
${MAX_STABLE}/src/libpmempool/rm.c
${MAX_STABLE}/src/libpmempool/sync.c
${MAX_STABLE}/src/libpmempool/transform.c
${MAX_STABLE}/src/libpmemblk/btt.c
${MAX_STABLE}/src/common/alloc.c
${MAX_STABLE}/src/common/badblock.c
${MAX_STABLE}/src/common/file.c
${MAX_STABLE}/src/common/mmap.c
${MAX_STABLE}/src/common/pool_hdr.c
${MAX_STABLE}/src/common/out.c
${MAX_STABLE}/src/common/os_dimm_none.c
${MAX_STABLE}/src/common/set.c
${MAX_STABLE}/src/common/shutdown_state.c
${MAX_STABLE}/src/common/util.c
${MAX_STABLE}/src/common/uuid.c
)
if(WIN32)
set(LIBPMEMPOOL_SOURCES ${LIBPMEMPOOL_SOURCES}
${MAX_STABLE}/src/libpmempool/libpmempool_main.c
${MAX_STABLE}/src/common/badblock_none.c
${MAX_STABLE}/src/common/file_windows.c
${MAX_STABLE}/src/common/fs_windows.c
${MAX_STABLE}/src/common/mmap_windows.c
${MAX_STABLE}/src/common/os_deep_windows.c
${MAX_STABLE}/src/common/os_thread_windows.c
${MAX_STABLE}/src/common/os_windows.c
${MAX_STABLE}/src/common/util_windows.c
${MAX_STABLE}/src/common/uuid_windows.c
)
else()
set(LIBPMEMPOOL_SOURCES ${LIBPMEMPOOL_SOURCES}
${MAX_STABLE}/src/common/badblock_ndctl.c
${MAX_STABLE}/src/common/extent_linux.c
${MAX_STABLE}/src/common/file_posix.c
${MAX_STABLE}/src/common/fs_posix.c
${MAX_STABLE}/src/common/mmap_posix.c
${MAX_STABLE}/src/common/os_deep_linux.c
${MAX_STABLE}/src/common/os_posix.c
${MAX_STABLE}/src/common/os_thread_posix.c
${MAX_STABLE}/src/common/util_posix.c
${MAX_STABLE}/src/common/uuid_linux.c
)
endif()
if(MSVC)
FILE(READ ${MAX_STABLE}/src/libpmempool/libpmempool.def DEFFILE)
string(REPLACE "libpmempool" "libpmempool-convert" DEFFILE "${DEFFILE}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libpmempool.def "${DEFFILE}")
add_library(libpmempool-convert SHARED ${LIBPMEMPOOL_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/libpmempool.def)
else()
FILE(READ ${MAX_STABLE}/src/libpmempool/libpmempool.link.in LINKFILE)
string(REPLACE "fault_injection;" "" LINKFILE "${LINKFILE}")
FILE(WRITE ${MAX_STABLE}/src/libpmempool/libpmempool.link "${LINKFILE}")
add_library(libpmempool-convert SHARED ${LIBPMEMPOOL_SOURCES})
target_link_libraries(libpmempool-convert PRIVATE -Wl,--version-script=${CMAKE_SOURCE_DIR}/${MAX_STABLE}/src/libpmempool/libpmempool.link)
endif()
target_link_libraries(libpmempool-convert PRIVATE libpmem-convert)
target_compile_definitions(libpmempool-convert PRIVATE SRCVERSION="${MAX_STABLE}")
target_compile_definitions(libpmempool-convert PRIVATE PMDK_UTF8_API)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/include)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/common)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/libpmempool)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/libpmemblk)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/libpmemlog)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/libpmemobj)
if(MSVC)
target_include_directories(libpmempool-convert PRIVATE ${MAX_STABLE}/src/windows/include/)
target_include_directories(libpmempool-convert PRIVATE include/)
target_compile_options(libpmempool-convert PRIVATE /FI"${CMAKE_SOURCE_DIR}/${MAX_STABLE}/src/windows/include/platform.h")
endif()
target_link_libraries(libpmempool-convert PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endfunction(build_libpmempool_convert)
build_libpmempool_convert()
set(LIBPMEMPOOL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/${MAX_STABLE}/src/include)
set(LIBPMEMPOOL_LIBRARIES libpmempool-convert)
set(SOURCES_17
${VER17}/src/libpmemobj/alloc_class.c
${VER17}/src/libpmemobj/bucket.c
${VER17}/src/libpmemobj/critnib.c
${VER17}/src/libpmemobj/ctl_debug.c
${VER17}/src/libpmemobj/container_ravl.c
${VER17}/src/libpmemobj/container_seglists.c
${VER17}/src/libpmemobj/heap.c
${VER17}/src/libpmemobj/lane.c
${VER17}/src/libpmemobj/libpmemobj.c
${VER17}/src/libpmemobj/list.c
${VER17}/src/libpmemobj/memblock.c
${VER17}/src/libpmemobj/memops.c
${VER17}/src/libpmemobj/obj.c
${VER17}/src/libpmemobj/palloc.c
${VER17}/src/libpmemobj/pmalloc.c
${VER17}/src/libpmemobj/ravl.c
${VER17}/src/libpmemobj/recycler.c
${VER17}/src/libpmemobj/stats.c
${VER17}/src/libpmemobj/sync.c
${VER17}/src/libpmemobj/tx.c
${VER17}/src/libpmemobj/ulog.c
${VER17}/src/common/alloc.c
${VER17}/src/common/badblock.c
${VER17}/src/common/ctl.c
${VER17}/src/common/ctl_cow.c
${VER17}/src/common/ctl_fallocate.c
${VER17}/src/common/ctl_prefault.c
${VER17}/src/common/ctl_sds.c
${VER17}/src/common/file.c
${VER17}/src/common/mmap.c
${VER17}/src/common/os_dimm_none.c
${VER17}/src/common/out.c
${VER17}/src/common/pool_hdr.c
${VER17}/src/common/set.c
${VER17}/src/common/shutdown_state.c
${VER17}/src/common/util.c
${VER17}/src/common/uuid.c
)
if(WIN32)
set(SOURCES_17 ${SOURCES_17}
${VER17}/src/libpmemobj/libpmemobj_main.c
${VER17}/src/common/badblock_none.c
${VER17}/src/common/file_windows.c
${VER17}/src/common/fs_windows.c
${VER17}/src/common/mmap_windows.c
${VER17}/src/common/os_deep_windows.c
${VER17}/src/common/os_windows.c
${VER17}/src/common/os_thread_windows.c
${VER17}/src/common/util_windows.c
${VER17}/src/common/uuid_windows.c
)
else()
set(SOURCES_17 ${SOURCES_17}
${VER17}/src/common/badblock_ndctl.c
${VER17}/src/common/extent_linux.c
${VER17}/src/common/file_posix.c
${VER17}/src/common/fs_posix.c
${VER17}/src/common/mmap_posix.c
${VER17}/src/common/os_deep_linux.c
${VER17}/src/common/os_posix.c
${VER17}/src/common/os_thread_posix.c
${VER17}/src/common/util_posix.c
${VER17}/src/common/uuid_linux.c
)
endif()
function(build_convert_v6)
if(WIN32)
set(CONVERT_V6_SOURCES ${VER17}/src/windows/getopt/getopt.c)
endif()
add_library(pmemobj_convert_v6_o OBJECT ${SOURCES_17} ${CONVERT_V6_SOURCES}
pmemobj_convert_v6.c
${VER17}/src/libpmemblk/btt.c
${VER17}/src/tools/pmempool/common.c
${VER17}/src/tools/pmempool/output.c)
target_compile_definitions(pmemobj_convert_v6_o PRIVATE SRCVERSION="${VER17}")
target_compile_definitions(pmemobj_convert_v6_o PRIVATE PMDK_UTF8_API)
target_compile_definitions(pmemobj_convert_v6_o PRIVATE _PMEMOBJ_INTRNL)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/include)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/libpmemobj)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/libpmemlog)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/libpmemblk)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/common)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${PMEM_INCLUDE_DIRS})
if(MSVC)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/windows/include/)
target_include_directories(pmemobj_convert_v6_o PRIVATE ${VER17}/src/windows/getopt/)
target_include_directories(pmemobj_convert_v6_o PRIVATE include/)
target_compile_options(pmemobj_convert_v6_o PRIVATE /FI"${CMAKE_SOURCE_DIR}/${VER17}/src/windows/include/platform.h")
endif()
if(MSVC)
add_library(pmemobj_convert_v6_shared SHARED $<TARGET_OBJECTS:pmemobj_convert_v6_o> ${CMAKE_CURRENT_SOURCE_DIR}/pmemobj_convert_v6.def)
else()
add_library(pmemobj_convert_v6_shared SHARED $<TARGET_OBJECTS:pmemobj_convert_v6_o>)
target_link_libraries(pmemobj_convert_v6_shared PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/pmemobj_convert.map)
endif()
target_link_libraries(pmemobj_convert_v6_shared PRIVATE libpmem-convert)
target_link_libraries(pmemobj_convert_v6_shared PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(pmemobj_convert_v6_shared PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(NOT MSVC)
# strip unneeded symbols, requires -fdata-sections -ffunction-sections
target_link_libraries(pmemobj_convert_v6_shared PRIVATE -Wl,--gc-sections)
endif()
set_target_properties(pmemobj_convert_v6_shared PROPERTIES OUTPUT_NAME pmemobj_convert_v6)
# remove lib prefix from library name
set_target_properties(pmemobj_convert_v6_shared PROPERTIES PREFIX "")
endfunction(build_convert_v6)
build_convert_v6()
install(TARGETS pmemobj_convert_v6_shared
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pmdk-convert/)
function(build_libpmemobj_17)
if(MSVC)
FILE(READ ${VER17}/src/libpmemobj/libpmemobj.def DEFFILE)
string(REPLACE "libpmemobj" "pmemobj_17" DEFFILE "${DEFFILE}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_17.def "${DEFFILE}")
add_library(pmemobj_17 SHARED ${SOURCES_17} ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_17.def)
target_compile_options(pmemobj_17 PRIVATE /FI"${CMAKE_SOURCE_DIR}/${VER17}/src/windows/include/platform.h")
else()
add_library(pmemobj_17 SHARED ${SOURCES_17})
disable_optimization(pmemobj_17)
endif()
target_compile_definitions(pmemobj_17 PRIVATE SRCVERSION="${VER17}")
target_compile_definitions(pmemobj_17 PRIVATE PMDK_UTF8_API)
target_compile_definitions(pmemobj_17 PRIVATE _PMEMOBJ_INTRNL)
target_include_directories(pmemobj_17 PRIVATE ${VER17}/src/include)
target_include_directories(pmemobj_17 PRIVATE ${VER17}/src/libpmemobj)
target_include_directories(pmemobj_17 PRIVATE ${VER17}/src/common)
target_include_directories(pmemobj_17 PRIVATE ${PMEM_INCLUDE_DIRS})
if(WIN32)
target_include_directories(pmemobj_17 PRIVATE ${VER17}/src/windows/include/)
target_include_directories(pmemobj_17 PRIVATE include/)
endif()
target_link_libraries(pmemobj_17 PRIVATE libpmem-convert)
target_link_libraries(pmemobj_17 PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(pmemobj_17 PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(NOT MSVC)
FILE(READ ${VER17}/src/libpmemobj/libpmemobj.link.in LINKFILE)
string(REPLACE "fault_injection;" "" LINKFILE "${LINKFILE}")
FILE(WRITE ${VER17}/src/libpmemobj/libpmemobj.link "${LINKFILE}")
target_link_libraries(pmemobj_17 PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/${VER17}/src/libpmemobj/libpmemobj.link)
endif()
endfunction(build_libpmemobj_17)
build_libpmemobj_17()
endif(BUILD_CONVERT_V6)
# convert V5 and PMDK 1.6
if(BUILD_CONVERT_V5)
set(VER16 1.6.1)
get_pmdk(${VER16} f263c8301f86ddf8bc5e020909ac52350baedba5c169a1a3a7786df64f129446 ${VER16})
set(SOURCES_16
${VER16}/src/libpmemobj/alloc_class.c
${VER16}/src/libpmemobj/bucket.c
${VER16}/src/libpmemobj/critnib.c
${VER16}/src/libpmemobj/ctl_debug.c
${VER16}/src/libpmemobj/container_ravl.c
${VER16}/src/libpmemobj/container_seglists.c
${VER16}/src/libpmemobj/heap.c
${VER16}/src/libpmemobj/lane.c
${VER16}/src/libpmemobj/libpmemobj.c
${VER16}/src/libpmemobj/list.c
${VER16}/src/libpmemobj/memblock.c
${VER16}/src/libpmemobj/memops.c
${VER16}/src/libpmemobj/obj.c
${VER16}/src/libpmemobj/palloc.c
${VER16}/src/libpmemobj/pmalloc.c
${VER16}/src/libpmemobj/ravl.c
${VER16}/src/libpmemobj/recycler.c
${VER16}/src/libpmemobj/stats.c
${VER16}/src/libpmemobj/sync.c
${VER16}/src/libpmemobj/tx.c
${VER16}/src/libpmemobj/ulog.c
${VER16}/src/common/alloc.c
${VER16}/src/common/badblock.c
${VER16}/src/common/ctl.c
${VER16}/src/common/ctl_cow.c
${VER16}/src/common/ctl_fallocate.c
${VER16}/src/common/ctl_prefault.c
${VER16}/src/common/ctl_sds.c
${VER16}/src/common/file.c
${VER16}/src/common/mmap.c
${VER16}/src/common/os_dimm_none.c
${VER16}/src/common/out.c
${VER16}/src/common/pool_hdr.c
${VER16}/src/common/set.c
${VER16}/src/common/shutdown_state.c
${VER16}/src/common/util.c
${VER16}/src/common/uuid.c
)
if(WIN32)
set(SOURCES_16 ${SOURCES_16}
${VER16}/src/libpmemobj/libpmemobj_main.c
${VER16}/src/common/badblock_none.c
${VER16}/src/common/file_windows.c
${VER16}/src/common/fs_windows.c
${VER16}/src/common/mmap_windows.c
${VER16}/src/common/os_deep_windows.c
${VER16}/src/common/os_windows.c
${VER16}/src/common/os_thread_windows.c
${VER16}/src/common/util_windows.c
${VER16}/src/common/uuid_windows.c
)
else()
set(SOURCES_16 ${SOURCES_16}
${VER16}/src/common/badblock_ndctl.c
${VER16}/src/common/extent_linux.c
${VER16}/src/common/file_posix.c
${VER16}/src/common/fs_posix.c
${VER16}/src/common/mmap_posix.c
${VER16}/src/common/os_deep_linux.c
${VER16}/src/common/os_posix.c
${VER16}/src/common/os_thread_posix.c
${VER16}/src/common/util_posix.c
${VER16}/src/common/uuid_linux.c
)
endif()
function(build_convert_v5)
if(WIN32)
set(CONVERT_V5_SOURCES ${VER16}/src/windows/getopt/getopt.c)
endif()
add_library(pmemobj_convert_v5_o OBJECT ${SOURCES_16} ${CONVERT_V5_SOURCES}
pmemobj_convert_v5.c
${VER16}/src/libpmemblk/btt.c
${VER16}/src/tools/pmempool/common.c
${VER16}/src/tools/pmempool/output.c)
target_compile_definitions(pmemobj_convert_v5_o PRIVATE SRCVERSION="${VER16}")
target_compile_definitions(pmemobj_convert_v5_o PRIVATE PMDK_UTF8_API)
target_compile_definitions(pmemobj_convert_v5_o PRIVATE _PMEMOBJ_INTRNL)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/include)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/libpmemobj)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/libpmemlog)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/libpmemblk)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/common)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/tools/pmempool)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${PMEM_INCLUDE_DIRS})
if(MSVC)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/windows/include/)
target_include_directories(pmemobj_convert_v5_o PRIVATE ${VER16}/src/windows/getopt/)
target_include_directories(pmemobj_convert_v5_o PRIVATE include/)
target_compile_options(pmemobj_convert_v5_o PRIVATE /FI"${CMAKE_SOURCE_DIR}/${VER16}/src/windows/include/platform.h")
endif()
if(MSVC)
add_library(pmemobj_convert_v5_shared SHARED $<TARGET_OBJECTS:pmemobj_convert_v5_o> ${CMAKE_CURRENT_SOURCE_DIR}/pmemobj_convert_v5.def)
else()
add_library(pmemobj_convert_v5_shared SHARED $<TARGET_OBJECTS:pmemobj_convert_v5_o>)
target_link_libraries(pmemobj_convert_v5_shared PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/pmemobj_convert.map)
endif()
target_link_libraries(pmemobj_convert_v5_shared PRIVATE libpmem-convert)
target_link_libraries(pmemobj_convert_v5_shared PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(pmemobj_convert_v5_shared PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(NOT MSVC)
# strip unneeded symbols, requires -fdata-sections -ffunction-sections
target_link_libraries(pmemobj_convert_v5_shared PRIVATE -Wl,--gc-sections)
endif()
set_target_properties(pmemobj_convert_v5_shared PROPERTIES OUTPUT_NAME pmemobj_convert_v5)
# remove lib prefix from library name
set_target_properties(pmemobj_convert_v5_shared PROPERTIES PREFIX "")
endfunction(build_convert_v5)
build_convert_v5()
install(TARGETS pmemobj_convert_v5_shared
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pmdk-convert/)
function(build_libpmemobj_16)
if(MSVC)
FILE(READ ${VER16}/src/libpmemobj/libpmemobj.def DEFFILE)
string(REPLACE "libpmemobj" "pmemobj_16" DEFFILE "${DEFFILE}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_16.def "${DEFFILE}")
add_library(pmemobj_16 SHARED ${SOURCES_16} ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_16.def)
target_compile_options(pmemobj_16 PRIVATE /FI"${CMAKE_SOURCE_DIR}/${VER16}/src/windows/include/platform.h")
else()
add_library(pmemobj_16 SHARED ${SOURCES_16})
disable_optimization(pmemobj_16)
endif()
target_compile_definitions(pmemobj_16 PRIVATE SRCVERSION="${VER16}")
target_compile_definitions(pmemobj_16 PRIVATE PMDK_UTF8_API)
target_compile_definitions(pmemobj_16 PRIVATE _PMEMOBJ_INTRNL)
target_include_directories(pmemobj_16 PRIVATE ${VER16}/src/include)
target_include_directories(pmemobj_16 PRIVATE ${VER16}/src/libpmemobj)
target_include_directories(pmemobj_16 PRIVATE ${VER16}/src/common)
target_include_directories(pmemobj_16 PRIVATE ${PMEM_INCLUDE_DIRS})
if(WIN32)
target_include_directories(pmemobj_16 PRIVATE ${VER16}/src/windows/include/)
target_include_directories(pmemobj_16 PRIVATE include/)
endif()
target_link_libraries(pmemobj_16 PRIVATE libpmem-convert)
target_link_libraries(pmemobj_16 PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(pmemobj_16 PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(NOT MSVC)
FILE(READ ${VER16}/src/libpmemobj/libpmemobj.link.in LINKFILE)
string(REPLACE "fault_injection;" "" LINKFILE "${LINKFILE}")
FILE(WRITE ${VER16}/src/libpmemobj/libpmemobj.link "${LINKFILE}")
target_link_libraries(pmemobj_16 PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/${VER16}/src/libpmemobj/libpmemobj.link)
endif()
endfunction(build_libpmemobj_16)
build_libpmemobj_16()
endif(BUILD_CONVERT_V5)
###################################################### 1.5
if(BUILD_15)
set(VER15 1.5.2)
get_pmdk(${VER15} a72691971a98b8472b26271f19d69e6c9b849c1ca42124ea2e2bd8c3fcdff1b1 ${VER15})
set(SOURCES_15
${VER15}/src/libpmemobj/alloc_class.c
${VER15}/src/libpmemobj/bucket.c
${VER15}/src/libpmemobj/ctl_debug.c
${VER15}/src/libpmemobj/container_ravl.c
${VER15}/src/libpmemobj/container_seglists.c
${VER15}/src/libpmemobj/cuckoo.c
${VER15}/src/libpmemobj/heap.c
${VER15}/src/libpmemobj/lane.c
${VER15}/src/libpmemobj/libpmemobj.c
${VER15}/src/libpmemobj/list.c
${VER15}/src/libpmemobj/memblock.c
${VER15}/src/libpmemobj/memops.c
${VER15}/src/libpmemobj/obj.c
${VER15}/src/libpmemobj/palloc.c
${VER15}/src/libpmemobj/pmalloc.c
${VER15}/src/libpmemobj/ravl.c
${VER15}/src/libpmemobj/recycler.c
${VER15}/src/libpmemobj/stats.c
${VER15}/src/libpmemobj/sync.c
${VER15}/src/libpmemobj/tx.c
${VER15}/src/libpmemobj/ulog.c
${VER15}/src/common/badblock.c
${VER15}/src/common/ctl.c
${VER15}/src/common/ctl_prefault.c
${VER15}/src/common/ctl_sds.c
${VER15}/src/common/file.c
${VER15}/src/common/mmap.c
${VER15}/src/common/os_dimm_none.c
${VER15}/src/common/out.c
${VER15}/src/common/pool_hdr.c
${VER15}/src/common/set.c
${VER15}/src/common/shutdown_state.c
${VER15}/src/common/util.c
${VER15}/src/common/uuid.c
)
if(WIN32)
set(SOURCES_15 ${SOURCES_15}
${VER15}/src/libpmemobj/libpmemobj_main.c
${VER15}/src/common/badblock_none.c
${VER15}/src/common/file_windows.c
${VER15}/src/common/fs_windows.c
${VER15}/src/common/mmap_windows.c
${VER15}/src/common/os_deep_windows.c
${VER15}/src/common/os_windows.c
${VER15}/src/common/os_thread_windows.c
${VER15}/src/common/util_windows.c
${VER15}/src/common/uuid_windows.c
)
else()
set(SOURCES_15 ${SOURCES_15}
${VER15}/src/common/badblock_ndctl.c
${VER15}/src/common/extent_linux.c
${VER15}/src/common/file_posix.c
${VER15}/src/common/fs_posix.c
${VER15}/src/common/mmap_posix.c
${VER15}/src/common/os_deep_linux.c
${VER15}/src/common/os_posix.c
${VER15}/src/common/os_thread_posix.c
${VER15}/src/common/util_posix.c
${VER15}/src/common/uuid_linux.c
)
endif()
function(build_libpmemobj_15)
if(MSVC)
FILE(READ ${VER15}/src/libpmemobj/libpmemobj.def DEFFILE)
string(REPLACE "libpmemobj" "pmemobj_15" DEFFILE "${DEFFILE}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_15.def "${DEFFILE}")
add_library(pmemobj_15 SHARED ${SOURCES_15} ${CMAKE_CURRENT_BINARY_DIR}/pmemobj_15.def)
target_compile_options(pmemobj_15 PRIVATE /FI"${CMAKE_SOURCE_DIR}/${VER15}/src/windows/include/platform.h")
else()
add_library(pmemobj_15 SHARED ${SOURCES_15})
disable_optimization(pmemobj_15)
endif()
target_compile_definitions(pmemobj_15 PRIVATE SRCVERSION="${VER15}")
target_compile_definitions(pmemobj_15 PRIVATE PMDK_UTF8_API)
target_compile_definitions(pmemobj_15 PRIVATE _PMEMOBJ_INTRNL)
target_include_directories(pmemobj_15 PRIVATE ${VER15}/src/include)
target_include_directories(pmemobj_15 PRIVATE ${VER15}/src/libpmemobj)
target_include_directories(pmemobj_15 PRIVATE ${VER15}/src/common)
target_include_directories(pmemobj_15 PRIVATE ${PMEM_INCLUDE_DIRS})
if(WIN32)
target_include_directories(pmemobj_15 PRIVATE ${VER15}/src/windows/include/)
target_include_directories(pmemobj_15 PRIVATE include/)
endif()
target_link_libraries(pmemobj_15 PRIVATE libpmem-convert)