blob: 5242eed024720e75d9fba32b04becf1bec5bf5c2 [file] [log] [blame]
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -05001libpldm_sources = files(
Andrew Jefferycc45aed2023-09-10 23:03:29 +09302 'responder.c',
Andrew Jeffery9c766792022-08-10 23:12:49 +09303 'utils.c'
Andrew Jeffery48761c62024-06-03 15:48:26 +09304)
Andrew Jeffery9c766792022-08-10 23:12:49 +09305
Andrew Jeffery48761c62024-06-03 15:48:26 +09306subdir('dsp')
Andrew Jeffery55e5e0a2023-06-05 12:33:16 +09307subdir('requester')
8subdir('transport')
9
Andrew Jeffery8de8e1e2023-06-09 14:37:18 +093010if get_option('oem-ibm').allowed()
Andrew Jeffery9c766792022-08-10 23:12:49 +093011 subdir('oem/ibm')
12endif
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050013
Delphine CC Chiu22fad392023-10-27 11:05:01 +080014if get_option('oem-meta').allowed()
15 subdir('oem/meta')
16endif
17
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093018libpldm_link_args = []
19foreach alias : libpldm_deprecated_aliases
20 libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
21endforeach
22
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050023libpldm = library(
24 'pldm',
25 libpldm_sources,
26 implicit_include_directories: false,
27 include_directories: [
28 libpldm_include_dir,
29 include_directories('.')
30 ],
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093031 link_args: libpldm_link_args,
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050032 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)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103046
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,
Andrew Jeffery1077d2d2023-11-28 10:15:36 +103071 '-mixed-headers',
72 '-include-paths',
73 meson.project_source_root() / 'src',
Andrew Jeffery5664cf22023-11-08 15:58:50 +103074 '-public-headers',
75 meson.project_source_root() / 'include',
Andrew Jeffery75eea492023-11-28 10:12:08 +103076 '-sort',
Andrew Jeffery5664cf22023-11-08 15:58:50 +103077 '@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