xref: /openbmc/libpldm/src/meson.build (revision d12dd36e)
1libpldm_sources = files(
2  'base.c',
3  'bios.c',
4  'platform.c',
5  'bios_table.c',
6  'firmware_update.c',
7  'fru.c',
8  'pdr.c',
9  'responder.c',
10  'utils.c'
11  )
12
13subdir('requester')
14subdir('transport')
15
16if get_option('oem-ibm').allowed()
17   subdir('oem/ibm')
18endif
19
20libpldm = library(
21  'pldm',
22   libpldm_sources,
23   implicit_include_directories: false,
24   include_directories: [
25     libpldm_include_dir,
26     include_directories('.')
27   ],
28   version: meson.project_version(),
29   gnu_symbol_visibility: 'hidden',
30   install: true
31   )
32
33libpldm_dep = declare_dependency(
34  include_directories: libpldm_include_dir,
35  link_with: libpldm)
36
37import('pkgconfig').generate(
38  name: 'libpldm',
39  description: 'PLDM protocol encode/decode C lib',
40  version: meson.project_version(),
41  libraries: libpldm)
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(c_suite)
50
51    abi_dumper = find_program('abi-dumper',
52                              native: true,
53                              required: get_option('abi-compliance-check'))
54    abi_compliance_checker = find_program('abi-compliance-checker',
55                                          native: true,
56                                          required: get_option('abi-compliance-check'))
57
58    test_abi_compliance = abi_dumper.found() and \
59                          abi_compliance_checker.found() and \
60                          import('fs').is_file(baseline_dump)
61
62    if test_abi_compliance
63      current_dump = custom_target('abi-dump',
64                               input: libpldm,
65                               output: 'current.dump',
66                               command: [ abi_dumper,
67                                          '-public-headers',
68                                          meson.project_source_root() / 'include',
69                                          '@INPUT@',
70                                          '-o',
71                                          '@OUTPUT@',
72                                          '-lver',
73                                          meson.project_version()])
74      abi_compliance = custom_target('abi-compliance',
75                                     input: [baseline_dump, current_dump],
76                                     output: 'abi-compliance',
77                                     command: [ abi_compliance_checker,
78                                                '-l',
79                                                meson.project_name(),
80                                                '-old',
81                                                '@INPUT0@',
82                                                '-new',
83                                                '@INPUT1@' ],
84                                                build_by_default: true)
85    endif
86  endif
87endif
88