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*d9573f48SZane Shelley#------------------------------------------------------------------------------- 12*d9573f48SZane Shelley# Compiler 13*d9573f48SZane Shelley#------------------------------------------------------------------------------- 14*d9573f48SZane Shelley 15f80482a5SZane Shelleycmplr = meson.get_compiler('cpp') 16f80482a5SZane Shelley 17*d9573f48SZane Shelley#------------------------------------------------------------------------------- 18*d9573f48SZane Shelley# Include directories 19*d9573f48SZane Shelley#------------------------------------------------------------------------------- 20*d9573f48SZane Shelley 21*d9573f48SZane Shelley# Only using the base directory. All header includes should provide the full 22*d9573f48SZane Shelley# path from the base directory. 23*d9573f48SZane Shelleyincdir = include_directories('.') 24*d9573f48SZane Shelley 25*d9573f48SZane Shelley#------------------------------------------------------------------------------- 26*d9573f48SZane Shelley# External library dependencies 27*d9573f48SZane Shelley#------------------------------------------------------------------------------- 28*d9573f48SZane Shelley 29*d9573f48SZane Shelley# Look if the libhei library has already been built and installed. If not, 30*d9573f48SZane Shelley# default to the subproject. 31f480b739SZane Shelleylibhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) 3292e39fd9SBen Tyner 3361465db5SZane Shelleysdbusplus_dep = dependency('sdbusplus', version : '>=1.0') 3461465db5SZane Shelleydbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 3561465db5SZane Shelley 36f80482a5SZane Shelleylibpdbg_dep = cmplr.find_library('pdbg') 37f80482a5SZane Shelley 3813683089SBen Tyner# See if phosphor-logging is available, if not use test case logging code. This 3913683089SBen Tyner# allows for local builds outside of CI test sandbox. 4013683089SBen Tynerh = 'phosphor-logging/log.hpp' 4113683089SBen Tynerif cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) 4213683089SBen Tyner test_arg = [] 4313683089SBen Tyner phosphor_logging = true 4413683089SBen Tynerelse 4513683089SBen Tyner test_arg = [ 4613683089SBen Tyner '-DTEST_TRACE', 4713683089SBen Tyner ] 4813683089SBen Tyner phosphor_logging = false 4913683089SBen Tynerendif 5013683089SBen Tyner 51c252894dSZane Shelleypthread = declare_dependency(link_args : '-pthread') 52c252894dSZane Shelleylrt = declare_dependency(link_args : '-lrt') 53c252894dSZane Shelley 54c252894dSZane Shelley#------------------------------------------------------------------------------- 55*d9573f48SZane Shelley# Build the local static libraries 56c252894dSZane Shelley#------------------------------------------------------------------------------- 57c252894dSZane Shelley 580205f3b3SBen Tynersubdir('analyzer') 59ef320154SBen Tynersubdir('attn') 60f80482a5SZane Shelleysubdir('util') 61248cbf83SZane Shelley 62c252894dSZane Shelleyhwdiags_libs = [ 63c252894dSZane Shelley analyzer_lib, 64c252894dSZane Shelley attn_lib, 65c252894dSZane Shelley util_lib, 66c252894dSZane Shelley] 67c252894dSZane Shelley 68c252894dSZane Shelley#------------------------------------------------------------------------------- 69c252894dSZane Shelley# Build the executable 70c252894dSZane Shelley#------------------------------------------------------------------------------- 718c2f8b24SBen Tyner 72d3cda742SBen Tynerno_listener_mode = get_option('nlmode') 73d3cda742SBen Tyner 74d3cda742SBen Tynerif not no_listener_mode.disabled() 75d3cda742SBen Tyner executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp', 76c252894dSZane Shelley link_with : hwdiags_libs, 77d3cda742SBen Tyner install : true) 78d3cda742SBen Tynerelse 798c2f8b24SBen Tyner executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp', 808c2f8b24SBen Tyner dependencies : [lrt, pthread], 81c252894dSZane Shelley link_with : hwdiags_libs, 8213683089SBen Tyner cpp_args : test_arg, 830205f3b3SBen Tyner install : true) 84d3cda742SBen Tynerendif 850205f3b3SBen Tyner 86c252894dSZane Shelley#------------------------------------------------------------------------------- 87c252894dSZane Shelley# Test, if configured 88c252894dSZane Shelley#------------------------------------------------------------------------------- 89c252894dSZane Shelley 90248cbf83SZane Shelleybuild_tests = get_option('tests') 91248cbf83SZane Shelley 92248cbf83SZane Shelleyif not build_tests.disabled() 93248cbf83SZane Shelley subdir('test') 94248cbf83SZane Shelleyendif 95c252894dSZane Shelley 96