xref: /openbmc/x86-power-control/meson.build (revision 05e8ea8e3c834f2bd029647930dd8c139486bada)
1project(
2    'power-control',
3    'cpp',
4    default_options: [
5        'warning_level=3',
6        'cpp_std=c++23'
7    ],
8    license: 'Apache-2.0',
9    version: '0.1',
10    meson_version: '>=1.1.1',
11)
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
26if get_option('chassis-system-reset').allowed()
27  cpp_args += '-DCHASSIS_SYSTEM_RESET'
28endif
29if get_option('use-plt-rst').allowed()
30  cpp_args += '-DUSE_PLT_RST'
31endif
32if get_option('use-acboot').allowed()
33  cpp_args += '-DUSE_ACBOOT'
34endif
35if get_option('ignore-soft-resets-during-post').allowed()
36  cpp_args += '-DIGNORE_SOFT_RESETS_DURING_POST'
37endif
38if get_option('button-passthrough').allowed()
39  cpp_args += '-DUSE_BUTTON_PASSTHROUGH'
40endif
41
42deps = [
43  dependency('libgpiodcxx', default_options: ['bindings=cxx']),
44  dependency('systemd'),
45  dependency('sdbusplus'),
46  dependency('phosphor-logging'),
47  dependency('nlohmann_json', include_type: 'system'),
48  dependency('boost'),
49]
50
51executable(
52  'power-control',
53  'src/power_control.cpp',
54  include_directories: include_directories('src'),
55  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',
66    install_dir: systemd.get_variable('systemdsystemunitdir'))
67endif
68
69install_data(
70  'config/power-config-host0.json',
71  install_dir: '/usr/share/x86-power-control/')
72