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#------------------------------------------------------------------------------- 11eea45427SBen Tyner# Versioning 12eea45427SBen Tyner#------------------------------------------------------------------------------- 13eea45427SBen Tynerbuildinfo = vcs_tag(command: ['git', 'describe', '--always', '--long'], 14eea45427SBen Tyner input: 'buildinfo.hpp.in', 15eea45427SBen Tyner output: 'buildinfo.hpp', 16eea45427SBen Tyner replace_string:'@BUILDINFO@', 17eea45427SBen Tyner fallback: '0') 18eea45427SBen Tyner 19eea45427SBen Tyner#------------------------------------------------------------------------------- 20d9573f48SZane Shelley# Compiler 21d9573f48SZane Shelley#------------------------------------------------------------------------------- 22d9573f48SZane Shelley 23f80482a5SZane Shelleycmplr = meson.get_compiler('cpp') 24f80482a5SZane Shelley 25d9573f48SZane Shelley#------------------------------------------------------------------------------- 263a85108fSZane Shelley# Config file 273a85108fSZane Shelley#------------------------------------------------------------------------------- 283a85108fSZane Shelley 293a85108fSZane Shelleyconf = configuration_data() 303a85108fSZane Shelley 313a85108fSZane Shelleyconf.set('CONFIG_PHAL_API', get_option('phal').enabled()) 323a85108fSZane Shelley 333a85108fSZane Shelleyconfigure_file(input: 'config.h.in', output: 'config.h', configuration: conf) 343a85108fSZane Shelley 353a85108fSZane Shelley#------------------------------------------------------------------------------- 36d9573f48SZane Shelley# Include directories 37d9573f48SZane Shelley#------------------------------------------------------------------------------- 38d9573f48SZane Shelley 39d9573f48SZane Shelley# Only using the base directory. All header includes should provide the full 40d9573f48SZane Shelley# path from the base directory. 41d9573f48SZane Shelleyincdir = include_directories('.') 42d9573f48SZane Shelley 43d9573f48SZane Shelley#------------------------------------------------------------------------------- 44d9573f48SZane Shelley# External library dependencies 45d9573f48SZane Shelley#------------------------------------------------------------------------------- 46d9573f48SZane Shelley 47d9573f48SZane Shelley# Look if the libhei library has already been built and installed. If not, 48d9573f48SZane Shelley# default to the subproject. 49f480b739SZane Shelleylibhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) 5092e39fd9SBen Tyner 5161465db5SZane Shelleysdbusplus_dep = dependency('sdbusplus', version : '>=1.0') 5261465db5SZane Shelleydbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 5361465db5SZane Shelley 54f80482a5SZane Shelleylibpdbg_dep = cmplr.find_library('pdbg') 55f80482a5SZane Shelley 5613683089SBen Tyner# See if phosphor-logging is available, if not use test case logging code. This 5713683089SBen Tyner# allows for local builds outside of CI test sandbox. 5813683089SBen Tynerh = 'phosphor-logging/log.hpp' 5913683089SBen Tynerif cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) 6013683089SBen Tyner test_arg = [] 6113683089SBen Tyner phosphor_logging = true 6213683089SBen Tynerelse 6313683089SBen Tyner test_arg = [ 6413683089SBen Tyner '-DTEST_TRACE', 6513683089SBen Tyner ] 6613683089SBen Tyner phosphor_logging = false 6713683089SBen Tynerendif 6813683089SBen Tyner 69c252894dSZane Shelleypthread = declare_dependency(link_args : '-pthread') 70c252894dSZane Shelleylrt = declare_dependency(link_args : '-lrt') 71c252894dSZane Shelley 72c252894dSZane Shelley#------------------------------------------------------------------------------- 73d9573f48SZane Shelley# Build the local static libraries 74c252894dSZane Shelley#------------------------------------------------------------------------------- 75c252894dSZane Shelley 760205f3b3SBen Tynersubdir('analyzer') 77ef320154SBen Tynersubdir('attn') 78f80482a5SZane Shelleysubdir('util') 79248cbf83SZane Shelley 80c252894dSZane Shelleyhwdiags_libs = [ 81c252894dSZane Shelley analyzer_lib, 82c252894dSZane Shelley attn_lib, 83c252894dSZane Shelley util_lib, 84c252894dSZane Shelley] 85c252894dSZane Shelley 86c252894dSZane Shelley#------------------------------------------------------------------------------- 87c252894dSZane Shelley# Build the executable 88c252894dSZane Shelley#------------------------------------------------------------------------------- 898c2f8b24SBen Tyner 90d3cda742SBen Tynerno_listener_mode = get_option('nlmode') 91d3cda742SBen Tyner 92d3cda742SBen Tynerif not no_listener_mode.disabled() 93*832526dfSBen Tyner executable('openpower-hw-diags', 94*832526dfSBen Tyner sources : [ 'main_nl.cpp', 'cli.cpp', buildinfo ], 95c252894dSZane Shelley link_with : hwdiags_libs, 96d3cda742SBen Tyner install : true) 97d3cda742SBen Tynerelse 98*832526dfSBen Tyner executable('openpower-hw-diags', 99*832526dfSBen Tyner sources : [ 'main.cpp', 'cli.cpp', 'listener.cpp', buildinfo ], 1008c2f8b24SBen Tyner dependencies : [lrt, pthread], 101c252894dSZane Shelley link_with : hwdiags_libs, 10213683089SBen Tyner cpp_args : test_arg, 1030205f3b3SBen Tyner install : true) 104d3cda742SBen Tynerendif 1050205f3b3SBen Tyner 106c252894dSZane Shelley#------------------------------------------------------------------------------- 107c252894dSZane Shelley# Test, if configured 108c252894dSZane Shelley#------------------------------------------------------------------------------- 109c252894dSZane Shelley 110248cbf83SZane Shelleybuild_tests = get_option('tests') 111248cbf83SZane Shelley 112248cbf83SZane Shelleyif not build_tests.disabled() 113248cbf83SZane Shelley subdir('test') 114248cbf83SZane Shelleyendif 115