blob: 40f8207305ce00ace8fc651abbb1fc133af3a1b0 [file] [log] [blame]
Andrew Jefferye984a462024-09-07 11:23:28 +02001project(
2 'libpldm',
3 'c',
Andrew Jeffery9c766792022-08-10 23:12:49 +09304 default_options: [
Andrew Jefferye984a462024-09-07 11:23:28 +02005 '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 Jeffery9c766792022-08-10 23:12:49 +093013 ],
Andrew Jeffery747a4982024-09-07 11:05:43 +020014 version: '0.9.0',
Patrick Williamsa9db43f2023-08-23 06:31:22 -050015 meson_version: '>=1.1.1',
Andrew Jeffery9c766792022-08-10 23:12:49 +093016)
17
Andrew Jefferyaa16a0d2024-06-03 16:23:56 +093018if get_option('tests').allowed()
Andrew Jefferye984a462024-09-07 11:23:28 +020019 add_languages('cpp')
Andrew Jefferyaa16a0d2024-06-03 16:23:56 +093020endif
21
Andrew Jeffery2b440d42024-07-25 10:36:08 +093022# For memmem() in src/msgbuf.h
23add_project_arguments('-D_GNU_SOURCE', language: ['c'])
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093024
25compiler = meson.get_compiler('c')
26conf = configuration_data()
27if compiler.has_header('poll.h')
Andrew Jefferye984a462024-09-07 11:23:28 +020028 conf.set('PLDM_HAS_POLL', 1)
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093029endif
30
31# ABI control
Andrew Jefferye984a462024-09-07 11:23:28 +020032visible = '__attribute__((visibility("default")))'
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093033libpldm_deprecated_aliases = []
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093034if get_option('abi').contains('deprecated')
Andrew Jefferye984a462024-09-07 11:23:28 +020035 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 Jeffery9d2a1c62023-06-05 13:02:16 +0930102else
Andrew Jefferye984a462024-09-07 11:23:28 +0200103 conf.set('LIBPLDM_ABI_DEPRECATED', '')
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +0930104endif
Andrew Jefferye984a462024-09-07 11:23:28 +0200105conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +0930106if get_option('abi').contains('testing')
Andrew Jefferye984a462024-09-07 11:23:28 +0200107 conf.set('LIBPLDM_ABI_TESTING', visible)
108 add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp'])
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +0930109else
Andrew Jefferye984a462024-09-07 11:23:28 +0200110 conf.set('LIBPLDM_ABI_TESTING', '')
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +0930111endif
Andrew Jeffery9c766792022-08-10 23:12:49 +0930112
Andrew Jefferye984a462024-09-07 11:23:28 +0200113config = configure_file(output: 'config.h', configuration: conf)
Andrew Jefferyf89befe2023-06-16 13:02:09 +0930114
115add_project_arguments('-include', '@0@'.format(config), language: 'c')
116
Andrew Jefferyb0c1d202023-11-07 22:08:44 +1030117libpldm_include_dir = include_directories('include', is_system: true)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -0500118
Andrew Jefferyb0c1d202023-11-07 22:08:44 +1030119subdir('include')
Andrew Jefferyb0c1d202023-11-07 22:08:44 +1030120subdir('src')
Andrew Jeffery9c766792022-08-10 23:12:49 +0930121
Andrew Jefferyd1269362023-11-08 15:54:35 +1030122if get_option('tests').allowed()
Andrew Jefferye984a462024-09-07 11:23:28 +0200123 subdir('tests')
Andrew Jeffery9c766792022-08-10 23:12:49 +0930124endif
Rashmica Gupta6af2a292023-04-27 14:20:17 +1000125
Andrew Jefferye984a462024-09-07 11:23:28 +0200126install_subdir(
127 'instance-db',
128 install_mode: 'r--r--r--',
129 install_dir: get_option('datadir') / meson.project_name(),
130)