blob: 80eeed600dcd07d23a7b961b1321131d6bba5a50 [file] [log] [blame]
Jason M. Bills6199ccf2021-10-21 14:48:59 -07001project(
2 'power-control',
3 'cpp',
4 default_options: [
5 'warning_level=3',
Patrick Williamscc037b82023-07-12 11:15:20 -05006 'cpp_std=c++23'
Jason M. Bills6199ccf2021-10-21 14:48:59 -07007 ],
8 license: 'Apache-2.0',
9 version: '0.1',
Patrick Williamscc037b82023-07-12 11:15:20 -050010 meson_version: '>=1.1.1',
Jason M. Bills6199ccf2021-10-21 14:48:59 -070011)
12
13add_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
24cpp_args = []
25
Patrick Williams68ea8312023-11-29 06:44:07 -060026if get_option('chassis-system-reset').allowed()
Jason M. Bills6199ccf2021-10-21 14:48:59 -070027 cpp_args += '-DCHASSIS_SYSTEM_RESET'
28endif
Patrick Williams68ea8312023-11-29 06:44:07 -060029if get_option('use-plt-rst').allowed()
Jason M. Bills6199ccf2021-10-21 14:48:59 -070030 cpp_args += '-DUSE_PLT_RST'
31endif
Patrick Williams68ea8312023-11-29 06:44:07 -060032if get_option('use-acboot').allowed()
Andrei Kartashev99e8f9d2022-01-09 12:15:05 +030033 cpp_args += '-DUSE_ACBOOT'
34endif
Patrick Williams68ea8312023-11-29 06:44:07 -060035if get_option('ignore-soft-resets-during-post').allowed()
Matt Simmering58e379d2022-09-23 14:45:50 -070036 cpp_args += '-DIGNORE_SOFT_RESETS_DURING_POST'
37endif
Renze Nicolai05e8ea82024-07-04 00:46:16 +020038if get_option('button-passthrough').allowed()
39 cpp_args += '-DUSE_BUTTON_PASSTHROUGH'
40endif
Jason M. Bills6199ccf2021-10-21 14:48:59 -070041
42deps = [
Nan Zhoufd672c92022-09-05 22:58:12 +000043 dependency('libgpiodcxx', default_options: ['bindings=cxx']),
Jason M. Bills6199ccf2021-10-21 14:48:59 -070044 dependency('systemd'),
Nan Zhoufd672c92022-09-05 22:58:12 +000045 dependency('sdbusplus'),
46 dependency('phosphor-logging'),
Patrick Williamsb1e34a12023-12-07 14:43:29 -060047 dependency('nlohmann_json', include_type: 'system'),
Konstantin Aladyshev61ccc492024-03-29 16:42:17 +030048 dependency('boost'),
Jason M. Bills6199ccf2021-10-21 14:48:59 -070049]
50
51executable(
52 'power-control',
53 'src/power_control.cpp',
Andrei Kartashev50fe8ee2022-01-04 21:24:22 +030054 include_directories: include_directories('src'),
Jason M. Bills6199ccf2021-10-21 14:48:59 -070055 cpp_args: cpp_args,
56 dependencies: deps,
57 install: true,
58 install_dir: get_option('bindir'))
59
60systemd = dependency('systemd')
61if 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 Williamsf56ef592023-04-12 08:05:14 -050066 install_dir: systemd.get_variable('systemdsystemunitdir'))
Jason M. Bills6199ccf2021-10-21 14:48:59 -070067endif
68
69install_data(
70 'config/power-config-host0.json',
Andrei Kartashev50fe8ee2022-01-04 21:24:22 +030071 install_dir: '/usr/share/x86-power-control/')