blob: a2e8d1b58030fb122dfb660ff50bd2ec836b729d [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
William A. Kennington IIIac730af2021-06-24 03:15:38 -070020meson.get_compiler('cpp').has_header_symbol(
21 'ipmid/api.h',
22 'ipmid_get_sd_bus_connection')
23
24json_dep = dependency('nlohmann_json', required: false)
25meson.get_compiler('cpp').has_header_symbol(
26 'nlohmann/json.hpp',
27 'nlohmann::json',
28 dependencies: json_dep)
29
Willy Tu6c71b0f2021-10-10 13:34:41 -070030fmt_dep = dependency('fmt', required: false)
31if not fmt_dep.found()
32 fmt_proj = import('cmake').subproject(
33 'fmt',
34 cmake_options: [
35 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
36 '-DMASTER_PROJECT=OFF'
37 ],
38 required: false)
39 assert(fmt_proj.found(), 'fmtlib is required')
40 fmt_dep = fmt_proj.dependency('fmt')
41endif
42
43subdir('bifurcation')
44
William A. Kennington IIIac730af2021-06-24 03:15:38 -070045sys_pre = declare_dependency(
Willy Tu6c71b0f2021-10-10 13:34:41 -070046 include_directories: root_inc,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070047 dependencies: [
48 json_dep,
Willy Tu6c71b0f2021-10-10 13:34:41 -070049 fmt_dep,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070050 dependency('phosphor-dbus-interfaces'),
51 dependency('phosphor-logging'),
52 dependency('sdbusplus'),
Willy Tu6c71b0f2021-10-10 13:34:41 -070053 bifurcation_dep,
William A. Kennington IIIac730af2021-06-24 03:15:38 -070054 ])
55
56sys_lib = static_library(
57 'sys',
58 'cable.cpp',
59 'cpld.cpp',
60 'entity_name.cpp',
61 'eth.cpp',
62 'flash_size.cpp',
63 'handler.cpp',
64 'host_power_off.cpp',
65 'ipmi.cpp',
66 'machine_name.cpp',
67 'pcie_i2c.cpp',
Steve Foreman4f0d1de2021-09-20 14:06:32 -070068 'google_accel_oob.cpp',
Willy Tu6c71b0f2021-10-10 13:34:41 -070069 'pcie_bifurcation.cpp',
William A. Kennington IIIac730af2021-06-24 03:15:38 -070070 'psu.cpp',
71 'util.cpp',
72 implicit_include_directories: false,
73 dependencies: sys_pre)
74
75sys_dep = declare_dependency(
76 link_with: sys_lib,
77 dependencies: sys_pre)
78
79if not get_option('tests').disabled()
80 subdir('test')
81endif
82
83shared_module(
84 'googlesys',
85 'main.cpp',
86 implicit_include_directories: false,
87 dependencies: [
88 dependency('libipmid'),
89 sys_dep,
90 ],
91 install: true,
92 install_dir: get_option('libdir') / 'ipmid-providers')
93
94systemd_dep = dependency('systemd')
95if systemd_dep.found()
96 install_data(
97 'gbmc-host-poweroff.target',
98 'gbmc-psu-hardreset.target',
William A. Kennington III0e22d322022-04-07 12:32:36 -070099 'gbmc-psu-hardreset-pre.target',
100 'gbmc-psu-hardreset-time.service',
William A. Kennington IIIac730af2021-06-24 03:15:38 -0700101 install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'))
102endif