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