File: CMakeLists.txt

package info (click to toggle)
libpmemobj-cpp 1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,388 kB
  • sloc: cpp: 136,076; sh: 1,022; perl: 381; ansic: 163; makefile: 13
file content (80 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download
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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2020-2021, Intel Corporation

include(../ctest_helpers.cmake)
include(ExternalProject)

set(COMPATIBILITY_TEST_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/headers)

# Add external cmake projects with libpmemobj-cpp in selected {version}
# to build their headers (to include in compatbility tests).
function(add_libpmemobj_cpp version)
    ExternalProject_Add(libpmemobj-cpp-${version}
        GIT_REPOSITORY https://github.com/pmem/libpmemobj-cpp
        CMAKE_ARGS  -DCMAKE_INSTALL_PREFIX=${COMPATIBILITY_TEST_HEADERS}/${version}
                    -DBUILD_TESTS=OFF
                    -DBUILD_EXAMPLES=OFF
                    -DBUILD_DOC=OFF
                    -DBUILD_BENCHMARKS=OFF
                    -DCMAKE_INSTALL_MESSAGE=NEVER
        GIT_TAG ${version}
    )
endfunction()

# Build test ({name}) for selected {version} and include proper headers.
# Additional parameters ({ARGN}) are the test sources.
function(build_test_with_cpp_version version name)
    build_test(${name} ${ARGN})

    if (NOT("${version}" STREQUAL "master"))
        add_dependencies(${name} libpmemobj-cpp-${version})
    endif()

    target_include_directories(${name} BEFORE PUBLIC ${COMPATIBILITY_TEST_HEADERS}/${version}/include)
endfunction()

# Add compat. testcase run with 2 versions of the project (usually old ver. with master).
# Order is important, it checks backward and forward compatibility.
function(add_compatibility_test name executable1 executable2)
    add_test(NAME ${name}_0_none
        COMMAND ${CMAKE_COMMAND}
        ${GLOBAL_TEST_ARGS}
        -DTEST_NAME=${name}_0_none
        -DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${name}
        -DBIN_DIR=${CMAKE_CURRENT_BINARY_DIR}/${name}_0_none
        -DTEST_EXECUTABLE1=$<TARGET_FILE:${executable1}>
        -DTEST_EXECUTABLE2=$<TARGET_FILE:${executable2}>
        -DTRACER=none
        -DLONG_TESTS=${LONG_TESTS}
        -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake)
endfunction()

add_libpmemobj_cpp(1.7)
add_libpmemobj_cpp(1.8.1)
add_libpmemobj_cpp(1.9)
add_libpmemobj_cpp(1.10)
add_libpmemobj_cpp(1.11)

build_test_with_cpp_version(1.7 version_1.7 version/version_1.7.cpp)
build_test_with_cpp_version(1.8.1 version_1.8.1 version/version_1.8.cpp)
build_test_with_cpp_version(1.9 version_1.9 version/version_1.9.cpp)
build_test_with_cpp_version(1.10 version_1.10 version/version_1.10.cpp)
build_test_with_cpp_version(1.11 version_1.11 version/version_1.11.cpp)

build_test_with_cpp_version(1.8.1 concurrent_hash_map_feature_size_1.8.1 concurrent_hash_map_feature_size/concurrent_hash_map_feature_size.cpp)
build_test_with_cpp_version(1.9 concurrent_hash_map_feature_size_1.9 concurrent_hash_map_feature_size/concurrent_hash_map_feature_size.cpp)
build_test_with_cpp_version(1.10 concurrent_hash_map_feature_size_1.10 concurrent_hash_map_feature_size/concurrent_hash_map_feature_size.cpp)
build_test_with_cpp_version(1.11 concurrent_hash_map_feature_size_1.11 concurrent_hash_map_feature_size/concurrent_hash_map_feature_size.cpp)
build_test_with_cpp_version(master concurrent_hash_map_feature_size_master concurrent_hash_map_feature_size/concurrent_hash_map_feature_size.cpp)

add_compatibility_test(concurrent_hash_map_feature_size_1.8.1_master_compatibility concurrent_hash_map_feature_size_1.8.1 concurrent_hash_map_feature_size_master)
add_compatibility_test(concurrent_hash_map_feature_size_master_1.8.1_compatibility concurrent_hash_map_feature_size_master concurrent_hash_map_feature_size_1.8.1)

add_compatibility_test(concurrent_hash_map_feature_size_1.9_master_compatibility concurrent_hash_map_feature_size_1.9 concurrent_hash_map_feature_size_master)
add_compatibility_test(concurrent_hash_map_feature_size_master_1.9_compatibility concurrent_hash_map_feature_size_master concurrent_hash_map_feature_size_1.9)

add_compatibility_test(concurrent_hash_map_feature_size_1.10_master_compatibility concurrent_hash_map_feature_size_1.10 concurrent_hash_map_feature_size_master)
add_compatibility_test(concurrent_hash_map_feature_size_master_1.10_compatibility concurrent_hash_map_feature_size_master concurrent_hash_map_feature_size_1.10)

add_compatibility_test(concurrent_hash_map_feature_size_1.11_master_compatibility concurrent_hash_map_feature_size_1.11 concurrent_hash_map_feature_size_master)
add_compatibility_test(concurrent_hash_map_feature_size_master_1.11_compatibility concurrent_hash_map_feature_size_master concurrent_hash_map_feature_size_1.11)