xref: /openbmc/libpldm/bindings/cpp/meson.build (revision d6a957481638b00a49aed15d04b60d3d32fede54)
1libpldmpp_sources = files('firmware_update.cpp', 'types.cpp', 'utils.cpp')
2
3libpldmpp = library(
4    'pldm++',
5    libpldmpp_sources,
6    implicit_include_directories: false,
7    include_directories: [include_root, include_directories('.')],
8    link_args: libpldm_link_args,
9    version: meson.project_version(),
10    dependencies: [libpldm_dep],
11    gnu_symbol_visibility: 'hidden',
12    install: true,
13)
14
15libpldmpp_dep = declare_dependency(
16    include_directories: include_root,
17    link_with: libpldmpp,
18)
19
20c_suite = meson.get_compiler('c').get_id()
21cpp_suite = meson.get_compiler('cpp').get_id()
22
23if get_option('tests') and get_option('abi-compliance-check') and c_suite == cpp_suite and c_suite == 'gcc'
24
25    message('running C++ binding ABI compliance check')
26
27    host = host_machine.cpu_family()
28    baseline_dump_cpp = meson.project_source_root() / 'abi' / host / 'libpldm++/@0@.dump'.format(
29        cpp_suite,
30    )
31
32    current_dump_cpp = custom_target(
33        'abi-dump-cpp',
34        input: libpldmpp,
35        output: 'current.dump',
36        command: [
37            abi_dumper,
38            '-mixed-headers',
39            '-include-paths',
40            meson.project_source_root() / 'bindings/cpp',
41            '-public-headers',
42            meson.project_source_root() / 'include/libpldm++',
43            '-sort',
44            '@INPUT@',
45            '-o',
46            '@OUTPUT@',
47            '-lver',
48            meson.project_version(),
49        ],
50    )
51    abi_compliance_cpp = custom_target(
52        'abi-compliance-cpp',
53        input: [baseline_dump_cpp, current_dump_cpp],
54        output: 'abi-compliance-cpp',
55        command: [
56            abi_compliance_checker,
57            '-l',
58            meson.project_name() + 'plus',
59            '-old',
60            '@INPUT0@',
61            '-new',
62            '@INPUT1@',
63        ],
64        build_by_default: true,
65    )
66endif
67