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', |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 8 | ]) |
| 9 | |
Zane Shelley | d9573f4 | 2020-12-02 15:52:06 -0600 | [diff] [blame] | 10 | #------------------------------------------------------------------------------- |
| 11 | # Compiler |
| 12 | #------------------------------------------------------------------------------- |
| 13 | |
Zane Shelley | f80482a | 2020-12-02 15:13:13 -0600 | [diff] [blame] | 14 | cmplr = meson.get_compiler('cpp') |
| 15 | |
Zane Shelley | d9573f4 | 2020-12-02 15:52:06 -0600 | [diff] [blame] | 16 | #------------------------------------------------------------------------------- |
| 17 | # Include directories |
| 18 | #------------------------------------------------------------------------------- |
| 19 | |
| 20 | # Only using the base directory. All header includes should provide the full |
| 21 | # path from the base directory. |
| 22 | incdir = include_directories('.') |
| 23 | |
| 24 | #------------------------------------------------------------------------------- |
| 25 | # External library dependencies |
| 26 | #------------------------------------------------------------------------------- |
| 27 | |
| 28 | # Look if the libhei library has already been built and installed. If not, |
| 29 | # default to the subproject. |
Zane Shelley | f480b73 | 2020-06-11 10:05:16 -0500 | [diff] [blame] | 30 | libhei_dep = dependency('hei', fallback : ['libhei', 'libhei_dep']) |
Ben Tyner | 92e39fd | 2020-02-05 18:11:02 -0600 | [diff] [blame] | 31 | |
Zane Shelley | 61465db | 2020-10-30 14:53:11 -0500 | [diff] [blame] | 32 | sdbusplus_dep = dependency('sdbusplus', version : '>=1.0') |
| 33 | dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 34 | |
Zane Shelley | f80482a | 2020-12-02 15:13:13 -0600 | [diff] [blame] | 35 | libpdbg_dep = cmplr.find_library('pdbg') |
| 36 | |
Ben Tyner | 1368308 | 2020-06-25 12:49:47 -0500 | [diff] [blame] | 37 | # See if phosphor-logging is available, if not use test case logging code. This |
| 38 | # allows for local builds outside of CI test sandbox. |
| 39 | h = 'phosphor-logging/log.hpp' |
Ben Tyner | 1368308 | 2020-06-25 12:49:47 -0500 | [diff] [blame] | 40 | if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h)) |
| 41 | test_arg = [] |
| 42 | phosphor_logging = true |
| 43 | else |
| 44 | test_arg = [ |
| 45 | '-DTEST_TRACE', |
| 46 | ] |
| 47 | phosphor_logging = false |
| 48 | endif |
| 49 | |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 50 | pthread = declare_dependency(link_args : '-pthread') |
| 51 | lrt = declare_dependency(link_args : '-lrt') |
| 52 | |
| 53 | #------------------------------------------------------------------------------- |
Zane Shelley | d9573f4 | 2020-12-02 15:52:06 -0600 | [diff] [blame] | 54 | # Build the local static libraries |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 55 | #------------------------------------------------------------------------------- |
| 56 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 57 | subdir('analyzer') |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 58 | subdir('attn') |
Zane Shelley | f80482a | 2020-12-02 15:13:13 -0600 | [diff] [blame] | 59 | subdir('util') |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 60 | |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 61 | hwdiags_libs = [ |
| 62 | analyzer_lib, |
| 63 | attn_lib, |
| 64 | util_lib, |
| 65 | ] |
| 66 | |
| 67 | #------------------------------------------------------------------------------- |
| 68 | # Build the executable |
| 69 | #------------------------------------------------------------------------------- |
Ben Tyner | 8c2f8b2 | 2020-03-27 10:39:31 -0500 | [diff] [blame] | 70 | |
Ben Tyner | d3cda74 | 2020-05-04 08:00:28 -0500 | [diff] [blame] | 71 | no_listener_mode = get_option('nlmode') |
| 72 | |
| 73 | if not no_listener_mode.disabled() |
| 74 | executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp', |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 75 | link_with : hwdiags_libs, |
Ben Tyner | d3cda74 | 2020-05-04 08:00:28 -0500 | [diff] [blame] | 76 | install : true) |
| 77 | else |
| 78 | executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp', |
| 79 | dependencies : [lrt, pthread], |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 80 | link_with : hwdiags_libs, |
Ben Tyner | 1368308 | 2020-06-25 12:49:47 -0500 | [diff] [blame] | 81 | cpp_args : test_arg, |
Ben Tyner | d3cda74 | 2020-05-04 08:00:28 -0500 | [diff] [blame] | 82 | install : true) |
| 83 | endif |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 84 | |
Zane Shelley | c252894 | 2020-12-02 15:42:42 -0600 | [diff] [blame] | 85 | #------------------------------------------------------------------------------- |
| 86 | # Test, if configured |
| 87 | #------------------------------------------------------------------------------- |
| 88 | |
Zane Shelley | 248cbf8 | 2019-05-03 17:07:18 -0500 | [diff] [blame] | 89 | build_tests = get_option('tests') |
| 90 | |
| 91 | if not build_tests.disabled() |
| 92 | subdir('test') |
| 93 | endif |