blob: f477fcece11151a2ffc471a2d578f4950987689e [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
Zane Shelleyc2528942020-12-02 15:42:42 -060037pthread = declare_dependency(link_args : '-pthread')
38lrt = declare_dependency(link_args : '-lrt')
39
40#-------------------------------------------------------------------------------
41# Build the static libraries
42#-------------------------------------------------------------------------------
43
Ben Tyner0205f3b2020-02-24 10:24:47 -060044subdir('analyzer')
Ben Tyneref320152020-01-09 10:31:23 -060045subdir('attn')
Zane Shelleyf80482a2020-12-02 15:13:13 -060046subdir('util')
Zane Shelley248cbf82019-05-03 17:07:18 -050047
Zane Shelleyc2528942020-12-02 15:42:42 -060048hwdiags_libs = [
49 analyzer_lib,
50 attn_lib,
51 util_lib,
52]
53
54#-------------------------------------------------------------------------------
55# Build the executable
56#-------------------------------------------------------------------------------
Ben Tyner8c2f8b22020-03-27 10:39:31 -050057
Ben Tynerd3cda742020-05-04 08:00:28 -050058no_listener_mode = get_option('nlmode')
59
60if not no_listener_mode.disabled()
61 executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp',
Zane Shelleyc2528942020-12-02 15:42:42 -060062 link_with : hwdiags_libs,
Ben Tynerd3cda742020-05-04 08:00:28 -050063 install : true)
64else
65 executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
66 dependencies : [lrt, pthread],
Zane Shelleyc2528942020-12-02 15:42:42 -060067 link_with : hwdiags_libs,
Ben Tyner13683082020-06-25 12:49:47 -050068 cpp_args : test_arg,
Ben Tynerd3cda742020-05-04 08:00:28 -050069 install : true)
70endif
Ben Tyner0205f3b2020-02-24 10:24:47 -060071
Zane Shelleyc2528942020-12-02 15:42:42 -060072#-------------------------------------------------------------------------------
73# Test, if configured
74#-------------------------------------------------------------------------------
75
Zane Shelley248cbf82019-05-03 17:07:18 -050076build_tests = get_option('tests')
77
78if not build_tests.disabled()
79 subdir('test')
80endif
Zane Shelleyc2528942020-12-02 15:42:42 -060081