Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'power-control', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
Jason M. Bills | 48c94c5 | 2021-10-19 14:36:14 -0700 | [diff] [blame] | 6 | 'cpp_std=c++20' |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 7 | ], |
| 8 | license: 'Apache-2.0', |
| 9 | version: '0.1', |
| 10 | meson_version: '>=0.57.0', |
| 11 | ) |
| 12 | |
| 13 | add_project_arguments( |
| 14 | '-Wno-psabi', |
| 15 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 16 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 17 | '-DBOOST_NO_RTTI', |
| 18 | '-DBOOST_NO_TYPEID', |
| 19 | '-DBOOST_ALL_NO_LIB', |
| 20 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 21 | language: 'cpp', |
| 22 | ) |
| 23 | |
| 24 | cpp_args = [] |
| 25 | |
| 26 | if get_option('chassis-system-reset').enabled() |
| 27 | cpp_args += '-DCHASSIS_SYSTEM_RESET' |
| 28 | endif |
| 29 | if get_option('use-plt-rst').enabled() |
| 30 | cpp_args += '-DUSE_PLT_RST' |
| 31 | endif |
Andrei Kartashev | 99e8f9d | 2022-01-09 12:15:05 +0300 | [diff] [blame^] | 32 | if get_option('use-acboot').enabled() |
| 33 | cpp_args += '-DUSE_ACBOOT' |
| 34 | endif |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 35 | |
| 36 | deps = [ |
| 37 | dependency('libgpiodcxx', fallback: ['libgpiod', 'gpiodcxx_dep'], default_options: ['bindings=cxx']), |
| 38 | dependency('systemd'), |
| 39 | dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']), |
Jason M. Bills | c46ebb4 | 2021-11-10 11:41:31 -0800 | [diff] [blame] | 40 | dependency('phosphor-logging', fallback: ['phosphor-logging', 'phosphor_logging_dep']), |
| 41 | |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 42 | ] |
| 43 | |
| 44 | executable( |
| 45 | 'power-control', |
| 46 | 'src/power_control.cpp', |
Andrei Kartashev | 50fe8ee | 2022-01-04 21:24:22 +0300 | [diff] [blame] | 47 | include_directories: include_directories('src'), |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 48 | cpp_args: cpp_args, |
| 49 | dependencies: deps, |
| 50 | install: true, |
| 51 | install_dir: get_option('bindir')) |
| 52 | |
| 53 | systemd = dependency('systemd') |
| 54 | if systemd.found() |
| 55 | install_data( |
| 56 | 'service_files/chassis-system-reset.service', |
| 57 | 'service_files/chassis-system-reset.target', |
| 58 | 'service_files/xyz.openbmc_project.Chassis.Control.Power@.service', |
| 59 | install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir')) |
| 60 | endif |
| 61 | |
| 62 | install_data( |
| 63 | 'config/power-config-host0.json', |
Andrei Kartashev | 50fe8ee | 2022-01-04 21:24:22 +0300 | [diff] [blame] | 64 | install_dir: '/usr/share/x86-power-control/') |