Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 1 | project( |
| 2 | 'libpldm', |
| 3 | 'c', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 4 | default_options: [ |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 5 | '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 Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 13 | ], |
Andrew Jeffery | 615344f | 2024-09-07 11:58:37 +0200 | [diff] [blame] | 14 | version: '0.9.1', |
Patrick Williams | a9db43f | 2023-08-23 06:31:22 -0500 | [diff] [blame] | 15 | meson_version: '>=1.1.1', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 16 | ) |
| 17 | |
Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 18 | if get_option('tests').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 19 | add_languages('cpp') |
Andrew Jeffery | aa16a0d | 2024-06-03 16:23:56 +0930 | [diff] [blame] | 20 | endif |
| 21 | |
Andrew Jeffery | 2b440d4 | 2024-07-25 10:36:08 +0930 | [diff] [blame] | 22 | # For memmem() in src/msgbuf.h |
| 23 | add_project_arguments('-D_GNU_SOURCE', language: ['c']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 24 | |
| 25 | compiler = meson.get_compiler('c') |
| 26 | conf = configuration_data() |
| 27 | if compiler.has_header('poll.h') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 28 | conf.set('PLDM_HAS_POLL', 1) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 29 | endif |
| 30 | |
| 31 | # ABI control |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 32 | visible = '__attribute__((visibility("default")))' |
Andrew Jeffery | d9b70ba | 2024-06-08 22:14:49 +0930 | [diff] [blame] | 33 | libpldm_deprecated_aliases = [] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 34 | if get_option('abi').contains('deprecated') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 35 | conf.set('LIBPLDM_ABI_DEPRECATED', visible) |
| 36 | add_project_arguments('-DLIBPLDM_API_DEPRECATED', language: ['c', 'cpp']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 37 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 38 | conf.set('LIBPLDM_ABI_DEPRECATED', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 39 | endif |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 40 | conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 41 | if get_option('abi').contains('testing') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 42 | conf.set('LIBPLDM_ABI_TESTING', visible) |
| 43 | add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 44 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 45 | conf.set('LIBPLDM_ABI_TESTING', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 46 | endif |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 47 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 48 | config = configure_file(output: 'config.h', configuration: conf) |
Andrew Jeffery | f89befe | 2023-06-16 13:02:09 +0930 | [diff] [blame] | 49 | |
| 50 | add_project_arguments('-include', '@0@'.format(config), language: 'c') |
| 51 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 52 | libpldm_include_dir = include_directories('include', is_system: true) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 53 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 54 | subdir('include') |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 55 | subdir('src') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 56 | |
Andrew Jeffery | d126936 | 2023-11-08 15:54:35 +1030 | [diff] [blame] | 57 | if get_option('tests').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 58 | subdir('tests') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 59 | endif |
Rashmica Gupta | 6af2a29 | 2023-04-27 14:20:17 +1000 | [diff] [blame] | 60 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 61 | install_subdir( |
| 62 | 'instance-db', |
| 63 | install_mode: 'r--r--r--', |
| 64 | install_dir: get_option('datadir') / meson.project_name(), |
| 65 | ) |