Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 1 | project( |
| 2 | 'libpldm', |
| 3 | 'c', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 4 | default_options: [ |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 5 | 'debug=true', |
| 6 | 'optimization=g', |
| 7 | 'warning_level=3', |
| 8 | 'werror=true', |
| 9 | 'cpp_std=c++23', |
| 10 | 'c_std=c17', |
| 11 | 'b_ndebug=if-release', |
| 12 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 13 | ], |
Andrew Jeffery | 747a498 | 2024-09-07 11:05:43 +0200 | [diff] [blame] | 14 | version: '0.9.0', |
Patrick Williams | a9db43f | 2023-08-23 06:31:22 -0500 | [diff] [blame] | 15 | meson_version: '>=1.1.1', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 16 | ) |
| 17 | |
Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 18 | if get_option('tests').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 19 | add_languages('cpp') |
Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 20 | endif |
| 21 | |
Andrew Jeffery | 2b440d4 | 2024-07-25 10:36:08 +0930 | [diff] [blame] | 22 | # For memmem() in src/msgbuf.h |
| 23 | add_project_arguments('-D_GNU_SOURCE', language: ['c']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 24 | |
| 25 | compiler = meson.get_compiler('c') |
| 26 | conf = configuration_data() |
| 27 | if compiler.has_header('poll.h') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 28 | conf.set('PLDM_HAS_POLL', 1) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 29 | endif |
| 30 | |
| 31 | # ABI control |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 32 | visible = '__attribute__((visibility("default")))' |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 33 | libpldm_deprecated_aliases = [] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 34 | if get_option('abi').contains('deprecated') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 35 | conf.set('LIBPLDM_ABI_DEPRECATED', visible) |
| 36 | add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) |
| 37 | libpldm_deprecated_aliases += [ |
| 38 | ['get_fru_record_by_option_check', 'get_fru_record_by_option'], |
| 39 | [ |
| 40 | 'pldm_bios_table_append_pad_checksum_check', |
| 41 | 'pldm_bios_table_append_pad_checksum', |
| 42 | ], |
| 43 | [ |
| 44 | 'pldm_bios_table_attr_entry_enum_decode_def_num_check', |
| 45 | 'pldm_bios_table_attr_entry_enum_decode_def_num', |
| 46 | ], |
| 47 | [ |
| 48 | 'pldm_bios_table_attr_entry_enum_decode_pv_hdls_check', |
| 49 | 'pldm_bios_table_attr_entry_enum_decode_pv_hdls', |
| 50 | ], |
| 51 | [ |
| 52 | 'pldm_bios_table_attr_entry_enum_decode_pv_num_check', |
| 53 | 'pldm_bios_table_attr_entry_enum_decode_pv_num', |
| 54 | ], |
| 55 | [ |
| 56 | 'pldm_bios_table_attr_entry_enum_encode_check', |
| 57 | 'pldm_bios_table_attr_entry_enum_encode', |
| 58 | ], |
| 59 | [ |
| 60 | 'pldm_bios_table_attr_entry_integer_encode_check', |
| 61 | 'pldm_bios_table_attr_entry_integer_encode', |
| 62 | ], |
| 63 | [ |
| 64 | 'pldm_bios_table_attr_entry_string_decode_def_string_length_check', |
| 65 | 'pldm_bios_table_attr_entry_string_decode_def_string_length', |
| 66 | ], |
| 67 | [ |
| 68 | 'pldm_bios_table_attr_entry_string_encode_check', |
| 69 | 'pldm_bios_table_attr_entry_string_encode', |
| 70 | ], |
| 71 | [ |
| 72 | 'pldm_bios_table_attr_value_entry_encode_enum_check', |
| 73 | 'pldm_bios_table_attr_value_entry_encode_enum', |
| 74 | ], |
| 75 | [ |
| 76 | 'pldm_bios_table_attr_value_entry_encode_integer_check', |
| 77 | 'pldm_bios_table_attr_value_entry_encode_integer', |
| 78 | ], |
| 79 | [ |
| 80 | 'pldm_bios_table_attr_value_entry_encode_string_check', |
| 81 | 'pldm_bios_table_attr_value_entry_encode_string', |
| 82 | ], |
| 83 | [ |
| 84 | 'pldm_bios_table_string_entry_decode_string_check', |
| 85 | 'pldm_bios_table_string_entry_decode_string', |
| 86 | ], |
| 87 | [ |
| 88 | 'pldm_bios_table_string_entry_encode_check', |
| 89 | 'pldm_bios_table_string_entry_encode', |
| 90 | ], |
| 91 | [ |
| 92 | 'pldm_entity_association_pdr_add_check', |
| 93 | 'pldm_entity_association_pdr_add', |
| 94 | ], |
| 95 | [ |
| 96 | 'pldm_entity_association_pdr_add_from_node_check', |
| 97 | 'pldm_entity_association_pdr_add_from_node', |
| 98 | ], |
| 99 | ['pldm_pdr_add_check', 'pldm_pdr_add'], |
| 100 | ['pldm_pdr_add_fru_record_set_check', 'pldm_pdr_add_fru_record_set'], |
| 101 | ] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 102 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 103 | conf.set('LIBPLDM_ABI_DEPRECATED', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 104 | endif |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 105 | conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 106 | if get_option('abi').contains('testing') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 107 | conf.set('LIBPLDM_ABI_TESTING', visible) |
| 108 | add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 109 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 110 | conf.set('LIBPLDM_ABI_TESTING', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 111 | endif |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 112 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 113 | config = configure_file(output: 'config.h', configuration: conf) |
Andrew Jeffery | f89befe | 2023-06-16 13:02:09 +0930 | [diff] [blame] | 114 | |
| 115 | add_project_arguments('-include', '@0@'.format(config), language: 'c') |
| 116 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 117 | libpldm_include_dir = include_directories('include', is_system: true) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 118 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 119 | subdir('include') |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 120 | subdir('src') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 121 | |
Andrew Jeffery | d126936 | 2023-11-08 15:54:35 +1030 | [diff] [blame] | 122 | if get_option('tests').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 123 | subdir('tests') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 124 | endif |
Rashmica Gupta | 6af2a29 | 2023-04-27 14:20:17 +1000 | [diff] [blame] | 125 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 126 | install_subdir( |
| 127 | 'instance-db', |
| 128 | install_mode: 'r--r--r--', |
| 129 | install_dir: get_option('datadir') / meson.project_name(), |
| 130 | ) |