blob: a4c86093dea4bb78066719b8968bc264ae68d89b [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')
Andrew Jeffery55e5e0a2023-06-05 12:33:16 +09304subdir('requester')
5subdir('transport')
6
Andrew Jeffery8de8e1e2023-06-09 14:37:18 +09307if get_option('oem-ibm').allowed()
Andrew Jefferye984a462024-09-07 11:23:28 +02008 subdir('oem/ibm')
Andrew Jeffery9c766792022-08-10 23:12:49 +09309endif
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050010
Delphine CC Chiu22fad392023-10-27 11:05:01 +080011if get_option('oem-meta').allowed()
Andrew Jefferye984a462024-09-07 11:23:28 +020012 subdir('oem/meta')
Delphine CC Chiu22fad392023-10-27 11:05:01 +080013endif
14
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093015libpldm_link_args = []
16foreach alias : libpldm_deprecated_aliases
Andrew Jefferye984a462024-09-07 11:23:28 +020017 libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093018endforeach
19
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050020libpldm = library(
Andrew Jefferye984a462024-09-07 11:23:28 +020021 'pldm',
22 libpldm_sources,
23 implicit_include_directories: false,
24 include_directories: [libpldm_include_dir, include_directories('.')],
25 link_args: libpldm_link_args,
26 version: meson.project_version(),
27 gnu_symbol_visibility: 'hidden',
28 install: true,
29)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050030
31libpldm_dep = declare_dependency(
Andrew Jefferye984a462024-09-07 11:23:28 +020032 include_directories: libpldm_include_dir,
33 link_with: libpldm,
34)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050035
36import('pkgconfig').generate(
Andrew Jefferye984a462024-09-07 11:23:28 +020037 name: 'libpldm',
38 description: 'PLDM protocol encode/decode C lib',
39 version: meson.project_version(),
40 libraries: libpldm,
41)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103042
43if get_option('tests').allowed()
Andrew Jefferye984a462024-09-07 11:23:28 +020044 c_suite = meson.get_compiler('c').get_id()
45 cpp_suite = meson.get_compiler('cpp').get_id()
Andrew Jeffery5664cf22023-11-08 15:58:50 +103046
Andrew Jefferye984a462024-09-07 11:23:28 +020047 if get_option('abi-compliance-check').allowed() and c_suite == cpp_suite and c_suite == 'gcc'
48 host = host_machine.cpu_family()
49 baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(
50 c_suite,
51 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103052
Andrew Jefferye984a462024-09-07 11:23:28 +020053 abi_dumper = find_program(
54 'abi-dumper',
55 native: true,
56 required: get_option('abi-compliance-check'),
57 )
58 abi_compliance_checker = find_program(
59 'abi-compliance-checker',
60 native: true,
61 required: get_option('abi-compliance-check'),
62 )
Andrew Jeffery5664cf22023-11-08 15:58:50 +103063
Andrew Jefferye984a462024-09-07 11:23:28 +020064 test_abi_compliance = abi_dumper.found() and\
65abi_compliance_checker.found() and\
66import('fs').is_file(baseline_dump)
Andrew Jeffery5664cf22023-11-08 15:58:50 +103067
Andrew Jefferye984a462024-09-07 11:23:28 +020068 if test_abi_compliance
69 current_dump = custom_target(
70 'abi-dump',
71 input: libpldm,
72 output: 'current.dump',
73 command: [
74 abi_dumper,
75 '-mixed-headers',
76 '-include-paths',
77 meson.project_source_root() / 'src',
78 '-public-headers',
79 meson.project_source_root() / 'include',
80 '-sort',
81 '@INPUT@',
82 '-o',
83 '@OUTPUT@',
84 '-lver',
85 meson.project_version(),
86 ],
87 )
88 abi_compliance = custom_target(
89 'abi-compliance',
90 input: [baseline_dump, current_dump],
91 output: 'abi-compliance',
92 command: [
93 abi_compliance_checker,
94 '-l',
95 meson.project_name(),
96 '-old',
97 '@INPUT0@',
98 '-new',
99 '@INPUT1@',
100 ],
101 build_by_default: true,
102 )
103 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030104 endif
Andrew Jeffery5664cf22023-11-08 15:58:50 +1030105endif