1project('libpldm', 'c', 2 default_options: [ 3 'debug=true', 4 'optimization=g', 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++20', 8 'c_std=c17', 9 'b_ndebug=if-release', 10 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), 11 ], 12 version: '0.8.0', 13 meson_version: '>=1.1.0', 14) 15 16if get_option('tests').allowed() 17 add_languages('cpp') 18endif 19 20# For memmem() in src/msgbuf.h 21add_project_arguments('-D_GNU_SOURCE', language: ['c']) 22 23compiler = meson.get_compiler('c') 24conf = configuration_data() 25if compiler.has_header('poll.h') 26 conf.set('PLDM_HAS_POLL', 1) 27endif 28 29# ABI control 30visible = '__attribute__((visibility("default")))' 31libpldm_deprecated_aliases = [] 32if get_option('abi').contains('deprecated') 33 conf.set('LIBPLDM_ABI_DEPRECATED', visible) 34 add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) 35 libpldm_deprecated_aliases += [ 36 ['get_fru_record_by_option_check', 'get_fru_record_by_option'], 37 ['pldm_bios_table_append_pad_checksum_check', 'pldm_bios_table_append_pad_checksum'], 38 ['pldm_bios_table_attr_entry_enum_decode_def_num_check', 'pldm_bios_table_attr_entry_enum_decode_def_num'], 39 ['pldm_bios_table_attr_entry_enum_decode_pv_hdls_check', 'pldm_bios_table_attr_entry_enum_decode_pv_hdls'], 40 ['pldm_bios_table_attr_entry_enum_decode_pv_num_check', 'pldm_bios_table_attr_entry_enum_decode_pv_num'], 41 ['pldm_bios_table_attr_entry_enum_encode_check', 'pldm_bios_table_attr_entry_enum_encode'], 42 ['pldm_bios_table_attr_entry_integer_encode_check', 'pldm_bios_table_attr_entry_integer_encode'], 43 ['pldm_bios_table_attr_entry_string_decode_def_string_length_check', 'pldm_bios_table_attr_entry_string_decode_def_string_length'], 44 ['pldm_bios_table_attr_entry_string_encode_check', 'pldm_bios_table_attr_entry_string_encode'], 45 ['pldm_bios_table_attr_value_entry_encode_enum_check', 'pldm_bios_table_attr_value_entry_encode_enum'], 46 ['pldm_bios_table_attr_value_entry_encode_integer_check', 'pldm_bios_table_attr_value_entry_encode_integer'], 47 ['pldm_bios_table_attr_value_entry_encode_string_check', 'pldm_bios_table_attr_value_entry_encode_string'], 48 ['pldm_bios_table_string_entry_decode_string_check', 'pldm_bios_table_string_entry_decode_string'], 49 ['pldm_bios_table_string_entry_encode_check', 'pldm_bios_table_string_entry_encode'], 50 ['pldm_entity_association_pdr_add_check', 'pldm_entity_association_pdr_add'], 51 ['pldm_entity_association_pdr_add_from_node_check', 'pldm_entity_association_pdr_add_from_node'], 52 ['pldm_pdr_add_check', 'pldm_pdr_add'], 53 ['pldm_pdr_add_fru_record_set_check', 'pldm_pdr_add_fru_record_set'], 54 ] 55else 56 conf.set('LIBPLDM_ABI_DEPRECATED', '') 57endif 58conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols 59if get_option('abi').contains('testing') 60 conf.set('LIBPLDM_ABI_TESTING', visible) 61 add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) 62else 63 conf.set('LIBPLDM_ABI_TESTING', '') 64endif 65 66config = configure_file(output: 'config.h', 67 configuration: conf 68) 69 70add_project_arguments('-include', '@0@'.format(config), language: 'c') 71 72libpldm_include_dir = include_directories('include', is_system: true) 73 74subdir('include') 75subdir('src') 76 77if get_option('tests').allowed() 78 subdir('tests') 79endif 80 81install_subdir('instance-db', 82 install_mode: 'r--r--r--', 83 install_dir: get_option('datadir') / meson.project_name()) 84