blob: 13f7d9e8e24f828a193409322711080297ade18d [file] [log] [blame]
Matt Johnstonbde874e2024-11-05 16:03:51 +08001libpldm_sources = files('control.c', 'responder.c', 'utils.c')
Andrew Jeffery9c766792022-08-10 23:12:49 +09302
Andrew Jeffery48761c62024-06-03 15:48:26 +09303subdir('dsp')
Matt Johnstonc69081a2024-10-11 15:01:39 +08004
5if get_option('transport')
6 subdir('requester')
7 subdir('transport')
8endif
Andrew Jeffery55e5e0a2023-06-05 12:33:16 +09309
Andrew Jefferyfef24ed2024-11-29 11:43:49 +103010if get_option('oem').contains('ibm')
Andrew Jefferye984a462024-09-07 11:23:28 +020011 subdir('oem/ibm')
Andrew Jeffery9c766792022-08-10 23:12:49 +093012endif
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050013
Andrew Jefferyfef24ed2024-11-29 11:43:49 +103014if get_option('oem').contains('meta')
Andrew Jefferye984a462024-09-07 11:23:28 +020015 subdir('oem/meta')
Delphine CC Chiu22fad392023-10-27 11:05:01 +080016endif
17
Matt Johnston8c2bfb12024-11-07 15:31:32 +080018subdir('firmware_device')
19
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093020libpldm_link_args = []
21foreach alias : libpldm_deprecated_aliases
Andrew Jefferye984a462024-09-07 11:23:28 +020022 libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093023endforeach
24
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050025libpldm = library(
Andrew Jefferye984a462024-09-07 11:23:28 +020026 'pldm',
27 libpldm_sources,
28 implicit_include_directories: false,
29 include_directories: [libpldm_include_dir, include_directories('.')],
30 link_args: libpldm_link_args,
31 version: meson.project_version(),
32 gnu_symbol_visibility: 'hidden',
33 install: true,
34)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050035
36libpldm_dep = declare_dependency(
Andrew Jefferye984a462024-09-07 11:23:28 +020037 include_directories: libpldm_include_dir,
38 link_with: libpldm,
39)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050040
41import('pkgconfig').generate(
Andrew Jefferye984a462024-09-07 11:23:28 +020042 name: 'libpldm',
43 description: 'PLDM protocol encode/decode C lib',
44 version: meson.project_version(),
45 libraries: libpldm,
46)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103047
Andrew Jeffery65c64092024-11-29 11:52:13 +103048if get_option('tests')
Andrew Jefferye984a462024-09-07 11:23:28 +020049 c_suite = meson.get_compiler('c').get_id()
50 cpp_suite = meson.get_compiler('cpp').get_id()
Andrew Jeffery5664cf22023-11-08 15:58:50 +103051
Andrew Jeffery65c64092024-11-29 11:52:13 +103052 if get_option('abi-compliance-check') and c_suite == cpp_suite and c_suite == 'gcc'
Andrew Jefferye984a462024-09-07 11:23:28 +020053 host = host_machine.cpu_family()
54 baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(
55 c_suite,
56 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103057
Andrew Jefferye984a462024-09-07 11:23:28 +020058 abi_dumper = find_program(
59 'abi-dumper',
60 native: true,
61 required: get_option('abi-compliance-check'),
62 )
63 abi_compliance_checker = find_program(
64 'abi-compliance-checker',
65 native: true,
66 required: get_option('abi-compliance-check'),
67 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103068
Archana Kakanie78035e2025-01-30 03:56:13 -060069 test_abi_compliance = abi_dumper.found() and \
70 abi_compliance_checker.found() and \
71 import('fs').is_file(baseline_dump)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103072
Andrew Jefferye984a462024-09-07 11:23:28 +020073 if test_abi_compliance
74 current_dump = custom_target(
75 'abi-dump',
76 input: libpldm,
77 output: 'current.dump',
78 command: [
79 abi_dumper,
80 '-mixed-headers',
81 '-include-paths',
82 meson.project_source_root() / 'src',
83 '-public-headers',
84 meson.project_source_root() / 'include',
85 '-sort',
86 '@INPUT@',
87 '-o',
88 '@OUTPUT@',
89 '-lver',
90 meson.project_version(),
91 ],
92 )
93 abi_compliance = custom_target(
94 'abi-compliance',
95 input: [baseline_dump, current_dump],
96 output: 'abi-compliance',
97 command: [
98 abi_compliance_checker,
99 '-l',
100 meson.project_name(),
101 '-old',
102 '@INPUT0@',
103 '-new',
104 '@INPUT1@',
105 ],
106 build_by_default: true,
107 )
108 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030109 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030110endif