xref: /openbmc/google-ipmi-sys/meson.build (revision 4f0d1de6)
1project(
2  'google-ipmi-sys',
3  'cpp',
4  version: '0.1',
5  meson_version: '>=0.57.0',
6  default_options: [
7    'cpp_std=c++20',
8    'warning_level=3',
9    'werror=true',
10  ])
11
12meson.get_compiler('cpp').has_header_symbol(
13  'ipmid/api.h',
14  'ipmid_get_sd_bus_connection')
15
16json_dep = dependency('nlohmann_json', required: false)
17meson.get_compiler('cpp').has_header_symbol(
18  'nlohmann/json.hpp',
19  'nlohmann::json',
20  dependencies: json_dep)
21
22sys_pre = declare_dependency(
23  include_directories: include_directories('.'),
24  dependencies: [
25    json_dep,
26    dependency('phosphor-dbus-interfaces'),
27    dependency('phosphor-logging'),
28    dependency('sdbusplus'),
29  ])
30
31sys_lib = static_library(
32  'sys',
33  'cable.cpp',
34  'cpld.cpp',
35  'entity_name.cpp',
36  'eth.cpp',
37  'flash_size.cpp',
38  'handler.cpp',
39  'host_power_off.cpp',
40  'ipmi.cpp',
41  'machine_name.cpp',
42  'pcie_i2c.cpp',
43  'google_accel_oob.cpp',
44  'psu.cpp',
45  'util.cpp',
46  implicit_include_directories: false,
47  dependencies: sys_pre)
48
49sys_dep = declare_dependency(
50  link_with: sys_lib,
51  dependencies: sys_pre)
52
53if not get_option('tests').disabled()
54  subdir('test')
55endif
56
57shared_module(
58  'googlesys',
59  'main.cpp',
60  implicit_include_directories: false,
61  dependencies: [
62    dependency('libipmid'),
63    sys_dep,
64  ],
65  install: true,
66  install_dir: get_option('libdir') / 'ipmid-providers')
67
68systemd_dep = dependency('systemd')
69if systemd_dep.found()
70  install_data(
71    'gbmc-host-poweroff.target',
72    'gbmc-psu-hardreset.target',
73    install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'))
74endif
75