xref: /openbmc/libpldm/src/meson.build (revision 615344fc)
1libpldm_sources = files('responder.c', 'utils.c')
2
3subdir('dsp')
4subdir('requester')
5subdir('transport')
6
7if get_option('oem-ibm').allowed()
8    subdir('oem/ibm')
9endif
10
11if get_option('oem-meta').allowed()
12    subdir('oem/meta')
13endif
14
15libpldm_link_args = []
16foreach alias : libpldm_deprecated_aliases
17    libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
18endforeach
19
20libpldm = library(
21    'pldm',
22    libpldm_sources,
23    implicit_include_directories: false,
24    include_directories: [libpldm_include_dir, include_directories('.')],
25    link_args: libpldm_link_args,
26    version: meson.project_version(),
27    gnu_symbol_visibility: 'hidden',
28    install: true,
29)
30
31libpldm_dep = declare_dependency(
32    include_directories: libpldm_include_dir,
33    link_with: libpldm,
34)
35
36import('pkgconfig').generate(
37    name: 'libpldm',
38    description: 'PLDM protocol encode/decode C lib',
39    version: meson.project_version(),
40    libraries: libpldm,
41)
42
43if get_option('tests').allowed()
44    c_suite = meson.get_compiler('c').get_id()
45    cpp_suite = meson.get_compiler('cpp').get_id()
46
47    if get_option('abi-compliance-check').allowed() and c_suite == cpp_suite and c_suite == 'gcc'
48        host = host_machine.cpu_family()
49        baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(
50            c_suite,
51        )
52
53        abi_dumper = find_program(
54            'abi-dumper',
55            native: true,
56            required: get_option('abi-compliance-check'),
57        )
58        abi_compliance_checker = find_program(
59            'abi-compliance-checker',
60            native: true,
61            required: get_option('abi-compliance-check'),
62        )
63
64        test_abi_compliance = abi_dumper.found() and\
65abi_compliance_checker.found() and\
66import('fs').is_file(baseline_dump)
67
68        if test_abi_compliance
69            current_dump = custom_target(
70                'abi-dump',
71                input: libpldm,
72                output: 'current.dump',
73                command: [
74                    abi_dumper,
75                    '-mixed-headers',
76                    '-include-paths',
77                    meson.project_source_root() / 'src',
78                    '-public-headers',
79                    meson.project_source_root() / 'include',
80                    '-sort',
81                    '@INPUT@',
82                    '-o',
83                    '@OUTPUT@',
84                    '-lver',
85                    meson.project_version(),
86                ],
87            )
88            abi_compliance = custom_target(
89                'abi-compliance',
90                input: [baseline_dump, current_dump],
91                output: 'abi-compliance',
92                command: [
93                    abi_compliance_checker,
94                    '-l',
95                    meson.project_name(),
96                    '-old',
97                    '@INPUT0@',
98                    '-new',
99                    '@INPUT1@',
100                ],
101                build_by_default: true,
102            )
103        endif
104    endif
105endif
106