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']) |
| 37 | libpldm_deprecated_aliases += [ |
| 38 | ['get_fru_record_by_option_check', 'get_fru_record_by_option'], |
| 39 | [ |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 40 | 'pldm_entity_association_pdr_add_check', |
| 41 | 'pldm_entity_association_pdr_add', |
| 42 | ], |
| 43 | [ |
| 44 | 'pldm_entity_association_pdr_add_from_node_check', |
| 45 | 'pldm_entity_association_pdr_add_from_node', |
| 46 | ], |
| 47 | ['pldm_pdr_add_check', 'pldm_pdr_add'], |
| 48 | ['pldm_pdr_add_fru_record_set_check', 'pldm_pdr_add_fru_record_set'], |
| 49 | ] |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 50 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 51 | conf.set('LIBPLDM_ABI_DEPRECATED', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 52 | endif |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 53 | conf.set('LIBPLDM_ABI_STABLE', visible) # Always expose the stable symbols |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 54 | if get_option('abi').contains('testing') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 55 | conf.set('LIBPLDM_ABI_TESTING', visible) |
| 56 | add_project_arguments('-DLIBPLDM_API_TESTING', language: ['c', 'cpp']) |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 57 | else |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 58 | conf.set('LIBPLDM_ABI_TESTING', '') |
Andrew Jeffery | 9d2a1c6 | 2023-06-05 13:02:16 +0930 | [diff] [blame] | 59 | endif |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 60 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 61 | config = configure_file(output: 'config.h', configuration: conf) |
Andrew Jeffery | f89befe | 2023-06-16 13:02:09 +0930 | [diff] [blame] | 62 | |
| 63 | add_project_arguments('-include', '@0@'.format(config), language: 'c') |
| 64 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 65 | libpldm_include_dir = include_directories('include', is_system: true) |
Pavithra Barithaya | a7989cd | 2023-10-30 08:52:28 -0500 | [diff] [blame] | 66 | |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 67 | subdir('include') |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 68 | subdir('src') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 69 | |
Andrew Jeffery | d126936 | 2023-11-08 15:54:35 +1030 | [diff] [blame] | 70 | if get_option('tests').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 71 | subdir('tests') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 72 | endif |
Rashmica Gupta | 6af2a29 | 2023-04-27 14:20:17 +1000 | [diff] [blame] | 73 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 74 | install_subdir( |
| 75 | 'instance-db', |
| 76 | install_mode: 'r--r--r--', |
| 77 | install_dir: get_option('datadir') / meson.project_name(), |
| 78 | ) |