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 | |
| 12 | meson.get_compiler('cpp').has_header_symbol( |
| 13 | 'ipmid/api.h', |
| 14 | 'ipmid_get_sd_bus_connection') |
| 15 | |
| 16 | json_dep = dependency('nlohmann_json', required: false) |
| 17 | meson.get_compiler('cpp').has_header_symbol( |
| 18 | 'nlohmann/json.hpp', |
| 19 | 'nlohmann::json', |
| 20 | dependencies: json_dep) |
| 21 | |
| 22 | sys_pre = declare_dependency( |
| 23 | include_directories: include_directories('.'), |
| 24 | dependencies: [ |
| 25 | json_dep, |
| 26 | dependency('phosphor-dbus-interfaces'), |
| 27 | dependency('phosphor-logging'), |
| 28 | dependency('sdbusplus'), |
| 29 | ]) |
| 30 | |
| 31 | sys_lib = static_library( |
| 32 | 'sys', |
| 33 | 'cable.cpp', |
| 34 | 'cpld.cpp', |
| 35 | 'entity_name.cpp', |
| 36 | 'eth.cpp', |
| 37 | 'flash_size.cpp', |
| 38 | 'handler.cpp', |
| 39 | 'host_power_off.cpp', |
| 40 | 'ipmi.cpp', |
| 41 | 'machine_name.cpp', |
| 42 | 'pcie_i2c.cpp', |
Steve Foreman | 4f0d1de | 2021-09-20 14:06:32 -0700 | [diff] [blame^] | 43 | 'google_accel_oob.cpp', |
William A. Kennington III | ac730af | 2021-06-24 03:15:38 -0700 | [diff] [blame] | 44 | 'psu.cpp', |
| 45 | 'util.cpp', |
| 46 | implicit_include_directories: false, |
| 47 | dependencies: sys_pre) |
| 48 | |
| 49 | sys_dep = declare_dependency( |
| 50 | link_with: sys_lib, |
| 51 | dependencies: sys_pre) |
| 52 | |
| 53 | if not get_option('tests').disabled() |
| 54 | subdir('test') |
| 55 | endif |
| 56 | |
| 57 | shared_module( |
| 58 | 'googlesys', |
| 59 | 'main.cpp', |
| 60 | implicit_include_directories: false, |
| 61 | dependencies: [ |
| 62 | dependency('libipmid'), |
| 63 | sys_dep, |
| 64 | ], |
| 65 | install: true, |
| 66 | install_dir: get_option('libdir') / 'ipmid-providers') |
| 67 | |
| 68 | systemd_dep = dependency('systemd') |
| 69 | if systemd_dep.found() |
| 70 | install_data( |
| 71 | 'gbmc-host-poweroff.target', |
| 72 | 'gbmc-psu-hardreset.target', |
| 73 | install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')) |
| 74 | endif |