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', |
Patrick Williams | cc037b8 | 2023-07-12 11:15:20 -0500 | [diff] [blame] | 6 | 'cpp_std=c++23' |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 7 | ], |
| 8 | license: 'Apache-2.0', |
| 9 | version: '0.1', |
Patrick Williams | cc037b8 | 2023-07-12 11:15:20 -0500 | [diff] [blame] | 10 | meson_version: '>=1.1.1', |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 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 | |
Patrick Williams | 68ea831 | 2023-11-29 06:44:07 -0600 | [diff] [blame] | 26 | if get_option('chassis-system-reset').allowed() |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 27 | cpp_args += '-DCHASSIS_SYSTEM_RESET' |
| 28 | endif |
Patrick Williams | 68ea831 | 2023-11-29 06:44:07 -0600 | [diff] [blame] | 29 | if get_option('use-plt-rst').allowed() |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 30 | cpp_args += '-DUSE_PLT_RST' |
| 31 | endif |
Patrick Williams | 68ea831 | 2023-11-29 06:44:07 -0600 | [diff] [blame] | 32 | if get_option('use-acboot').allowed() |
Andrei Kartashev | 99e8f9d | 2022-01-09 12:15:05 +0300 | [diff] [blame] | 33 | cpp_args += '-DUSE_ACBOOT' |
| 34 | endif |
Patrick Williams | 68ea831 | 2023-11-29 06:44:07 -0600 | [diff] [blame] | 35 | if get_option('ignore-soft-resets-during-post').allowed() |
Matt Simmering | 58e379d | 2022-09-23 14:45:50 -0700 | [diff] [blame] | 36 | cpp_args += '-DIGNORE_SOFT_RESETS_DURING_POST' |
| 37 | endif |
Renze Nicolai | 05e8ea8 | 2024-07-04 00:46:16 +0200 | [diff] [blame] | 38 | if get_option('button-passthrough').allowed() |
| 39 | cpp_args += '-DUSE_BUTTON_PASSTHROUGH' |
| 40 | endif |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 41 | |
| 42 | deps = [ |
Nan Zhou | fd672c9 | 2022-09-05 22:58:12 +0000 | [diff] [blame] | 43 | dependency('libgpiodcxx', default_options: ['bindings=cxx']), |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 44 | dependency('systemd'), |
Nan Zhou | fd672c9 | 2022-09-05 22:58:12 +0000 | [diff] [blame] | 45 | dependency('sdbusplus'), |
| 46 | dependency('phosphor-logging'), |
Patrick Williams | b1e34a1 | 2023-12-07 14:43:29 -0600 | [diff] [blame] | 47 | dependency('nlohmann_json', include_type: 'system'), |
Konstantin Aladyshev | 61ccc49 | 2024-03-29 16:42:17 +0300 | [diff] [blame] | 48 | dependency('boost'), |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 49 | ] |
| 50 | |
| 51 | executable( |
| 52 | 'power-control', |
| 53 | 'src/power_control.cpp', |
Andrei Kartashev | 50fe8ee | 2022-01-04 21:24:22 +0300 | [diff] [blame] | 54 | include_directories: include_directories('src'), |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 55 | cpp_args: cpp_args, |
| 56 | dependencies: deps, |
| 57 | install: true, |
| 58 | install_dir: get_option('bindir')) |
| 59 | |
| 60 | systemd = dependency('systemd') |
| 61 | if systemd.found() |
| 62 | install_data( |
| 63 | 'service_files/chassis-system-reset.service', |
| 64 | 'service_files/chassis-system-reset.target', |
| 65 | 'service_files/xyz.openbmc_project.Chassis.Control.Power@.service', |
Patrick Williams | f56ef59 | 2023-04-12 08:05:14 -0500 | [diff] [blame] | 66 | install_dir: systemd.get_variable('systemdsystemunitdir')) |
Jason M. Bills | 6199ccf | 2021-10-21 14:48:59 -0700 | [diff] [blame] | 67 | endif |
| 68 | |
| 69 | install_data( |
| 70 | 'config/power-config-host0.json', |
Andrei Kartashev | 50fe8ee | 2022-01-04 21:24:22 +0300 | [diff] [blame] | 71 | install_dir: '/usr/share/x86-power-control/') |