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