blob: 7a6e7a6d13e4a5643b391f77f6326366262e31e7 [file] [log] [blame]
Andrew Jefferyaa16a0d2024-06-03 16:23:56 +09301project('libpldm', 'c',
Andrew Jeffery9c766792022-08-10 23:12:49 +09302 default_options: [
Andrew Jeffery953bc8c2023-05-22 15:24:17 +09303 'debug=true',
4 'optimization=g',
Andrew Jeffery9c766792022-08-10 23:12:49 +09305 'warning_level=3',
6 'werror=true',
7 'cpp_std=c++20',
8 'c_std=c17',
Andrew Jeffery5cf32ea2023-07-03 13:40:00 +09309 'b_ndebug=if-release',
Andrew Jeffery9c766792022-08-10 23:12:49 +093010 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'),
11 ],
Andrew Jefferyc166dd52024-05-22 15:45:34 +093012 version: '0.8.0',
George Liubfd06e42023-08-16 10:30:13 +080013 meson_version: '>=1.1.0',
Andrew Jeffery9c766792022-08-10 23:12:49 +093014)
15
Andrew Jefferyaa16a0d2024-06-03 16:23:56 +093016if get_option('tests').allowed()
17 add_languages('cpp')
18endif
19
Andrew Jeffery2b440d42024-07-25 10:36:08 +093020# For memmem() in src/msgbuf.h
21add_project_arguments('-D_GNU_SOURCE', language: ['c'])
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093022
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")))'
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093031libpldm_deprecated_aliases = []
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093032if get_option('abi').contains('deprecated')
33 conf.set('LIBPLDM_ABI_DEPRECATED', visible)
34 add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp'])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093035 libpldm_deprecated_aliases += [
36 ['get_fru_record_by_option_check', 'get_fru_record_by_option'],
Andrew Jeffery46673f42024-06-25 16:02:25 +093037 ['pldm_bios_table_attr_entry_enum_decode_def_num_check', 'pldm_bios_table_attr_entry_enum_decode_def_num'],
Andrew Jeffery82b4d3b2024-06-25 16:22:36 +093038 ['pldm_bios_table_attr_entry_enum_decode_pv_hdls_check', 'pldm_bios_table_attr_entry_enum_decode_pv_hdls'],
Andrew Jefferyb06882f2024-06-25 15:52:02 +093039 ['pldm_bios_table_attr_entry_enum_decode_pv_num_check', 'pldm_bios_table_attr_entry_enum_decode_pv_num'],
Andrew Jeffery7126b1d2024-06-25 15:48:34 +093040 ['pldm_bios_table_attr_entry_enum_encode_check', 'pldm_bios_table_attr_entry_enum_encode'],
Andrew Jefferyf6be4932024-06-25 16:44:06 +093041 ['pldm_bios_table_attr_entry_string_encode_check', 'pldm_bios_table_attr_entry_string_encode'],
Andrew Jeffery8c37ab32024-06-25 15:34:27 +093042 ['pldm_bios_table_string_entry_decode_string_check', 'pldm_bios_table_string_entry_decode_string'],
Andrew Jefferye48fdd62024-06-25 00:36:20 +093043 ['pldm_bios_table_string_entry_encode_check', 'pldm_bios_table_string_entry_encode'],
Andrew Jefferyd72ea4b2024-06-24 21:33:33 +093044 ['pldm_entity_association_pdr_add_check', 'pldm_entity_association_pdr_add'],
Andrew Jefferyaa49b712024-06-24 21:43:52 +093045 ['pldm_entity_association_pdr_add_from_node_check', 'pldm_entity_association_pdr_add_from_node'],
Andrew Jefferyfae36412024-06-20 06:35:51 +000046 ['pldm_pdr_add_check', 'pldm_pdr_add'],
Andrew Jefferye7f55112024-06-20 16:16:01 +093047 ['pldm_pdr_add_fru_record_set_check', 'pldm_pdr_add_fru_record_set'],
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093048 ]
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093049else
50 conf.set('LIBPLDM_ABI_DEPRECATED', '')
51endif
52conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols
53if get_option('abi').contains('testing')
54 conf.set('LIBPLDM_ABI_TESTING', visible)
55 add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp'])
56else
57 conf.set('LIBPLDM_ABI_TESTING', '')
58endif
Andrew Jeffery9c766792022-08-10 23:12:49 +093059
Andrew Jefferyf89befe2023-06-16 13:02:09 +093060config = configure_file(output: 'config.h',
61 configuration: conf
62)
63
64add_project_arguments('-include', '@0@'.format(config), language: 'c')
65
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103066libpldm_include_dir = include_directories('include', is_system: true)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050067
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103068subdir('include')
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103069subdir('src')
Andrew Jeffery9c766792022-08-10 23:12:49 +093070
Andrew Jefferyd1269362023-11-08 15:54:35 +103071if get_option('tests').allowed()
Andrew Jeffery9c766792022-08-10 23:12:49 +093072 subdir('tests')
73endif
Rashmica Gupta6af2a292023-04-27 14:20:17 +100074
75install_subdir('instance-db',
76 install_mode: 'r--r--r--',
77 install_dir: get_option('datadir') / meson.project_name())