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', 8248cbf83SZane Shelley ]) 9248cbf83SZane Shelley 10d9573f48SZane Shelley#------------------------------------------------------------------------------- 11d9573f48SZane Shelley# Compiler 12d9573f48SZane Shelley#------------------------------------------------------------------------------- 13d9573f48SZane Shelley 14f80482a5SZane Shelleycmplr = meson.get_compiler('cpp') 15f80482a5SZane Shelley 16d9573f48SZane Shelley#------------------------------------------------------------------------------- 17*3a85108fSZane Shelley# Config file 18*3a85108fSZane Shelley#------------------------------------------------------------------------------- 19*3a85108fSZane Shelley 20*3a85108fSZane Shelleyconf = configuration_data() 21*3a85108fSZane Shelley 22*3a85108fSZane Shelleyconf.set('CONFIG_PHAL_API', get_option('phal').enabled()) 23*3a85108fSZane Shelley 24*3a85108fSZane Shelleyconfigure_file(input: 'config.h.in', output: 'config.h', configuration: conf) 25*3a85108fSZane Shelley 26*3a85108fSZane Shelley#------------------------------------------------------------------------------- 27d9573f48SZane Shelley# Include directories 28d9573f48SZane Shelley#------------------------------------------------------------------------------- 29d9573f48SZane Shelley 30d9573f48SZane Shelley# Only using the base directory. All header includes should provide the full 31d9573f48SZane Shelley# path from the base directory. 32d9573f48SZane Shelleyincdir = include_directories('.') 33d9573f48SZane Shelley 34d9573f48SZane Shelley#------------------------------------------------------------------------------- 35d9573f48SZane Shelley# External library dependencies 36d9573f48SZane Shelley#------------------------------------------------------------------------------- 37d9573f48SZane Shelley 38d9573f48SZane Shelley# Look if the libhei library has already been built and installed. If not, 39d9573f48SZane Shelley# default to the subproject. 40f480b739SZane Shelleylibhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) 4192e39fd9SBen Tyner 4261465db5SZane Shelleysdbusplus_dep = dependency('sdbusplus', version : '>=1.0') 4361465db5SZane Shelleydbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 4461465db5SZane Shelley 45f80482a5SZane Shelleylibpdbg_dep = cmplr.find_library('pdbg') 46f80482a5SZane Shelley 4713683089SBen Tyner# See if phosphor-logging is available, if not use test case logging code. This 4813683089SBen Tyner# allows for local builds outside of CI test sandbox. 4913683089SBen Tynerh = 'phosphor-logging/log.hpp' 5013683089SBen Tynerif cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) 5113683089SBen Tyner test_arg = [] 5213683089SBen Tyner phosphor_logging = true 5313683089SBen Tynerelse 5413683089SBen Tyner test_arg = [ 5513683089SBen Tyner '-DTEST_TRACE', 5613683089SBen Tyner ] 5713683089SBen Tyner phosphor_logging = false 5813683089SBen Tynerendif 5913683089SBen Tyner 60c252894dSZane Shelleypthread = declare_dependency(link_args : '-pthread') 61c252894dSZane Shelleylrt = declare_dependency(link_args : '-lrt') 62c252894dSZane Shelley 63c252894dSZane Shelley#------------------------------------------------------------------------------- 64d9573f48SZane Shelley# Build the local static libraries 65c252894dSZane Shelley#------------------------------------------------------------------------------- 66c252894dSZane Shelley 670205f3b3SBen Tynersubdir('analyzer') 68ef320154SBen Tynersubdir('attn') 69f80482a5SZane Shelleysubdir('util') 70248cbf83SZane Shelley 71c252894dSZane Shelleyhwdiags_libs = [ 72c252894dSZane Shelley analyzer_lib, 73c252894dSZane Shelley attn_lib, 74c252894dSZane Shelley util_lib, 75c252894dSZane Shelley] 76c252894dSZane Shelley 77c252894dSZane Shelley#------------------------------------------------------------------------------- 78c252894dSZane Shelley# Build the executable 79c252894dSZane Shelley#------------------------------------------------------------------------------- 808c2f8b24SBen Tyner 81d3cda742SBen Tynerno_listener_mode = get_option('nlmode') 82d3cda742SBen Tyner 83d3cda742SBen Tynerif not no_listener_mode.disabled() 84d3cda742SBen Tyner executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp', 85c252894dSZane Shelley link_with : hwdiags_libs, 86d3cda742SBen Tyner install : true) 87d3cda742SBen Tynerelse 888c2f8b24SBen Tyner executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp', 898c2f8b24SBen Tyner dependencies : [lrt, pthread], 90c252894dSZane Shelley link_with : hwdiags_libs, 9113683089SBen Tyner cpp_args : test_arg, 920205f3b3SBen Tyner install : true) 93d3cda742SBen Tynerendif 940205f3b3SBen Tyner 95c252894dSZane Shelley#------------------------------------------------------------------------------- 96c252894dSZane Shelley# Test, if configured 97c252894dSZane Shelley#------------------------------------------------------------------------------- 98c252894dSZane Shelley 99248cbf83SZane Shelleybuild_tests = get_option('tests') 100248cbf83SZane Shelley 101248cbf83SZane Shelleyif not build_tests.disabled() 102248cbf83SZane Shelley subdir('test') 103248cbf83SZane Shelleyendif 104