xref: /openbmc/libpldm/meson.build (revision d9b70ba7)
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
20add_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")))'
30libpldm_deprecated_aliases = []
31if get_option('abi').contains('deprecated')
32  conf.set('LIBPLDM_ABI_DEPRECATED', visible)
33  add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp'])
34  libpldm_deprecated_aliases += [
35    ['get_fru_record_by_option_check', 'get_fru_record_by_option'],
36  ]
37else
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
47
48config = configure_file(output: 'config.h',
49  configuration: conf
50)
51
52add_project_arguments('-include', '@0@'.format(config), language: 'c')
53
54libpldm_include_dir = include_directories('include', is_system: true)
55
56subdir('include')
57subdir('src')
58
59if get_option('tests').allowed()
60  subdir('tests')
61endif
62
63install_subdir('instance-db',
64               install_mode: 'r--r--r--',
65               install_dir: get_option('datadir') / meson.project_name())
66