blob: 578638b46ec054b219caada1a58ceba67ada48b8 [file] [log] [blame]
William A. Kennington IIIac730af2021-06-24 03:15:38 -07001project(
2 'google-ipmi-sys',
3 'cpp',
4 version: '0.1',
Willy Tuc841bfd2021-09-14 15:26:58 -07005 meson_version: '>=0.57.0',
William A. Kennington IIIac730af2021-06-24 03:15:38 -07006 default_options: [
Willy Tuc841bfd2021-09-14 15:26:58 -07007 'cpp_std=c++20',
William A. Kennington IIIac730af2021-06-24 03:15:38 -07008 'warning_level=3',
9 'werror=true',
10 ])
11
Willy Tu6c71b0f2021-10-10 13:34:41 -070012root_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
Nikhil Namjoshi5e70dc82022-09-16 00:36:07 +000020bm_conf_data = configuration_data()
21bm_conf_data.set10('BARE_METAL', get_option('bare_metal'))
Brandon Kim3f3ca032023-03-17 18:49:00 +000022bm_conf_data.set_quoted('BM_SIGNAL_PATH', get_option('bm-signal-path'))
Nikhil Namjoshi5e70dc82022-09-16 00:36:07 +000023bm_conf_h = configure_file(
24 output: 'bm_config.h',
25 configuration: bm_conf_data)
26
William A. Kennington IIIac730af2021-06-24 03:15:38 -070027meson.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
Willy Tu6c71b0f2021-10-10 13:34:41 -070037fmt_dep = dependency('fmt', required: false)
38if not fmt_dep.found()
39 fmt_proj = import('cmake').subproject(
40 'fmt',
41 cmake_options: [
42 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
43 '-DMASTER_PROJECT=OFF'
44 ],
45 required: false)
46 assert(fmt_proj.found(), 'fmtlib is required')
47 fmt_dep = fmt_proj.dependency('fmt')
48endif
49
50subdir('bifurcation')
51
William A. Kennington IIIac730af2021-06-24 03:15:38 -070052sys_pre = declare_dependency(
Willy Tu6c71b0f2021-10-10 13:34:41 -070053 include_directories: root_inc,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070054 dependencies: [
55 json_dep,
Willy Tu6c71b0f2021-10-10 13:34:41 -070056 fmt_dep,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070057 dependency('phosphor-dbus-interfaces'),
58 dependency('phosphor-logging'),
59 dependency('sdbusplus'),
Willy Tu6c71b0f2021-10-10 13:34:41 -070060 bifurcation_dep,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070061 ])
62
63sys_lib = static_library(
64 'sys',
Nikhil Namjoshi5e70dc82022-09-16 00:36:07 +000065 'bmc_mode.cpp',
William A. Kennington IIIac730af2021-06-24 03:15:38 -070066 'cable.cpp',
67 'cpld.cpp',
68 'entity_name.cpp',
69 'eth.cpp',
70 'flash_size.cpp',
71 'handler.cpp',
72 'host_power_off.cpp',
73 'ipmi.cpp',
74 'machine_name.cpp',
75 'pcie_i2c.cpp',
Steve Foreman4f0d1de2021-09-20 14:06:32 -070076 'google_accel_oob.cpp',
Willy Tu6c71b0f2021-10-10 13:34:41 -070077 'pcie_bifurcation.cpp',
William A. Kennington IIIac730af2021-06-24 03:15:38 -070078 'psu.cpp',
79 'util.cpp',
80 implicit_include_directories: false,
81 dependencies: sys_pre)
82
83sys_dep = declare_dependency(
84 link_with: sys_lib,
85 dependencies: sys_pre)
86
87if not get_option('tests').disabled()
88 subdir('test')
89endif
90
91shared_module(
92 'googlesys',
93 'main.cpp',
94 implicit_include_directories: false,
95 dependencies: [
96 dependency('libipmid'),
97 sys_dep,
98 ],
99 install: true,
100 install_dir: get_option('libdir') / 'ipmid-providers')
101
102systemd_dep = dependency('systemd')
103if systemd_dep.found()
104 install_data(
105 'gbmc-host-poweroff.target',
106 'gbmc-psu-hardreset.target',
William A. Kennington III0e22d322022-04-07 12:32:36 -0700107 'gbmc-psu-hardreset-pre.target',
108 'gbmc-psu-hardreset-time.service',
William A. Kennington IIIac730af2021-06-24 03:15:38 -0700109 install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'))
110endif