xref: /openbmc/fb-ipmi-oem/meson.build (revision e40592a7)
1project(
2  'fb-ipmi-oem',
3  'cpp',
4  version: '0.1',
5  meson_version: '>=0.57.0',
6  default_options: [
7    'werror=true',
8    'warning_level=3',
9    'cpp_std=c++20',
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)
37
38configure_file(input: 'meson_config.h.in',
39               output: 'config.h',
40               configuration: conf_data)
41
42if not get_option('bic').disabled()
43  add_project_arguments(
44    cpp.get_supported_arguments([
45        '-DBIC_ENABLED',
46    ]),
47    language : 'cpp')
48endif
49
50root_inc = include_directories('.', 'include')
51
52# Dependencies
53sdbusplus_dep = dependency('sdbusplus')
54phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
55phosphor_logging_dep = dependency('phosphor-logging')
56ipmid_dep = dependency('libipmid')
57channellayer_dep = dependency('libchannellayer')
58userlayer_dep = dependency('libuserlayer')
59
60if cpp.has_header_symbol(
61        'nlohmann/json.hpp',
62        'nlohmann::json::string_t',
63        required:false)
64    nlohmann_json_dep = declare_dependency()
65else
66    nlohmann_json_dep = dependency('nlohmann-json')
67endif
68
69zfboemcmds_pre = declare_dependency(
70  include_directories: root_inc,
71  dependencies: [
72    channellayer_dep,
73    ipmid_dep,
74    nlohmann_json_dep,
75    phosphor_dbus_interfaces_dep,
76    phosphor_logging_dep,
77    sdbusplus_dep,
78    userlayer_dep,
79  ])
80
81zfboemcmds_lib = library(
82  'zfboemcmds',
83  'src/oemcommands.cpp',
84  'src/appcommands.cpp',
85  'src/storagecommands.cpp',
86  'src/usb-dbg.cpp',
87  'src/selcommands.cpp',
88  'src/transportcommands.cpp',
89  'src/biccommands.cpp',
90  implicit_include_directories: false,
91  dependencies: zfboemcmds_pre,
92  version: meson.project_version(),
93  override_options: ['b_lundef=false'],
94  install: true,
95  install_dir: get_option('libdir') / 'ipmid-providers')
96
97if get_option('machine') != ''
98  configfile = [
99        'cri_sensors.json',
100        'gpio_desc.json',
101        'post_desc.json'
102   ]
103   foreach c : configfile
104      file = join_paths('configs', get_option('machine'), c)
105      if not fs.is_file(file)
106         warning('Missing config file: ' + file)
107      else
108          install_data(
109              sources : file,
110              install_dir : get_option('datadir') / 'lcd-debug'
111          )
112      endif
113   endforeach
114endif
115