xref: /openbmc/google-ipmi-sys/meson.build (revision a2056e9c)
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  'psu.cpp',
44  'util.cpp',
45  implicit_include_directories: false,
46  dependencies: sys_pre)
47
48sys_dep = declare_dependency(
49  link_with: sys_lib,
50  dependencies: sys_pre)
51
52if not get_option('tests').disabled()
53  subdir('test')
54endif
55
56shared_module(
57  'googlesys',
58  'main.cpp',
59  implicit_include_directories: false,
60  dependencies: [
61    dependency('libipmid'),
62    sys_dep,
63  ],
64  install: true,
65  install_dir: get_option('libdir') / 'ipmid-providers')
66
67systemd_dep = dependency('systemd')
68if systemd_dep.found()
69  install_data(
70    'gbmc-host-poweroff.target',
71    'gbmc-psu-hardreset.target',
72    install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'))
73endif
74