Zane Shelley | f480b73 | 2020-06-11 10:05:16 -0500 | [diff] [blame] | 1 | # See README.md for details. |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 2 | project('openpower-hw-diags', 'cpp', |
| 3 | version: '0.1', meson_version: '>=0.49.0', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Ben Tyner | 92e39fd | 2020-02-05 18:11:02 -0600 | [diff] [blame] | 7 | 'cpp_std=c++17', |
| 8 | 'cpp_args=-Wno-unused-parameter' |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 9 | ]) |
| 10 | |
Zane Shelley | f480b73 | 2020-06-11 10:05:16 -0500 | [diff] [blame] | 11 | # First, look if the libhei library has already been built and installed. If |
| 12 | # not, default to the subproject. |
| 13 | libhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) |
Ben Tyner | 92e39fd | 2020-02-05 18:11:02 -0600 | [diff] [blame] | 14 | |
Zane Shelley | 61465db | 2020-10-30 14:53:11 -0500 | [diff] [blame] | 15 | sdbusplus_dep = dependency('sdbusplus', version : '>=1.0') |
| 16 | dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 17 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 18 | incdir = include_directories('.') |
| 19 | |
Ben Tyner | 1368308 | 2020-06-25 12:49:47 -0500 | [diff] [blame] | 20 | # See if phosphor-logging is available, if not use test case logging code. This |
| 21 | # allows for local builds outside of CI test sandbox. |
| 22 | h = 'phosphor-logging/log.hpp' |
| 23 | cmplr = meson.get_compiler('cpp') |
| 24 | if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) |
| 25 | test_arg = [] |
| 26 | phosphor_logging = true |
| 27 | else |
| 28 | test_arg = [ |
| 29 | '-DTEST_TRACE', |
| 30 | ] |
| 31 | phosphor_logging = false |
| 32 | endif |
| 33 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 34 | subdir('analyzer') |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 35 | subdir('attn') |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 36 | |
Ben Tyner | 8c2f8b2 | 2020-03-27 10:39:31 -0500 | [diff] [blame] | 37 | pthread = declare_dependency(link_args : '-pthread') |
| 38 | lrt = declare_dependency(link_args : '-lrt') |
| 39 | |
Ben Tyner | d3cda74 | 2020-05-04 08:00:28 -0500 | [diff] [blame] | 40 | no_listener_mode = get_option('nlmode') |
| 41 | |
| 42 | if not no_listener_mode.disabled() |
| 43 | executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp', |
| 44 | link_with : [analyzer, attn], |
| 45 | install : true) |
| 46 | else |
| 47 | executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp', |
| 48 | dependencies : [lrt, pthread], |
| 49 | link_with : [analyzer, attn], |
Ben Tyner | 1368308 | 2020-06-25 12:49:47 -0500 | [diff] [blame] | 50 | cpp_args : test_arg, |
Ben Tyner | d3cda74 | 2020-05-04 08:00:28 -0500 | [diff] [blame] | 51 | install : true) |
| 52 | endif |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 53 | |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 54 | build_tests = get_option('tests') |
| 55 | |
| 56 | if not build_tests.disabled() |
| 57 | subdir('test') |
| 58 | endif |