xref: /openbmc/phosphor-gpio-monitor/meson.build (revision c087fa76fb457790c93cfebc0acaaf14bf5023ad)
12d66b517SBrad Bishopproject(
22d66b517SBrad Bishop    'phosphor-gpio-monitor',
32d66b517SBrad Bishop    'cpp',
42d66b517SBrad Bishop    default_options: [
52d66b517SBrad Bishop        'warning_level=3',
62d66b517SBrad Bishop        'werror=true',
7ee1663cfSPatrick Williams        'cpp_std=c++23',
8*c087fa76SPatrick Williams        'buildtype=debugoptimized',
92d66b517SBrad Bishop    ],
102d66b517SBrad Bishop    license: 'Apache-2.0',
112d66b517SBrad Bishop    version: '1.0',
12ee1663cfSPatrick Williams    meson_version: '>=1.1.1',
132d66b517SBrad Bishop)
142d66b517SBrad Bishop
150172969cSPatrick Williamscxx = meson.get_compiler('cpp')
160172969cSPatrick Williams
172d66b517SBrad Bishoplibevdev = dependency('libevdev')
182d66b517SBrad Bishoplibsystemd = dependency('libsystemd')
19939a6431SVijay Khemkalibgpiod = dependency('libgpiod')
202d66b517SBrad Bishopphosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
212d66b517SBrad Bishopphosphor_logging = dependency('phosphor-logging')
222d66b517SBrad Bishopsdbusplus = dependency('sdbusplus')
2326373abeSBrad Bishopsystemd = dependency('systemd')
2426373abeSBrad Bishop
25ccfea221SPatrick Williamsnlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
260172969cSPatrick Williams
270172969cSPatrick Williamsif cxx.has_header('CLI/CLI.hpp')
280172969cSPatrick Williams    cli11_dep = declare_dependency()
290172969cSPatrick Williamselse
300172969cSPatrick Williams    cli11_dep = dependency('CLI11')
310172969cSPatrick Williamsendif
320172969cSPatrick Williams
33*c087fa76SPatrick Williamsboost_args = [
34*c087fa76SPatrick Williams    '-DBOOST_ASIO_DISABLE_THREADS',
35939a6431SVijay Khemka    '-DBOOST_ERROR_CODE_HEADER_ONLY',
36*c087fa76SPatrick Williams    '-DBOOST_SYSTEM_NO_DEPRECATED',
37*c087fa76SPatrick Williams]
38939a6431SVijay Khemka
399f8459a5SKonstantin Aladyshevboost_dep = dependency('boost')
409f8459a5SKonstantin Aladyshev
410c60faaaSPatrick Williamssystemd_system_unit_dir = systemd.get_variable(
4226373abeSBrad Bishop    'systemdsystemunitdir',
43*c087fa76SPatrick Williams    pkgconfig_define: ['prefix', get_option('prefix')],
44*c087fa76SPatrick Williams)
4526373abeSBrad Bishop
461c0e4ea0SGeorge Liufs = import('fs')
471c0e4ea0SGeorge Liufs.copyfile(
481c0e4ea0SGeorge Liu    'phosphor-gpio-monitor@.service',
4926373abeSBrad Bishop    install: true,
50*c087fa76SPatrick Williams    install_dir: systemd_system_unit_dir,
5126373abeSBrad Bishop)
5226373abeSBrad Bishop
531c0e4ea0SGeorge Liufs.copyfile(
541c0e4ea0SGeorge Liu    'phosphor-multi-gpio-monitor.service',
55d34bd96cSVijay Khemka    install: true,
56*c087fa76SPatrick Williams    install_dir: systemd_system_unit_dir,
57d34bd96cSVijay Khemka)
58d34bd96cSVijay Khemka
591c0e4ea0SGeorge Liufs.copyfile(
6046a9a5b9SPatrick Rudolph    'phosphor-multi-gpio-presence.service',
6146a9a5b9SPatrick Rudolph    install: true,
62*c087fa76SPatrick Williams    install_dir: systemd_system_unit_dir,
6346a9a5b9SPatrick Rudolph)
6446a9a5b9SPatrick Rudolph
6546a9a5b9SPatrick Rudolphfs.copyfile(
661c0e4ea0SGeorge Liu    'phosphor-gpio-presence@.service',
6726373abeSBrad Bishop    install: true,
68*c087fa76SPatrick Williams    install_dir: systemd_system_unit_dir,
6926373abeSBrad Bishop)
702d66b517SBrad Bishop
7158dc277aSAlvin Wangudev = dependency('udev')
7258dc277aSAlvin Wangudev_rules_dir = join_paths(
730c60faaaSPatrick Williams    udev.get_variable(
7458dc277aSAlvin Wang        'udevdir',
750c60faaaSPatrick Williams        pkgconfig_define: ['prefix', get_option('prefix')],
7658dc277aSAlvin Wang    ),
7758dc277aSAlvin Wang    'rules.d',
7858dc277aSAlvin Wang)
7958dc277aSAlvin Wang
80*c087fa76SPatrick Williamsfs.copyfile('99-gpio-keys.rules', install: true, install_dir: udev_rules_dir)
8158dc277aSAlvin Wang
821c0e4ea0SGeorge Liufs.copyfile(
831c0e4ea0SGeorge Liu    'phosphor-multi-gpio-monitor.json',
84d34bd96cSVijay Khemka    install: true,
85*c087fa76SPatrick Williams    install_dir: get_option('datadir') / 'phosphor-gpio-monitor',
86d34bd96cSVijay Khemka)
87d34bd96cSVijay Khemka
882d66b517SBrad Bishoplibevdev_o = static_library(
892d66b517SBrad Bishop    'libevdev_o',
902d66b517SBrad Bishop    'evdev.cpp',
912d66b517SBrad Bishop    dependencies: [
922d66b517SBrad Bishop        libevdev,
932d66b517SBrad Bishop        phosphor_dbus_interfaces,
942d66b517SBrad Bishop        phosphor_logging,
952d66b517SBrad Bishop        sdbusplus,
96*c087fa76SPatrick Williams    ],
972d66b517SBrad Bishop)
982d66b517SBrad Bishop
992d66b517SBrad Bishoplibmonitor_o = static_library(
1002d66b517SBrad Bishop    'libmonitor_o',
1012d66b517SBrad Bishop    'monitor.cpp',
102*c087fa76SPatrick Williams    dependencies: [libevdev, libsystemd, phosphor_logging],
103*c087fa76SPatrick Williams    link_with: [libevdev_o],
1042d66b517SBrad Bishop)
1052d66b517SBrad Bishop
1062d66b517SBrad Bishopphosphor_gpio_monitor = executable(
1072d66b517SBrad Bishop    'phosphor-gpio-monitor',
1082d66b517SBrad Bishop    'mainapp.cpp',
109*c087fa76SPatrick Williams    dependencies: [cli11_dep, libevdev, libsystemd, phosphor_logging],
1102d66b517SBrad Bishop    install: true,
111*c087fa76SPatrick Williams    link_with: [libevdev_o, libmonitor_o],
1122d66b517SBrad Bishop)
1132d66b517SBrad Bishop
114939a6431SVijay Khemkaexecutable(
115939a6431SVijay Khemka    'phosphor-multi-gpio-monitor',
116939a6431SVijay Khemka    'gpioMonMain.cpp',
117939a6431SVijay Khemka    'gpioMon.cpp',
118939a6431SVijay Khemka    dependencies: [
1190172969cSPatrick Williams        cli11_dep,
1200172969cSPatrick Williams        libgpiod,
1210172969cSPatrick Williams        nlohmann_json_dep,
12246a9a5b9SPatrick Rudolph        phosphor_dbus_interfaces,
123939a6431SVijay Khemka        phosphor_logging,
124939a6431SVijay Khemka        sdbusplus,
125*c087fa76SPatrick Williams        boost_dep,
126939a6431SVijay Khemka    ],
127939a6431SVijay Khemka    cpp_args: boost_args,
128939a6431SVijay Khemka    install: true,
129939a6431SVijay Khemka)
130939a6431SVijay Khemka
1312d66b517SBrad Bishopsubdir('presence')
13246a9a5b9SPatrick Rudolphsubdir('multi-presence')
133bf055283SGeorge Liu
134bf055283SGeorge Liubuild_tests = get_option('tests')
135bf055283SGeorge Liuif build_tests.allowed()
1362d66b517SBrad Bishop    subdir('test')
137bf055283SGeorge Liuendif
138