Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 1 | project('libpldm', 'c', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 2 | default_options: [ |
Andrew Jeffery | 953bc8c | 2023-05-22 15:24:17 +0930 | [diff] [blame] | 3 | 'debug=true', |
| 4 | 'optimization=g', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 5 | 'warning_level=3', |
| 6 | 'werror=true', |
| 7 | 'cpp_std=c++20', |
| 8 | 'c_std=c17', |
Andrew Jeffery | 5cf32ea | 2023-07-03 13:40:00 +0930 | [diff] [blame] | 9 | 'b_ndebug=if-release', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 10 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), |
| 11 | ], |
Andrew Jeffery | c166dd5 | 2024-05-22 15:45:34 +0930 | [diff] [blame] | 12 | version: '0.8.0', |
George Liu | bfd06e4 | 2023-08-16 10:30:13 +0800 | [diff] [blame] | 13 | meson_version: '>=1.1.0', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 14 | ) |
| 15 | |
Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 16 | if get_option('tests').allowed() |
| 17 | add_languages('cpp') |
| 18 | endif |
| 19 | |
Andrew Jeffery | 2b440d4 | 2024-07-25 10:36:08 +0930 | [diff] [blame] | 20 | # For memmem() in src/msgbuf.h |
| 21 | add_project_arguments('-D_GNU_SOURCE', language: ['c']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 22 | |
| 23 | compiler = meson.get_compiler('c') |
| 24 | conf = configuration_data() |
| 25 | if compiler.has_header('poll.h') |
| 26 | conf.set('PLDM_HAS_POLL', 1) |
| 27 | endif |
| 28 | |
| 29 | # ABI control |
| 30 | visible = '__attribute__((visibility("default")))' |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 31 | libpldm_deprecated_aliases = [] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 32 | if get_option('abi').contains('deprecated') |
| 33 | conf.set('LIBPLDM_ABI_DEPRECATED', visible) |
| 34 | add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 35 | libpldm_deprecated_aliases += [ |
| 36 | ['get_fru_record_by_option_check', 'get_fru_record_by_option'], |
Andrew Jeffery | d8bb75c | 2024-06-29 22:29:02 +0930 | [diff] [blame^] | 37 | ['pldm_bios_table_append_pad_checksum_check', 'pldm_bios_table_append_pad_checksum'], |
Andrew Jeffery | 46673f4 | 2024-06-25 16:02:25 +0930 | [diff] [blame] | 38 | ['pldm_bios_table_attr_entry_enum_decode_def_num_check', 'pldm_bios_table_attr_entry_enum_decode_def_num'], |
Andrew Jeffery | 82b4d3b | 2024-06-25 16:22:36 +0930 | [diff] [blame] | 39 | ['pldm_bios_table_attr_entry_enum_decode_pv_hdls_check', 'pldm_bios_table_attr_entry_enum_decode_pv_hdls'], |
Andrew Jeffery | b06882f | 2024-06-25 15:52:02 +0930 | [diff] [blame] | 40 | ['pldm_bios_table_attr_entry_enum_decode_pv_num_check', 'pldm_bios_table_attr_entry_enum_decode_pv_num'], |
Andrew Jeffery | 7126b1d | 2024-06-25 15:48:34 +0930 | [diff] [blame] | 41 | ['pldm_bios_table_attr_entry_enum_encode_check', 'pldm_bios_table_attr_entry_enum_encode'], |
Andrew Jeffery | 5347e27 | 2024-06-29 22:05:36 +0930 | [diff] [blame] | 42 | ['pldm_bios_table_attr_entry_integer_encode_check', 'pldm_bios_table_attr_entry_integer_encode'], |
Andrew Jeffery | c668ffc | 2024-06-25 16:50:08 +0930 | [diff] [blame] | 43 | ['pldm_bios_table_attr_entry_string_decode_def_string_length_check', 'pldm_bios_table_attr_entry_string_decode_def_string_length'], |
Andrew Jeffery | f6be493 | 2024-06-25 16:44:06 +0930 | [diff] [blame] | 44 | ['pldm_bios_table_attr_entry_string_encode_check', 'pldm_bios_table_attr_entry_string_encode'], |
Andrew Jeffery | 09004d6 | 2024-06-29 22:12:15 +0930 | [diff] [blame] | 45 | ['pldm_bios_table_attr_value_entry_encode_enum_check', 'pldm_bios_table_attr_value_entry_encode_enum'], |
Andrew Jeffery | 504dd17 | 2024-06-29 22:23:15 +0930 | [diff] [blame] | 46 | ['pldm_bios_table_attr_value_entry_encode_integer_check', 'pldm_bios_table_attr_value_entry_encode_integer'], |
Andrew Jeffery | 1a3983c | 2024-06-29 22:17:58 +0930 | [diff] [blame] | 47 | ['pldm_bios_table_attr_value_entry_encode_string_check', 'pldm_bios_table_attr_value_entry_encode_string'], |
Andrew Jeffery | 8c37ab3 | 2024-06-25 15:34:27 +0930 | [diff] [blame] | 48 | ['pldm_bios_table_string_entry_decode_string_check', 'pldm_bios_table_string_entry_decode_string'], |
Andrew Jeffery | e48fdd6 | 2024-06-25 00:36:20 +0930 | [diff] [blame] | 49 | ['pldm_bios_table_string_entry_encode_check', 'pldm_bios_table_string_entry_encode'], |
Andrew Jeffery | d72ea4b | 2024-06-24 21:33:33 +0930 | [diff] [blame] | 50 | ['pldm_entity_association_pdr_add_check', 'pldm_entity_association_pdr_add'], |
Andrew Jeffery | aa49b71 | 2024-06-24 21:43:52 +0930 | [diff] [blame] | 51 | ['pldm_entity_association_pdr_add_from_node_check', 'pldm_entity_association_pdr_add_from_node'], |
Andrew Jeffery | fae3641 | 2024-06-20 06:35:51 +0000 | [diff] [blame] | 52 | ['pldm_pdr_add_check', 'pldm_pdr_add'], |
Andrew Jeffery | e7f5511 | 2024-06-20 16:16:01 +0930 | [diff] [blame] | 53 | ['pldm_pdr_add_fru_record_set_check', 'pldm_pdr_add_fru_record_set'], |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 54 | ] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 55 | else |
| 56 | conf.set('LIBPLDM_ABI_DEPRECATED', '') |
| 57 | endif |
| 58 | conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols |
| 59 | if get_option('abi').contains('testing') |
| 60 | conf.set('LIBPLDM_ABI_TESTING', visible) |
| 61 | add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) |
| 62 | else |
| 63 | conf.set('LIBPLDM_ABI_TESTING', '') |
| 64 | endif |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 65 | |
Andrew Jeffery | f89befe | 2023-06-16 13:02:09 +0930 | [diff] [blame] | 66 | config = configure_file(output: 'config.h', |
| 67 | configuration: conf |
| 68 | ) |
| 69 | |
| 70 | add_project_arguments('-include', '@0@'.format(config), language: 'c') |
| 71 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 72 | libpldm_include_dir = include_directories('include', is_system: true) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 73 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 74 | subdir('include') |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 75 | subdir('src') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 76 | |
Andrew Jeffery | d126936 | 2023-11-08 15:54:35 +1030 | [diff] [blame] | 77 | if get_option('tests').allowed() |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 78 | subdir('tests') |
| 79 | endif |
Rashmica Gupta | 6af2a29 | 2023-04-27 14:20:17 +1000 | [diff] [blame] | 80 | |
| 81 | install_subdir('instance-db', |
| 82 | install_mode: 'r--r--r--', |
| 83 | install_dir: get_option('datadir') / meson.project_name()) |