xref: /openbmc/fb-ipmi-oem/meson.build (revision 14ddea58)
1project(
2  'fb-ipmi-oem',
3  'cpp',
4  version: '0.1',
5  meson_version: '>=1.1.1',
6  default_options: [
7    'werror=true',
8    'warning_level=3',
9    'cpp_std=c++23',
10  ])
11
12# Project Arguments
13cpp = meson.get_compiler('cpp')
14add_project_arguments(
15  cpp.get_supported_arguments([
16    '-DBOOST_ERROR_CODE_HEADER_ONLY',
17    '-DBOOST_SYSTEM_NO_DEPRECATED',
18    '-DBOOST_ALL_NO_LIB',
19    '-DBOOST_NO_RTTI',
20    '-DBOOST_NO_TYPEID',
21    '-DBOOST_ASIO_DISABLE_THREADS',
22    '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
23    '-Wno-psabi',
24    '-Wno-pedantic',
25  ]),
26  language : 'cpp')
27
28fs = import('fs')
29
30host_instances = '0'
31if get_option('host-instances') != ''
32  host_instances = get_option('host-instances')
33endif
34
35conf_data = configuration_data()
36conf_data.set_quoted('INSTANCES',host_instances)
37conf_data.set('POST_CODE_BYTES', get_option('post-code-bytes'))
38
39configure_file(input: 'meson_config.h.in',
40               output: 'config.h',
41               configuration: conf_data)
42
43if not get_option('bic').disabled()
44  add_project_arguments(
45    cpp.get_supported_arguments([
46        '-DBIC_ENABLED',
47    ]),
48    language : 'cpp')
49endif
50
51if get_option('me_support')
52  add_project_arguments(
53    cpp.get_supported_arguments([
54        '-DME_SUPPORT',
55    ]),
56    language : 'cpp')
57endif
58
59root_inc = include_directories('.', 'include')
60
61# Dependencies
62sdbusplus_dep = dependency('sdbusplus')
63phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
64phosphor_logging_dep = dependency('phosphor-logging')
65ipmid_dep = dependency('libipmid')
66channellayer_dep = dependency('libchannellayer')
67userlayer_dep = dependency('libuserlayer')
68
69if cpp.has_header_symbol(
70        'nlohmann/json.hpp',
71        'nlohmann::json::string_t',
72        required:false)
73    nlohmann_json_dep = declare_dependency()
74else
75    nlohmann_json_dep = dependency('nlohmann-json')
76endif
77
78zfboemcmds_pre = declare_dependency(
79  include_directories: root_inc,
80  dependencies: [
81    channellayer_dep,
82    ipmid_dep,
83    nlohmann_json_dep,
84    phosphor_dbus_interfaces_dep,
85    phosphor_logging_dep,
86    sdbusplus_dep,
87    userlayer_dep,
88  ])
89
90zfboemcmds_lib = library(
91  'zfboemcmds',
92  'src/oemcommands.cpp',
93  'src/appcommands.cpp',
94  'src/storagecommands.cpp',
95  'src/usb-dbg.cpp',
96  'src/selcommands.cpp',
97  'src/transportcommands.cpp',
98  'src/biccommands.cpp',
99  implicit_include_directories: false,
100  dependencies: zfboemcmds_pre,
101  version: meson.project_version(),
102  override_options: ['b_lundef=false'],
103  install: true,
104  install_dir: get_option('libdir') / 'ipmid-providers')
105
106if get_option('machine') != ''
107  configfile = [
108        'cri_sensors.json',
109        'gpio_desc.json',
110        'post_desc.json'
111   ]
112   foreach c : configfile
113      file = join_paths('configs', get_option('machine'), c)
114      if not fs.is_file(file)
115         warning('Missing config file: ' + file)
116      else
117          install_data(
118              sources : file,
119              install_dir : get_option('datadir') / 'lcd-debug'
120          )
121      endif
122   endforeach
123endif
124