xref: /openbmc/google-ipmi-sys/meson.build (revision 40b2a0cc10cf188cb904282c2d4004e146a021b7)
1project(
2  'google-ipmi-sys',
3  'cpp',
4  version: '0.1',
5  meson_version: '>=1.1.1',
6  default_options: [
7    'cpp_std=c++23',
8    'warning_level=3',
9    'werror=true',
10  ])
11
12root_inc = include_directories('.')
13
14conf_data = configuration_data()
15conf_data.set_quoted('STATIC_BIFURCATION_CONFIG', get_option('static-bifurcation'))
16conf_h = configure_file(
17  output: 'config.h',
18  configuration: conf_data)
19
20bm_conf_data = configuration_data()
21bm_conf_data.set10('BARE_METAL', get_option('bare_metal'))
22bm_conf_data.set_quoted('BM_SIGNAL_PATH', get_option('bm-signal-path'))
23bm_conf_h = configure_file(
24  output: 'bm_config.h',
25  configuration: bm_conf_data)
26
27meson.get_compiler('cpp').has_header_symbol(
28  'ipmid/api.h',
29  'ipmid_get_sd_bus_connection')
30
31json_dep = dependency('nlohmann_json', required: false)
32meson.get_compiler('cpp').has_header_symbol(
33  'nlohmann/json.hpp',
34  'nlohmann::json',
35  dependencies: json_dep)
36
37stdplus = dependency('stdplus')
38subdir('bifurcation')
39
40sys_pre = declare_dependency(
41  include_directories: root_inc,
42  dependencies: [
43    json_dep,
44    dependency('phosphor-dbus-interfaces'),
45    dependency('phosphor-logging'),
46    dependency('sdbusplus'),
47    stdplus,
48    bifurcation_dep,
49  ])
50
51sys_lib = static_library(
52  'sys',
53  'bmc_mode.cpp',
54  'cable.cpp',
55  'cpld.cpp',
56  'entity_name.cpp',
57  'eth.cpp',
58  'flash_size.cpp',
59  'handler.cpp',
60  'host_power_off.cpp',
61  'ipmi.cpp',
62  'linux_boot_done.cpp',
63  'machine_name.cpp',
64  'pcie_i2c.cpp',
65  'google_accel_oob.cpp',
66  'pcie_bifurcation.cpp',
67  'file_system_wrapper.cpp',
68  'psu.cpp',
69  'util.cpp',
70  implicit_include_directories: false,
71  dependencies: sys_pre)
72
73sys_dep = declare_dependency(
74  link_with: sys_lib,
75  dependencies: sys_pre)
76
77if not get_option('tests').disabled()
78  subdir('test')
79endif
80
81shared_module(
82  'googlesys',
83  'main.cpp',
84  implicit_include_directories: false,
85  dependencies: [
86    dependency('libipmid'),
87    sys_dep,
88  ],
89  install: true,
90  install_dir: get_option('libdir') / 'ipmid-providers')
91
92systemd_dep = dependency('systemd')
93if systemd_dep.found()
94  install_data(
95    'gbmc-bare-metal-active.target',
96    'gbmc-host-poweroff.target',
97    'gbmc-psu-hardreset.target',
98    'gbmc-psu-hardreset-pre.target',
99    'gbmc-psu-hardreset-time.service',
100    install_dir: systemd_dep.get_variable('systemdsystemunitdir'))
101endif
102
103install_data(
104  'gbmc-enqueue-powercycle.sh',
105  install_dir: get_option('bindir'),
106  install_mode: 'rwxr-xr-x'
107)
108