blob: 0a2cc04bd949554e999e65dd054969f72311817c [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 Jeffery9d2a1c62023-06-05 13:02:16 +093020add_project_arguments('-D_DEFAULT_SOURCE', language: ['c'])
21
22compiler = meson.get_compiler('c')
23conf = configuration_data()
24if compiler.has_header('poll.h')
25 conf.set('PLDM_HAS_POLL', 1)
26endif
27
28# ABI control
29visible = '__attribute__((visibility("default")))'
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093030libpldm_deprecated_aliases = []
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093031if get_option('abi').contains('deprecated')
32 conf.set('LIBPLDM_ABI_DEPRECATED', visible)
33 add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp'])
Andrew Jefferyd9b70ba2024-06-08 22:14:49 +093034 libpldm_deprecated_aliases += [
35 ['get_fru_record_by_option_check', 'get_fru_record_by_option'],
36 ]
Andrew Jeffery9d2a1c62023-06-05 13:02:16 +093037else
38 conf.set('LIBPLDM_ABI_DEPRECATED', '')
39endif
40conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols
41if get_option('abi').contains('testing')
42 conf.set('LIBPLDM_ABI_TESTING', visible)
43 add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp'])
44else
45 conf.set('LIBPLDM_ABI_TESTING', '')
46endif
Andrew Jeffery9c766792022-08-10 23:12:49 +093047
Andrew Jefferyf89befe2023-06-16 13:02:09 +093048config = configure_file(output: 'config.h',
49 configuration: conf
50)
51
52add_project_arguments('-include', '@0@'.format(config), language: 'c')
53
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103054libpldm_include_dir = include_directories('include', is_system: true)
Pavithra Barithayaa7989cd2023-10-30 08:52:28 -050055
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103056subdir('include')
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103057subdir('src')
Andrew Jeffery9c766792022-08-10 23:12:49 +093058
Andrew Jefferyd1269362023-11-08 15:54:35 +103059if get_option('tests').allowed()
Andrew Jeffery9c766792022-08-10 23:12:49 +093060 subdir('tests')
61endif
Rashmica Gupta6af2a292023-04-27 14:20:17 +100062
63install_subdir('instance-db',
64 install_mode: 'r--r--r--',
65 install_dir: get_option('datadir') / meson.project_name())