William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'google-ipmi-sys', |
| 3 | 'cpp', |
| 4 | version: '0.1', |
Willy Tu | c841bfd | 2021-09-14 15:26:58 -0700 | [diff] [blame] | 5 | meson_version: '>=0.57.0', |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 6 | default_options: [ |
Willy Tu | c841bfd | 2021-09-14 15:26:58 -0700 | [diff] [blame] | 7 | 'cpp_std=c++20', |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 8 | 'warning_level=3', |
| 9 | 'werror=true', |
| 10 | ]) |
| 11 | |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 12 | root_inc = include_directories('.') |
| 13 | |
| 14 | conf_data = configuration_data() |
| 15 | conf_data.set_quoted('STATIC_BIFURCATION_CONFIG', get_option('static-bifurcation')) |
| 16 | conf_h = configure_file( |
| 17 | output: 'config.h', |
| 18 | configuration: conf_data) |
| 19 | |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 20 | meson.get_compiler('cpp').has_header_symbol( |
| 21 | 'ipmid/api.h', |
| 22 | 'ipmid_get_sd_bus_connection') |
| 23 | |
| 24 | json_dep = dependency('nlohmann_json', required: false) |
| 25 | meson.get_compiler('cpp').has_header_symbol( |
| 26 | 'nlohmann/json.hpp', |
| 27 | 'nlohmann::json', |
| 28 | dependencies: json_dep) |
| 29 | |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 30 | fmt_dep = dependency('fmt', required: false) |
| 31 | if 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') |
| 41 | endif |
| 42 | |
| 43 | subdir('bifurcation') |
| 44 | |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 45 | sys_pre = declare_dependency( |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 46 | include_directories: root_inc, |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 47 | dependencies: [ |
| 48 | json_dep, |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 49 | fmt_dep, |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 50 | dependency('phosphor-dbus-interfaces'), |
| 51 | dependency('phosphor-logging'), |
| 52 | dependency('sdbusplus'), |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 53 | bifurcation_dep, |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 54 | ]) |
| 55 | |
| 56 | sys_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 Foreman | 4f0d1de | 2021-09-20 14:06:32 -0700 | [diff] [blame] | 68 | 'google_accel_oob.cpp', |
Willy Tu | 6c71b0f | 2021-10-10 13:34:41 -0700 | [diff] [blame] | 69 | 'pcie_bifurcation.cpp', |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 70 | 'psu.cpp', |
| 71 | 'util.cpp', |
| 72 | implicit_include_directories: false, |
| 73 | dependencies: sys_pre) |
| 74 | |
| 75 | sys_dep = declare_dependency( |
| 76 | link_with: sys_lib, |
| 77 | dependencies: sys_pre) |
| 78 | |
| 79 | if not get_option('tests').disabled() |
| 80 | subdir('test') |
| 81 | endif |
| 82 | |
| 83 | shared_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 | |
| 94 | systemd_dep = dependency('systemd') |
| 95 | if systemd_dep.found() |
| 96 | install_data( |
| 97 | 'gbmc-host-poweroff.target', |
| 98 | 'gbmc-psu-hardreset.target', |
William A. Kennington III | 0e22d32 | 2022-04-07 12:32:36 -0700 | [diff] [blame] | 99 | 'gbmc-psu-hardreset-pre.target', |
| 100 | 'gbmc-psu-hardreset-time.service', |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 101 | install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')) |
| 102 | endif |