blob: c49d1bb71aa21326fa71a45f89ce7435e3353506 [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')
Amithash Prasade78634b2025-09-26 14:10:13 -070019subdir('environ')
Matt Johnston8c2bfb12024-11-07 15:31:32 +080020
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093021libpldm_link_args = []
22foreach alias : libpldm_deprecated_aliases
Andrew Jefferye984a462024-09-07 11:23:28 +020023 libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093024endforeach
25
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050026libpldm = library(
Andrew Jefferye984a462024-09-07 11:23:28 +020027 'pldm',
28 libpldm_sources,
29 implicit_include_directories: false,
30 include_directories: [libpldm_include_dir, include_directories('.')],
31 link_args: libpldm_link_args,
32 version: meson.project_version(),
33 gnu_symbol_visibility: 'hidden',
34 install: true,
35)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050036
37libpldm_dep = declare_dependency(
Andrew Jefferye984a462024-09-07 11:23:28 +020038 include_directories: libpldm_include_dir,
39 link_with: libpldm,
40)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050041
42import('pkgconfig').generate(
Andrew Jefferye984a462024-09-07 11:23:28 +020043 name: 'libpldm',
44 description: 'PLDM protocol encode/decode C lib',
45 version: meson.project_version(),
46 libraries: libpldm,
47)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103048
Andrew Jeffery65c64092024-11-29 11:52:13 +103049if get_option('tests')
Andrew Jefferye984a462024-09-07 11:23:28 +020050 c_suite = meson.get_compiler('c').get_id()
51 cpp_suite = meson.get_compiler('cpp').get_id()
Andrew Jeffery5664cf22023-11-08 15:58:50 +103052
Andrew Jeffery65c64092024-11-29 11:52:13 +103053 if get_option('abi-compliance-check') and c_suite == cpp_suite and c_suite == 'gcc'
Andrew Jefferye984a462024-09-07 11:23:28 +020054 host = host_machine.cpu_family()
55 baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(
56 c_suite,
57 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103058
Andrew Jefferye984a462024-09-07 11:23:28 +020059 abi_dumper = find_program(
60 'abi-dumper',
61 native: true,
62 required: get_option('abi-compliance-check'),
63 )
64 abi_compliance_checker = find_program(
65 'abi-compliance-checker',
66 native: true,
67 required: get_option('abi-compliance-check'),
68 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103069
Archana Kakanie78035e2025-01-30 03:56:13 -060070 test_abi_compliance = abi_dumper.found() and \
71 abi_compliance_checker.found() and \
72 import('fs').is_file(baseline_dump)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103073
Andrew Jefferye984a462024-09-07 11:23:28 +020074 if test_abi_compliance
75 current_dump = custom_target(
76 'abi-dump',
77 input: libpldm,
78 output: 'current.dump',
79 command: [
80 abi_dumper,
81 '-mixed-headers',
82 '-include-paths',
83 meson.project_source_root() / 'src',
84 '-public-headers',
85 meson.project_source_root() / 'include',
86 '-sort',
87 '@INPUT@',
88 '-o',
89 '@OUTPUT@',
90 '-lver',
91 meson.project_version(),
92 ],
93 )
94 abi_compliance = custom_target(
95 'abi-compliance',
96 input: [baseline_dump, current_dump],
97 output: 'abi-compliance',
98 command: [
99 abi_compliance_checker,
100 '-l',
101 meson.project_name(),
102 '-old',
103 '@INPUT0@',
104 '-new',
105 '@INPUT1@',
106 ],
107 build_by_default: true,
108 )
109 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030110 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030111endif