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 10*d2854b75SZane Shelley# Package directory root, which will contain required data files. 11*d2854b75SZane Shelleypackage_dir = join_paths( get_option('prefix'), 12*d2854b75SZane Shelley get_option('datadir'), 13*d2854b75SZane Shelley meson.project_name() ) 14*d2854b75SZane Shelley 15*d2854b75SZane Shelley# Compiler option so that source knows the package directory. 16*d2854b75SZane Shelleypackage_args = [ '-DPACKAGE_DIR="' + package_dir + '/"' ] 17*d2854b75SZane Shelley 18d9573f48SZane Shelley#------------------------------------------------------------------------------- 19eea45427SBen Tyner# Versioning 20eea45427SBen Tyner#------------------------------------------------------------------------------- 21eea45427SBen Tynerbuildinfo = vcs_tag(command: ['git', 'describe', '--always', '--long'], 22eea45427SBen Tyner input: 'buildinfo.hpp.in', 23eea45427SBen Tyner output: 'buildinfo.hpp', 24eea45427SBen Tyner replace_string:'@BUILDINFO@', 25eea45427SBen Tyner fallback: '0') 26eea45427SBen Tyner 27eea45427SBen Tyner#------------------------------------------------------------------------------- 28d9573f48SZane Shelley# Compiler 29d9573f48SZane Shelley#------------------------------------------------------------------------------- 30d9573f48SZane Shelley 31f80482a5SZane Shelleycmplr = meson.get_compiler('cpp') 32f80482a5SZane Shelley 33d9573f48SZane Shelley#------------------------------------------------------------------------------- 343a85108fSZane Shelley# Config file 353a85108fSZane Shelley#------------------------------------------------------------------------------- 363a85108fSZane Shelley 373a85108fSZane Shelleyconf = configuration_data() 383a85108fSZane Shelley 393a85108fSZane Shelleyconf.set('CONFIG_PHAL_API', get_option('phal').enabled()) 403a85108fSZane Shelley 413a85108fSZane Shelleyconfigure_file(input: 'config.h.in', output: 'config.h', configuration: conf) 423a85108fSZane Shelley 433a85108fSZane Shelley#------------------------------------------------------------------------------- 44d9573f48SZane Shelley# Include directories 45d9573f48SZane Shelley#------------------------------------------------------------------------------- 46d9573f48SZane Shelley 47d9573f48SZane Shelley# Only using the base directory. All header includes should provide the full 48d9573f48SZane Shelley# path from the base directory. 49d9573f48SZane Shelleyincdir = include_directories('.') 50d9573f48SZane Shelley 51d9573f48SZane Shelley#------------------------------------------------------------------------------- 52d9573f48SZane Shelley# External library dependencies 53d9573f48SZane Shelley#------------------------------------------------------------------------------- 54d9573f48SZane Shelley 55d9573f48SZane Shelley# Look if the libhei library has already been built and installed. If not, 56d9573f48SZane Shelley# default to the subproject. 57f480b739SZane Shelleylibhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) 5892e39fd9SBen Tyner 5961465db5SZane Shelleysdbusplus_dep = dependency('sdbusplus', version : '>=1.0') 6061465db5SZane Shelleydbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 6161465db5SZane Shelley 62f80482a5SZane Shelleylibpdbg_dep = cmplr.find_library('pdbg') 63f80482a5SZane Shelley 6413683089SBen Tyner# See if phosphor-logging is available, if not use test case logging code. This 6513683089SBen Tyner# allows for local builds outside of CI test sandbox. 6613683089SBen Tynerh = 'phosphor-logging/log.hpp' 6713683089SBen Tynerif cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) 6813683089SBen Tyner test_arg = [] 6913683089SBen Tyner phosphor_logging = true 7013683089SBen Tynerelse 7113683089SBen Tyner test_arg = [ 7213683089SBen Tyner '-DTEST_TRACE', 7313683089SBen Tyner ] 7413683089SBen Tyner phosphor_logging = false 7513683089SBen Tynerendif 7613683089SBen Tyner 77c252894dSZane Shelleypthread = declare_dependency(link_args : '-pthread') 78c252894dSZane Shelleylrt = declare_dependency(link_args : '-lrt') 79c252894dSZane Shelley 80c252894dSZane Shelley#------------------------------------------------------------------------------- 81d9573f48SZane Shelley# Build the local static libraries 82c252894dSZane Shelley#------------------------------------------------------------------------------- 83c252894dSZane Shelley 840205f3b3SBen Tynersubdir('analyzer') 85ef320154SBen Tynersubdir('attn') 86f80482a5SZane Shelleysubdir('util') 87248cbf83SZane Shelley 88c252894dSZane Shelleyhwdiags_libs = [ 89c252894dSZane Shelley analyzer_lib, 90c252894dSZane Shelley attn_lib, 91c252894dSZane Shelley util_lib, 92c252894dSZane Shelley] 93c252894dSZane Shelley 94c252894dSZane Shelley#------------------------------------------------------------------------------- 95c252894dSZane Shelley# Build the executable 96c252894dSZane Shelley#------------------------------------------------------------------------------- 978c2f8b24SBen Tyner 98d3cda742SBen Tynerno_listener_mode = get_option('nlmode') 99d3cda742SBen Tyner 100d3cda742SBen Tynerif not no_listener_mode.disabled() 101832526dfSBen Tyner executable('openpower-hw-diags', 102832526dfSBen Tyner sources : [ 'main_nl.cpp', 'cli.cpp', buildinfo ], 103c252894dSZane Shelley link_with : hwdiags_libs, 104d3cda742SBen Tyner install : true) 105d3cda742SBen Tynerelse 106832526dfSBen Tyner executable('openpower-hw-diags', 107832526dfSBen Tyner sources : [ 'main.cpp', 'cli.cpp', 'listener.cpp', buildinfo ], 1088c2f8b24SBen Tyner dependencies : [lrt, pthread], 109c252894dSZane Shelley link_with : hwdiags_libs, 11013683089SBen Tyner cpp_args : test_arg, 1110205f3b3SBen Tyner install : true) 112d3cda742SBen Tynerendif 1130205f3b3SBen Tyner 114c252894dSZane Shelley#------------------------------------------------------------------------------- 115c252894dSZane Shelley# Test, if configured 116c252894dSZane Shelley#------------------------------------------------------------------------------- 117c252894dSZane Shelley 118248cbf83SZane Shelleybuild_tests = get_option('tests') 119248cbf83SZane Shelley 120248cbf83SZane Shelleyif not build_tests.disabled() 121248cbf83SZane Shelley subdir('test') 122248cbf83SZane Shelleyendif 123