1project('libpldm', ['c','cpp'], 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.7.0', 13 meson_version: '>=1.1.0', 14) 15 16add_project_arguments('-D_DEFAULT_SOURCE', language: ['c']) 17 18compiler = meson.get_compiler('c') 19conf = configuration_data() 20if compiler.has_header('poll.h') 21 conf.set('PLDM_HAS_POLL', 1) 22endif 23 24# ABI control 25visible = '__attribute__((visibility("default")))' 26if get_option('abi').contains('deprecated') 27 conf.set('LIBPLDM_ABI_DEPRECATED', visible) 28 add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) 29else 30 conf.set('LIBPLDM_ABI_DEPRECATED', '') 31endif 32conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols 33if get_option('abi').contains('testing') 34 conf.set('LIBPLDM_ABI_TESTING', visible) 35 add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) 36else 37 conf.set('LIBPLDM_ABI_TESTING', '') 38endif 39 40config = configure_file(output: 'config.h', 41 configuration: conf 42) 43 44add_project_arguments('-include', '@0@'.format(config), language: 'c') 45 46libpldm_include_dir = include_directories('include', is_system: true) 47 48subdir('include') 49subdir('src') 50 51if get_option('tests').allowed() 52 subdir('tests') 53endif 54 55install_subdir('instance-db', 56 install_mode: 'r--r--r--', 57 install_dir: get_option('datadir') / meson.project_name()) 58