xref: /openbmc/libpldm/src/meson.build (revision dc7d3b5b)
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
20if get_option('oem-meta').allowed()
21   subdir('oem/meta')
22endif
23
24libpldm = library(
25  'pldm',
26   libpldm_sources,
27   implicit_include_directories: false,
28   include_directories: [
29     libpldm_include_dir,
30     include_directories('.')
31   ],
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