blob: 5549302677a18526f63f17166f86c75fbebeb0b2 [file] [log] [blame]
Jason M. Bills5e1e7e32023-08-03 13:42:18 -07001project(
Patrick Williamsa78e4252025-02-01 08:38:46 -05002 'host-error-monitor',
3 'cpp',
4 version: '1.0',
5 meson_version: '>=1.1.1',
6 default_options: [
7 'b_ndebug=if-release',
8 'cpp_rtti=false',
9 'cpp_std=c++20',
10 'warning_level=3',
11 'werror=true',
12 ],
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070013)
14
Patrick Williams4b87df92025-01-30 17:48:30 -050015if (get_option('libpeci').allowed())
Patrick Williamsa78e4252025-02-01 08:38:46 -050016 add_project_arguments('-DLIBPECI', language: 'cpp')
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070017endif
18
Patrick Williams4b87df92025-01-30 17:48:30 -050019if (get_option('crashdump').allowed())
Patrick Williamsa78e4252025-02-01 08:38:46 -050020 add_project_arguments('-DCRASHDUMP', language: 'cpp')
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070021endif
22
Patrick Williams4b87df92025-01-30 17:48:30 -050023if (get_option('send-to-logger').allowed())
Patrick Williamsa78e4252025-02-01 08:38:46 -050024 add_project_arguments('-DSEND_TO_LOGGING_SERVICE', language: 'cpp')
Paul Fertser97b5ef22024-01-23 10:07:21 +000025endif
26
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070027sdbusplus = dependency('sdbusplus')
Patrick Williamsa78e4252025-02-01 08:38:46 -050028gpiodcxx = dependency('libgpiodcxx', default_options: ['bindings=cxx'])
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070029
30systemd = dependency('systemd', required: true)
Jason M. Bills28836072024-05-17 12:47:15 -070031systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070032
Patrick Williamsa78e4252025-02-01 08:38:46 -050033boost = dependency(
34 'boost',
35 version: '>=1.82.0',
36 required: false,
37 include_type: 'system',
38)
Jason M. Bills1b7e5602023-10-03 14:42:23 -070039if not boost.found()
Patrick Williamsa78e4252025-02-01 08:38:46 -050040 boost = subproject('boost', required: true).get_variable('boost_dep')
41 boost = boost.as_system('system')
Jason M. Bills1b7e5602023-10-03 14:42:23 -070042endif
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070043add_project_arguments(
Patrick Williamsa78e4252025-02-01 08:38:46 -050044 [
45 '-DBOOST_ASIO_DISABLE_THREADS',
46 '-DBOOST_ASIO_EXCEPTION_DISABLE',
47 '-DBOOST_ASIO_NO_DEPRECATED',
48 '-DBOOST_NO_RTTI',
49 '-DBOOST_NO_TYPEID',
50 ],
51 language: 'cpp',
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070052)
53
Paul Fertser97b5ef22024-01-23 10:07:21 +000054phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
55
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070056bindir = get_option('prefix') + '/' + get_option('bindir')
57
Patrick Williamsa78e4252025-02-01 08:38:46 -050058deps = [boost, gpiodcxx, sdbusplus, phosphor_dbus_interfaces]
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070059
Patrick Williams4b87df92025-01-30 17:48:30 -050060if (get_option('libpeci').allowed())
Patrick Williamsa78e4252025-02-01 08:38:46 -050061 peci = dependency('libpeci')
62 deps += [peci]
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070063endif
64
Jason M. Billsd6087ae2023-10-09 11:54:13 -070065incs = include_directories('include')
66
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070067executable(
Patrick Williamsa78e4252025-02-01 08:38:46 -050068 'host-error-monitor',
69 'src/host_error_monitor.cpp',
70 include_directories: incs,
71 dependencies: deps,
72 install: true,
73 install_dir: bindir,
Jason M. Bills5e1e7e32023-08-03 13:42:18 -070074)
75
76subdir('service_files')
Jason M. Billsd6087ae2023-10-09 11:54:13 -070077
Jason M. Bills7aede382024-04-01 11:44:08 -070078if get_option('tests').allowed()
Patrick Williamsa78e4252025-02-01 08:38:46 -050079 subdir('tests')
80endif