Allow building locally without phosphor-logging
Check for phosphor-logging available. It is only available when building
via CI, SDK or if phosphor-logging and associated dbus support has been
installed locally. If phosphor-logging is not available then compile in
minimal logging code. This allows for local testing of changes that are
not affected by or depend on phosphor-logging.
Change-Id: I1b4d54c36b181596beff465307c16ca33f2f91d8
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 9ae1548..3354725 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -7,4 +7,5 @@
analyzer_src,
include_directories : incdir,
dependencies : libhei_dep,
+ cpp_args : test_arg,
install : false)
diff --git a/attn/meson.build b/attn/meson.build
index 5d53674..f75bd60 100644
--- a/attn/meson.build
+++ b/attn/meson.build
@@ -1,6 +1,3 @@
-# needed to find external libraries not registered with package manager
-cmplr = meson.get_compiler('cpp')
-
# async gpio monitor needs boost library
boost_args = ['-DBOOST_ASIO_DISABLE_THREADS',
'-DBOOST_ERROR_CODE_HEADER_ONLY',
@@ -26,8 +23,7 @@
)
# see if phosphor-logging is available, if not use test case logging code
-h = 'phosphor-logging/log.hpp'
-if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h))
+if (true == phosphor_logging)
logging_src = 'attn_logging.cpp'
else
logging_src = '../test/end2end/logging.cpp'
@@ -43,5 +39,5 @@
attn_src,
include_directories : incdir,
dependencies : [libpdbg, sdbusplus, libgpiod],
- cpp_args : boost_args,
+ cpp_args : [boost_args, test_arg],
install : true)
diff --git a/meson.build b/meson.build
index 352e5e4..891b3b5 100644
--- a/meson.build
+++ b/meson.build
@@ -14,6 +14,20 @@
incdir = include_directories('.')
+# See if phosphor-logging is available, if not use test case logging code. This
+# allows for local builds outside of CI test sandbox.
+h = 'phosphor-logging/log.hpp'
+cmplr = meson.get_compiler('cpp')
+if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h))
+ test_arg = []
+ phosphor_logging = true
+else
+ test_arg = [
+ '-DTEST_TRACE',
+ ]
+ phosphor_logging = false
+endif
+
subdir('analyzer')
subdir('attn')
@@ -30,6 +44,7 @@
executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
dependencies : [lrt, pthread],
link_with : [analyzer, attn],
+ cpp_args : test_arg,
install : true)
endif