Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 1 | project('libpldm', ['c','cpp'], |
| 2 | default_options: [ |
Andrew Jeffery | 953bc8c | 2023-05-22 15:24:17 +0930 | [diff] [blame] | 3 | 'debug=true', |
| 4 | 'optimization=g', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 5 | 'warning_level=3', |
| 6 | 'werror=true', |
| 7 | 'cpp_std=c++20', |
| 8 | 'c_std=c17', |
Andrew Jeffery | 5cf32ea | 2023-07-03 13:40:00 +0930 | [diff] [blame] | 9 | 'b_ndebug=if-release', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 10 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), |
| 11 | ], |
Andrew Jeffery | 3f39f96 | 2023-08-29 14:54:29 +0930 | [diff] [blame] | 12 | version: '0.7.0', |
George Liu | bfd06e4 | 2023-08-16 10:30:13 +0800 | [diff] [blame] | 13 | meson_version: '>=1.1.0', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 14 | ) |
| 15 | |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 16 | add_project_arguments('-D_DEFAULT_SOURCE', language: ['c']) |
| 17 | |
| 18 | compiler = meson.get_compiler('c') |
| 19 | conf = configuration_data() |
| 20 | if compiler.has_header('poll.h') |
| 21 | conf.set('PLDM_HAS_POLL', 1) |
| 22 | endif |
| 23 | |
| 24 | # ABI control |
| 25 | visible = '__attribute__((visibility("default")))' |
| 26 | if get_option('abi').contains('deprecated') |
| 27 | conf.set('LIBPLDM_ABI_DEPRECATED', visible) |
| 28 | add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) |
| 29 | else |
| 30 | conf.set('LIBPLDM_ABI_DEPRECATED', '') |
| 31 | endif |
| 32 | conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols |
| 33 | if get_option('abi').contains('testing') |
| 34 | conf.set('LIBPLDM_ABI_TESTING', visible) |
| 35 | add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) |
| 36 | else |
| 37 | conf.set('LIBPLDM_ABI_TESTING', '') |
| 38 | endif |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 39 | |
Andrew Jeffery | f89befe | 2023-06-16 13:02:09 +0930 | [diff] [blame] | 40 | config = configure_file(output: 'config.h', |
| 41 | configuration: conf |
| 42 | ) |
| 43 | |
| 44 | add_project_arguments('-include', '@0@'.format(config), language: 'c') |
| 45 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 46 | libpldm_include_dir = include_directories('include', is_system: true) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 47 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 48 | subdir('include') |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 49 | subdir('src') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 50 | |
Andrew Jeffery | d126936 | 2023-11-08 15:54:35 +1030 | [diff] [blame] | 51 | if get_option('tests').allowed() |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 52 | subdir('tests') |
| 53 | endif |
Rashmica Gupta | 6af2a29 | 2023-04-27 14:20:17 +1000 | [diff] [blame] | 54 | |
| 55 | install_subdir('instance-db', |
| 56 | install_mode: 'r--r--r--', |
| 57 | install_dir: get_option('datadir') / meson.project_name()) |