Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 1 | project('libpldm', ['c','cpp'], |
| 2 | default_options: [ |
| 3 | 'buildtype=debugoptimized', |
| 4 | 'warning_level=3', |
| 5 | 'werror=true', |
| 6 | 'cpp_std=c++20', |
| 7 | 'c_std=c17', |
| 8 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), |
| 9 | ], |
Andrew Jeffery | a2ce136 | 2023-02-13 15:26:29 +1030 | [diff] [blame] | 10 | version: '0.2.0', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 11 | meson_version: '>=0.63.0', |
| 12 | ) |
| 13 | |
| 14 | add_project_arguments('-D_DEFAULT_SOURCE',language:['c']) |
| 15 | |
| 16 | libpldm_sources = files() |
| 17 | subdir('src') |
| 18 | |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 19 | libpldm_include_dir = ['include', 'src'] |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 20 | libpldm_headers = files() |
Rashmica Gupta | c1b66f4 | 2022-12-09 16:24:45 +1100 | [diff] [blame] | 21 | libpldm_transport_headers = files() |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 22 | |
| 23 | subdir('include/libpldm') |
| 24 | |
| 25 | libpldm = library( |
| 26 | 'pldm', |
| 27 | libpldm_sources, |
| 28 | implicit_include_directories: false, |
| 29 | include_directories: libpldm_include_dir, |
| 30 | version: meson.project_version(), |
| 31 | install: true |
| 32 | ) |
| 33 | |
| 34 | install_headers( |
| 35 | libpldm_headers, |
| 36 | subdir:'libpldm' |
| 37 | ) |
| 38 | |
Rashmica Gupta | c1b66f4 | 2022-12-09 16:24:45 +1100 | [diff] [blame] | 39 | install_headers( |
| 40 | libpldm_transport_headers, |
| 41 | subdir:'libpldm/transport' |
| 42 | ) |
| 43 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 44 | libpldm_dep = declare_dependency( |
| 45 | include_directories: libpldm_include_dir, |
| 46 | link_with: libpldm) |
| 47 | |
| 48 | import('pkgconfig').generate( |
| 49 | name: 'libpldm', |
| 50 | description: 'PLDM protocol encode/decode C lib', |
| 51 | version: meson.project_version(), |
| 52 | libraries: libpldm) |
| 53 | |
Rashmica Gupta | c1b66f4 | 2022-12-09 16:24:45 +1100 | [diff] [blame] | 54 | compiler = meson.get_compiler('c') |
| 55 | conf = configuration_data() |
| 56 | if compiler.has_header('poll.h') |
| 57 | conf.set('PLDM_HAS_POLL', 1) |
| 58 | endif |
| 59 | configure_file(output: 'config.h', |
| 60 | configuration: conf |
| 61 | ) |
| 62 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 63 | if get_option('tests').enabled() |
| 64 | subdir('tests') |
| 65 | endif |