xref: /openbmc/google-ipmi-sys/meson.build (revision 3f3ca03543a1fbaac4362a03374b45a2210fe521)
1ac730af2SWilliam A. Kennington IIIproject(
2ac730af2SWilliam A. Kennington III  'google-ipmi-sys',
3ac730af2SWilliam A. Kennington III  'cpp',
4ac730af2SWilliam A. Kennington III  version: '0.1',
5c841bfd2SWilly Tu  meson_version: '>=0.57.0',
6ac730af2SWilliam A. Kennington III  default_options: [
7c841bfd2SWilly Tu    'cpp_std=c++20',
8ac730af2SWilliam A. Kennington III    'warning_level=3',
9ac730af2SWilliam A. Kennington III    'werror=true',
10ac730af2SWilliam A. Kennington III  ])
11ac730af2SWilliam A. Kennington III
126c71b0f9SWilly Turoot_inc = include_directories('.')
136c71b0f9SWilly Tu
146c71b0f9SWilly Tuconf_data = configuration_data()
156c71b0f9SWilly Tuconf_data.set_quoted('STATIC_BIFURCATION_CONFIG', get_option('static-bifurcation'))
166c71b0f9SWilly Tuconf_h = configure_file(
176c71b0f9SWilly Tu  output: 'config.h',
186c71b0f9SWilly Tu  configuration: conf_data)
196c71b0f9SWilly Tu
205e70dc8cSNikhil Namjoshibm_conf_data = configuration_data()
215e70dc8cSNikhil Namjoshibm_conf_data.set10('BARE_METAL', get_option('bare_metal'))
22*3f3ca035SBrandon Kimbm_conf_data.set_quoted('BM_SIGNAL_PATH', get_option('bm-signal-path'))
235e70dc8cSNikhil Namjoshibm_conf_h = configure_file(
245e70dc8cSNikhil Namjoshi  output: 'bm_config.h',
255e70dc8cSNikhil Namjoshi  configuration: bm_conf_data)
265e70dc8cSNikhil Namjoshi
27ac730af2SWilliam A. Kennington IIImeson.get_compiler('cpp').has_header_symbol(
28ac730af2SWilliam A. Kennington III  'ipmid/api.h',
29ac730af2SWilliam A. Kennington III  'ipmid_get_sd_bus_connection')
30ac730af2SWilliam A. Kennington III
31ac730af2SWilliam A. Kennington IIIjson_dep = dependency('nlohmann_json', required: false)
32ac730af2SWilliam A. Kennington IIImeson.get_compiler('cpp').has_header_symbol(
33ac730af2SWilliam A. Kennington III  'nlohmann/json.hpp',
34ac730af2SWilliam A. Kennington III  'nlohmann::json',
35ac730af2SWilliam A. Kennington III  dependencies: json_dep)
36ac730af2SWilliam A. Kennington III
376c71b0f9SWilly Tufmt_dep = dependency('fmt', required: false)
386c71b0f9SWilly Tuif not fmt_dep.found()
396c71b0f9SWilly Tu  fmt_proj = import('cmake').subproject(
406c71b0f9SWilly Tu    'fmt',
416c71b0f9SWilly Tu    cmake_options: [
426c71b0f9SWilly Tu      '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
436c71b0f9SWilly Tu      '-DMASTER_PROJECT=OFF'
446c71b0f9SWilly Tu    ],
456c71b0f9SWilly Tu    required: false)
466c71b0f9SWilly Tu  assert(fmt_proj.found(), 'fmtlib is required')
476c71b0f9SWilly Tu  fmt_dep = fmt_proj.dependency('fmt')
486c71b0f9SWilly Tuendif
496c71b0f9SWilly Tu
506c71b0f9SWilly Tusubdir('bifurcation')
516c71b0f9SWilly Tu
52ac730af2SWilliam A. Kennington IIIsys_pre = declare_dependency(
536c71b0f9SWilly Tu  include_directories: root_inc,
54ac730af2SWilliam A. Kennington III  dependencies: [
55ac730af2SWilliam A. Kennington III    json_dep,
566c71b0f9SWilly Tu    fmt_dep,
57ac730af2SWilliam A. Kennington III    dependency('phosphor-dbus-interfaces'),
58ac730af2SWilliam A. Kennington III    dependency('phosphor-logging'),
59ac730af2SWilliam A. Kennington III    dependency('sdbusplus'),
606c71b0f9SWilly Tu    bifurcation_dep,
61ac730af2SWilliam A. Kennington III  ])
62ac730af2SWilliam A. Kennington III
63ac730af2SWilliam A. Kennington IIIsys_lib = static_library(
64ac730af2SWilliam A. Kennington III  'sys',
655e70dc8cSNikhil Namjoshi  'bmc_mode.cpp',
66ac730af2SWilliam A. Kennington III  'cable.cpp',
67ac730af2SWilliam A. Kennington III  'cpld.cpp',
68ac730af2SWilliam A. Kennington III  'entity_name.cpp',
69ac730af2SWilliam A. Kennington III  'eth.cpp',
70ac730af2SWilliam A. Kennington III  'flash_size.cpp',
71ac730af2SWilliam A. Kennington III  'handler.cpp',
72ac730af2SWilliam A. Kennington III  'host_power_off.cpp',
73ac730af2SWilliam A. Kennington III  'ipmi.cpp',
74ac730af2SWilliam A. Kennington III  'machine_name.cpp',
75ac730af2SWilliam A. Kennington III  'pcie_i2c.cpp',
764f0d1de6SSteve Foreman  'google_accel_oob.cpp',
776c71b0f9SWilly Tu  'pcie_bifurcation.cpp',
78ac730af2SWilliam A. Kennington III  'psu.cpp',
79ac730af2SWilliam A. Kennington III  'util.cpp',
80ac730af2SWilliam A. Kennington III  implicit_include_directories: false,
81ac730af2SWilliam A. Kennington III  dependencies: sys_pre)
82ac730af2SWilliam A. Kennington III
83ac730af2SWilliam A. Kennington IIIsys_dep = declare_dependency(
84ac730af2SWilliam A. Kennington III  link_with: sys_lib,
85ac730af2SWilliam A. Kennington III  dependencies: sys_pre)
86ac730af2SWilliam A. Kennington III
87ac730af2SWilliam A. Kennington IIIif not get_option('tests').disabled()
88ac730af2SWilliam A. Kennington III  subdir('test')
89ac730af2SWilliam A. Kennington IIIendif
90ac730af2SWilliam A. Kennington III
91ac730af2SWilliam A. Kennington IIIshared_module(
92ac730af2SWilliam A. Kennington III  'googlesys',
93ac730af2SWilliam A. Kennington III  'main.cpp',
94ac730af2SWilliam A. Kennington III  implicit_include_directories: false,
95ac730af2SWilliam A. Kennington III  dependencies: [
96ac730af2SWilliam A. Kennington III    dependency('libipmid'),
97ac730af2SWilliam A. Kennington III    sys_dep,
98ac730af2SWilliam A. Kennington III  ],
99ac730af2SWilliam A. Kennington III  install: true,
100ac730af2SWilliam A. Kennington III  install_dir: get_option('libdir') / 'ipmid-providers')
101ac730af2SWilliam A. Kennington III
102ac730af2SWilliam A. Kennington IIIsystemd_dep = dependency('systemd')
103ac730af2SWilliam A. Kennington IIIif systemd_dep.found()
104ac730af2SWilliam A. Kennington III  install_data(
105ac730af2SWilliam A. Kennington III    'gbmc-host-poweroff.target',
106ac730af2SWilliam A. Kennington III    'gbmc-psu-hardreset.target',
1070e22d32aSWilliam A. Kennington III    'gbmc-psu-hardreset-pre.target',
1080e22d32aSWilliam A. Kennington III    'gbmc-psu-hardreset-time.service',
109ac730af2SWilliam A. Kennington III    install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'))
110ac730af2SWilliam A. Kennington IIIendif
111