1project( 2 'google-ipmi-sys', 3 'cpp', 4 version: '0.1', 5 meson_version: '>=0.57.0', 6 default_options: [ 7 'cpp_std=c++20', 8 'warning_level=3', 9 'werror=true', 10 ]) 11 12root_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 20bm_conf_data = configuration_data() 21bm_conf_data.set10('BARE_METAL', get_option('bare_metal')) 22bm_conf_h = configure_file( 23 output: 'bm_config.h', 24 configuration: bm_conf_data) 25 26meson.get_compiler('cpp').has_header_symbol( 27 'ipmid/api.h', 28 'ipmid_get_sd_bus_connection') 29 30json_dep = dependency('nlohmann_json', required: false) 31meson.get_compiler('cpp').has_header_symbol( 32 'nlohmann/json.hpp', 33 'nlohmann::json', 34 dependencies: json_dep) 35 36fmt_dep = dependency('fmt', required: false) 37if not fmt_dep.found() 38 fmt_proj = import('cmake').subproject( 39 'fmt', 40 cmake_options: [ 41 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', 42 '-DMASTER_PROJECT=OFF' 43 ], 44 required: false) 45 assert(fmt_proj.found(), 'fmtlib is required') 46 fmt_dep = fmt_proj.dependency('fmt') 47endif 48 49subdir('bifurcation') 50 51sys_pre = declare_dependency( 52 include_directories: root_inc, 53 dependencies: [ 54 json_dep, 55 fmt_dep, 56 dependency('phosphor-dbus-interfaces'), 57 dependency('phosphor-logging'), 58 dependency('sdbusplus'), 59 bifurcation_dep, 60 ]) 61 62sys_lib = static_library( 63 'sys', 64 'bmc_mode.cpp', 65 'cable.cpp', 66 'cpld.cpp', 67 'entity_name.cpp', 68 'eth.cpp', 69 'flash_size.cpp', 70 'handler.cpp', 71 'host_power_off.cpp', 72 'ipmi.cpp', 73 'machine_name.cpp', 74 'pcie_i2c.cpp', 75 'google_accel_oob.cpp', 76 'pcie_bifurcation.cpp', 77 'psu.cpp', 78 'util.cpp', 79 implicit_include_directories: false, 80 dependencies: sys_pre) 81 82sys_dep = declare_dependency( 83 link_with: sys_lib, 84 dependencies: sys_pre) 85 86if not get_option('tests').disabled() 87 subdir('test') 88endif 89 90shared_module( 91 'googlesys', 92 'main.cpp', 93 implicit_include_directories: false, 94 dependencies: [ 95 dependency('libipmid'), 96 sys_dep, 97 ], 98 install: true, 99 install_dir: get_option('libdir') / 'ipmid-providers') 100 101systemd_dep = dependency('systemd') 102if systemd_dep.found() 103 install_data( 104 'gbmc-host-poweroff.target', 105 'gbmc-psu-hardreset.target', 106 'gbmc-psu-hardreset-pre.target', 107 'gbmc-psu-hardreset-time.service', 108 install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')) 109endif 110