1# See README.md for details. 2project('openpower-hw-diags', 'cpp', 3 version: '0.1', meson_version: '>=0.49.0', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++17', 8 'cpp_args=-Wno-unused-parameter' 9 ]) 10 11#------------------------------------------------------------------------------- 12# Compiler 13#------------------------------------------------------------------------------- 14 15cmplr = meson.get_compiler('cpp') 16 17#------------------------------------------------------------------------------- 18# Include directories 19#------------------------------------------------------------------------------- 20 21# Only using the base directory. All header includes should provide the full 22# path from the base directory. 23incdir = include_directories('.') 24 25#------------------------------------------------------------------------------- 26# External library dependencies 27#------------------------------------------------------------------------------- 28 29# Look if the libhei library has already been built and installed. If not, 30# default to the subproject. 31libhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) 32 33sdbusplus_dep = dependency('sdbusplus', version : '>=1.0') 34dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 35 36libpdbg_dep = cmplr.find_library('pdbg') 37 38# See if phosphor-logging is available, if not use test case logging code. This 39# allows for local builds outside of CI test sandbox. 40h = 'phosphor-logging/log.hpp' 41if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) 42 test_arg = [] 43 phosphor_logging = true 44else 45 test_arg = [ 46 '-DTEST_TRACE', 47 ] 48 phosphor_logging = false 49endif 50 51pthread = declare_dependency(link_args : '-pthread') 52lrt = declare_dependency(link_args : '-lrt') 53 54#------------------------------------------------------------------------------- 55# Build the local static libraries 56#------------------------------------------------------------------------------- 57 58subdir('analyzer') 59subdir('attn') 60subdir('util') 61 62hwdiags_libs = [ 63 analyzer_lib, 64 attn_lib, 65 util_lib, 66] 67 68#------------------------------------------------------------------------------- 69# Build the executable 70#------------------------------------------------------------------------------- 71 72no_listener_mode = get_option('nlmode') 73 74if not no_listener_mode.disabled() 75 executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp', 76 link_with : hwdiags_libs, 77 install : true) 78else 79 executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp', 80 dependencies : [lrt, pthread], 81 link_with : hwdiags_libs, 82 cpp_args : test_arg, 83 install : true) 84endif 85 86#------------------------------------------------------------------------------- 87# Test, if configured 88#------------------------------------------------------------------------------- 89 90build_tests = get_option('tests') 91 92if not build_tests.disabled() 93 subdir('test') 94endif 95 96