blob: a8e54e7dc3941846e7449fc6f6e86a0a93387dbc [file] [log] [blame]
Andrew Jefferye984a462024-09-07 11:23:28 +02001libpldm_sources = files('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
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093018libpldm_link_args = []
19foreach alias : libpldm_deprecated_aliases
Andrew Jefferye984a462024-09-07 11:23:28 +020020 libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093021endforeach
22
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050023libpldm = library(
Andrew Jefferye984a462024-09-07 11:23:28 +020024 'pldm',
25 libpldm_sources,
26 implicit_include_directories: false,
27 include_directories: [libpldm_include_dir, include_directories('.')],
28 link_args: libpldm_link_args,
29 version: meson.project_version(),
30 gnu_symbol_visibility: 'hidden',
31 install: true,
32)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050033
34libpldm_dep = declare_dependency(
Andrew Jefferye984a462024-09-07 11:23:28 +020035 include_directories: libpldm_include_dir,
36 link_with: libpldm,
37)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050038
39import('pkgconfig').generate(
Andrew Jefferye984a462024-09-07 11:23:28 +020040 name: 'libpldm',
41 description: 'PLDM protocol encode/decode C lib',
42 version: meson.project_version(),
43 libraries: libpldm,
44)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103045
Andrew Jeffery65c64092024-11-29 11:52:13 +103046if get_option('tests')
Andrew Jefferye984a462024-09-07 11:23:28 +020047 c_suite = meson.get_compiler('c').get_id()
48 cpp_suite = meson.get_compiler('cpp').get_id()
Andrew Jeffery5664cf22023-11-08 15:58:50 +103049
Andrew Jeffery65c64092024-11-29 11:52:13 +103050 if get_option('abi-compliance-check') and c_suite == cpp_suite and c_suite == 'gcc'
Andrew Jefferye984a462024-09-07 11:23:28 +020051 host = host_machine.cpu_family()
52 baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(
53 c_suite,
54 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103055
Andrew Jefferye984a462024-09-07 11:23:28 +020056 abi_dumper = find_program(
57 'abi-dumper',
58 native: true,
59 required: get_option('abi-compliance-check'),
60 )
61 abi_compliance_checker = find_program(
62 'abi-compliance-checker',
63 native: true,
64 required: get_option('abi-compliance-check'),
65 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103066
Andrew Jefferye984a462024-09-07 11:23:28 +020067 test_abi_compliance = abi_dumper.found() and\
68abi_compliance_checker.found() and\
69import('fs').is_file(baseline_dump)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103070
Andrew Jefferye984a462024-09-07 11:23:28 +020071 if test_abi_compliance
72 current_dump = custom_target(
73 'abi-dump',
74 input: libpldm,
75 output: 'current.dump',
76 command: [
77 abi_dumper,
78 '-mixed-headers',
79 '-include-paths',
80 meson.project_source_root() / 'src',
81 '-public-headers',
82 meson.project_source_root() / 'include',
83 '-sort',
84 '@INPUT@',
85 '-o',
86 '@OUTPUT@',
87 '-lver',
88 meson.project_version(),
89 ],
90 )
91 abi_compliance = custom_target(
92 'abi-compliance',
93 input: [baseline_dump, current_dump],
94 output: 'abi-compliance',
95 command: [
96 abi_compliance_checker,
97 '-l',
98 meson.project_name(),
99 '-old',
100 '@INPUT0@',
101 '-new',
102 '@INPUT1@',
103 ],
104 build_by_default: true,
105 )
106 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030107 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030108endif