xref: /openbmc/libpldm/src/meson.build (revision 0ee03b5b)
1libpldm_sources = files(
2  'responder.c',
3  'utils.c'
4)
5
6subdir('dsp')
7subdir('requester')
8subdir('transport')
9
10if get_option('oem-ibm').allowed()
11   subdir('oem/ibm')
12endif
13
14if get_option('oem-meta').allowed()
15   subdir('oem/meta')
16endif
17
18libpldm = library(
19  'pldm',
20   libpldm_sources,
21   implicit_include_directories: false,
22   include_directories: [
23     libpldm_include_dir,
24     include_directories('.')
25   ],
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
35import('pkgconfig').generate(
36  name: 'libpldm',
37  description: 'PLDM protocol encode/decode C lib',
38  version: meson.project_version(),
39  libraries: libpldm)
40
41if get_option('tests').allowed()
42  c_suite = meson.get_compiler('c').get_id()
43  cpp_suite = meson.get_compiler('cpp').get_id()
44
45  if get_option('abi-compliance-check').allowed() and c_suite == cpp_suite and c_suite == 'gcc'
46    host = host_machine.cpu_family()
47    baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(c_suite)
48
49    abi_dumper = find_program('abi-dumper',
50                              native: true,
51                              required: get_option('abi-compliance-check'))
52    abi_compliance_checker = find_program('abi-compliance-checker',
53                                          native: true,
54                                          required: get_option('abi-compliance-check'))
55
56    test_abi_compliance = abi_dumper.found() and \
57                          abi_compliance_checker.found() and \
58                          import('fs').is_file(baseline_dump)
59
60    if test_abi_compliance
61      current_dump = custom_target('abi-dump',
62                               input: libpldm,
63                               output: 'current.dump',
64                               command: [ abi_dumper,
65                                          '-mixed-headers',
66                                          '-include-paths',
67                                          meson.project_source_root() / 'src',
68                                          '-public-headers',
69                                          meson.project_source_root() / 'include',
70                                          '-sort',
71                                          '@INPUT@',
72                                          '-o',
73                                          '@OUTPUT@',
74                                          '-lver',
75                                          meson.project_version()])
76      abi_compliance = custom_target('abi-compliance',
77                                     input: [baseline_dump, current_dump],
78                                     output: 'abi-compliance',
79                                     command: [ abi_compliance_checker,
80                                                '-l',
81                                                meson.project_name(),
82                                                '-old',
83                                                '@INPUT0@',
84                                                '-new',
85                                                '@INPUT1@' ],
86                                                build_by_default: true)
87    endif
88  endif
89endif
90