Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 1 | libpldm_sources = files('responder.c', 'utils.c') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 2 | |
Andrew Jeffery | 48761c6 | 2024-06-03 15:48:26 +0930 | [diff] [blame] | 3 | subdir('dsp') |
Matt Johnston | c69081a | 2024-10-11 15:01:39 +0800 | [diff] [blame] | 4 | |
| 5 | if get_option('transport') |
| 6 | subdir('requester') |
| 7 | subdir('transport') |
| 8 | endif |
Andrew Jeffery | 55e5e0a | 2023-06-05 12:33:16 +0930 | [diff] [blame] | 9 | |
Andrew Jeffery | fef24ed | 2024-11-29 11:43:49 +1030 | [diff] [blame] | 10 | if get_option('oem').contains('ibm') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 11 | subdir('oem/ibm') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 12 | endif |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 13 | |
Andrew Jeffery | fef24ed | 2024-11-29 11:43:49 +1030 | [diff] [blame] | 14 | if get_option('oem').contains('meta') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 15 | subdir('oem/meta') |
Delphine CC Chiu | 22fad39 | 2023-10-27 11:05:01 +0800 | [diff] [blame] | 16 | endif |
| 17 | |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 18 | libpldm_link_args = [] |
| 19 | foreach alias : libpldm_deprecated_aliases |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 20 | libpldm_link_args += '-Wl,--defsym=@0@=@1@'.format(alias[0], alias[1]) |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 21 | endforeach |
| 22 | |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 23 | libpldm = library( |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 24 | '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 Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 33 | |
| 34 | libpldm_dep = declare_dependency( |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 35 | include_directories: libpldm_include_dir, |
| 36 | link_with: libpldm, |
| 37 | ) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 38 | |
| 39 | import('pkgconfig').generate( |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 40 | name: 'libpldm', |
| 41 | description: 'PLDM protocol encode/decode C lib', |
| 42 | version: meson.project_version(), |
| 43 | libraries: libpldm, |
| 44 | ) |
Andrew Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 45 | |
Andrew Jeffery | 65c6409 | 2024-11-29 11:52:13 +1030 | [diff] [blame] | 46 | if get_option('tests') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 47 | c_suite = meson.get_compiler('c').get_id() |
| 48 | cpp_suite = meson.get_compiler('cpp').get_id() |
Andrew Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 49 | |
Andrew Jeffery | 65c6409 | 2024-11-29 11:52:13 +1030 | [diff] [blame] | 50 | if get_option('abi-compliance-check') and c_suite == cpp_suite and c_suite == 'gcc' |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 51 | host = host_machine.cpu_family() |
| 52 | baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format( |
| 53 | c_suite, |
| 54 | ) |
Andrew Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 55 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 56 | 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 Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 66 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 67 | test_abi_compliance = abi_dumper.found() and\ |
| 68 | abi_compliance_checker.found() and\ |
| 69 | import('fs').is_file(baseline_dump) |
Andrew Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 70 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 71 | 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 Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 107 | endif |
Andrew Jeffery | 5664cf2 | 2023-11-08 15:58:50 +1030 | [diff] [blame] | 108 | endif |