blob: dd0544531b85816d63885eb57f4a37d465f3fb6c [file] [log] [blame]
Zane Shelleyf480b732020-06-11 10:05:16 -05001# See README.md for details.
Zane Shelley248cbf82019-05-03 17:07:18 -05002project('openpower-hw-diags', 'cpp',
3 version: '0.1', meson_version: '>=0.49.0',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
Ben Tyner92e39fd2020-02-05 18:11:02 -06007 'cpp_std=c++17',
8 'cpp_args=-Wno-unused-parameter'
Zane Shelley248cbf82019-05-03 17:07:18 -05009 ])
10
Zane Shelleyf80482a2020-12-02 15:13:13 -060011cmplr = meson.get_compiler('cpp')
12
Zane Shelleyf480b732020-06-11 10:05:16 -050013# First, look if the libhei library has already been built and installed. If
14# not, default to the subproject.
15libhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep'])
Ben Tyner92e39fd2020-02-05 18:11:02 -060016
Zane Shelley61465db2020-10-30 14:53:11 -050017sdbusplus_dep = dependency('sdbusplus', version : '>=1.0')
18dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
19
Zane Shelleyf80482a2020-12-02 15:13:13 -060020libpdbg_dep = cmplr.find_library('pdbg')
21
Ben Tyner0205f3b2020-02-24 10:24:47 -060022incdir = include_directories('.')
23
Ben Tyner13683082020-06-25 12:49:47 -050024# See if phosphor-logging is available, if not use test case logging code. This
25# allows for local builds outside of CI test sandbox.
26h = 'phosphor-logging/log.hpp'
Ben Tyner13683082020-06-25 12:49:47 -050027if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h))
28 test_arg = []
29 phosphor_logging = true
30else
31 test_arg = [
32 '-DTEST_TRACE',
33 ]
34 phosphor_logging = false
35endif
36
Ben Tyner0205f3b2020-02-24 10:24:47 -060037subdir('analyzer')
Ben Tyneref320152020-01-09 10:31:23 -060038subdir('attn')
Zane Shelleyf80482a2020-12-02 15:13:13 -060039subdir('util')
Zane Shelley248cbf82019-05-03 17:07:18 -050040
Ben Tyner8c2f8b22020-03-27 10:39:31 -050041pthread = declare_dependency(link_args : '-pthread')
42lrt = declare_dependency(link_args : '-lrt')
43
Ben Tynerd3cda742020-05-04 08:00:28 -050044no_listener_mode = get_option('nlmode')
45
46if not no_listener_mode.disabled()
47 executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp',
Zane Shelleyf80482a2020-12-02 15:13:13 -060048 link_with : [analyzer, attn, util_lib],
Ben Tynerd3cda742020-05-04 08:00:28 -050049 install : true)
50else
51 executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
52 dependencies : [lrt, pthread],
Zane Shelleyf80482a2020-12-02 15:13:13 -060053 link_with : [analyzer, attn, util_lib],
Ben Tyner13683082020-06-25 12:49:47 -050054 cpp_args : test_arg,
Ben Tynerd3cda742020-05-04 08:00:28 -050055 install : true)
56endif
Ben Tyner0205f3b2020-02-24 10:24:47 -060057
Zane Shelley248cbf82019-05-03 17:07:18 -050058build_tests = get_option('tests')
59
60if not build_tests.disabled()
61 subdir('test')
62endif