xref: /openbmc/openpower-hw-diags/meson.build (revision f80482a5017a898ee69fec57d15a6201a6fcbbd5)
1f480b739SZane Shelley# See README.md for details.
2248cbf83SZane Shelleyproject('openpower-hw-diags', 'cpp',
3248cbf83SZane Shelley        version: '0.1', meson_version: '>=0.49.0',
4248cbf83SZane Shelley        default_options: [
5248cbf83SZane Shelley          'warning_level=3',
6248cbf83SZane Shelley          'werror=true',
792e39fd9SBen Tyner          'cpp_std=c++17',
892e39fd9SBen Tyner          'cpp_args=-Wno-unused-parameter'
9248cbf83SZane Shelley        ])
10248cbf83SZane Shelley
11*f80482a5SZane Shelleycmplr = meson.get_compiler('cpp')
12*f80482a5SZane Shelley
13f480b739SZane Shelley# First, look if the libhei library has already been built and installed. If
14f480b739SZane Shelley# not, default to the subproject.
15f480b739SZane Shelleylibhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep'])
1692e39fd9SBen Tyner
1761465db5SZane Shelleysdbusplus_dep       = dependency('sdbusplus', version : '>=1.0')
1861465db5SZane Shelleydbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
1961465db5SZane Shelley
20*f80482a5SZane Shelleylibpdbg_dep = cmplr.find_library('pdbg')
21*f80482a5SZane Shelley
220205f3b3SBen Tynerincdir = include_directories('.')
230205f3b3SBen Tyner
2413683089SBen Tyner# See if phosphor-logging is available, if not use test case logging code. This
2513683089SBen Tyner# allows for local builds outside of CI test sandbox.
2613683089SBen Tynerh = 'phosphor-logging/log.hpp'
2713683089SBen Tynerif cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h))
2813683089SBen Tyner    test_arg = []
2913683089SBen Tyner    phosphor_logging = true
3013683089SBen Tynerelse
3113683089SBen Tyner    test_arg = [
3213683089SBen Tyner        '-DTEST_TRACE',
3313683089SBen Tyner    ]
3413683089SBen Tyner    phosphor_logging = false
3513683089SBen Tynerendif
3613683089SBen Tyner
370205f3b3SBen Tynersubdir('analyzer')
38ef320154SBen Tynersubdir('attn')
39*f80482a5SZane Shelleysubdir('util')
40248cbf83SZane Shelley
418c2f8b24SBen Tynerpthread = declare_dependency(link_args : '-pthread')
428c2f8b24SBen Tynerlrt = declare_dependency(link_args : '-lrt')
438c2f8b24SBen Tyner
44d3cda742SBen Tynerno_listener_mode = get_option('nlmode')
45d3cda742SBen Tyner
46d3cda742SBen Tynerif not no_listener_mode.disabled()
47d3cda742SBen Tyner  executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp',
48*f80482a5SZane Shelley              link_with : [analyzer, attn, util_lib],
49d3cda742SBen Tyner              install : true)
50d3cda742SBen Tynerelse
518c2f8b24SBen Tyner  executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
528c2f8b24SBen Tyner              dependencies : [lrt, pthread],
53*f80482a5SZane Shelley              link_with : [analyzer, attn, util_lib],
5413683089SBen Tyner              cpp_args : test_arg,
550205f3b3SBen Tyner              install : true)
56d3cda742SBen Tynerendif
570205f3b3SBen Tyner
58248cbf83SZane Shelleybuild_tests = get_option('tests')
59248cbf83SZane Shelley
60248cbf83SZane Shelleyif not build_tests.disabled()
61248cbf83SZane Shelley  subdir('test')
62248cbf83SZane Shelleyendif
63