Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-debug-collector', |
| 3 | 'cpp', |
Patrick Williams | 704170c | 2023-07-12 11:15:14 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
Patrick Williams | 704170c | 2023-07-12 11:15:14 -0500 | [diff] [blame] | 8 | 'cpp_std=c++23' |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 9 | ], |
| 10 | license: 'Apache-2.0', |
| 11 | version: '1.0.0', |
| 12 | ) |
| 13 | |
| 14 | systemd = dependency('systemd', required : true) |
| 15 | |
Patrick Williams | eebcf90 | 2022-09-13 11:20:56 -0500 | [diff] [blame] | 16 | sdbusplus_dep = dependency('sdbusplus') |
| 17 | sdbusplusplus_prog = find_program('sdbus++') |
| 18 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson') |
| 19 | sdbusplusplus_depfiles = files() |
| 20 | if sdbusplus_dep.type_name() == 'internal' |
| 21 | sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles') |
| 22 | endif |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 23 | |
| 24 | phosphorlogging = dependency( |
| 25 | 'phosphor-logging', |
| 26 | fallback: [ |
| 27 | 'phosphor-logging', |
| 28 | 'phosphor_logging_dep' |
| 29 | ] |
| 30 | ) |
| 31 | |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 32 | realpath_prog = find_program('realpath') |
| 33 | |
| 34 | selected_subdirs = [] |
| 35 | selected_subdirs += 'org/open_power' |
| 36 | |
| 37 | generated_root = meson.current_build_dir() / 'gen' |
| 38 | generated_others = [] |
| 39 | generated_sources = [] |
| 40 | |
| 41 | # Source the generated meson files |
| 42 | subdir('gen') |
| 43 | foreach d : selected_subdirs |
| 44 | subdir('gen' / d) |
| 45 | endforeach |
| 46 | |
| 47 | # Parse through the list from sdbus++-gendir and put into sets. |
| 48 | generated_headers = [] |
| 49 | generated_cpp = [] |
| 50 | generated_others_files = [] |
| 51 | |
| 52 | foreach g : generated_sources generated_others |
| 53 | foreach f : g.to_list() |
| 54 | rel_path = run_command( |
| 55 | realpath_prog, |
| 56 | '--relative-to', generated_root, |
| 57 | f.full_path(), |
| 58 | ).stdout().strip().split('\n')[-1] |
| 59 | |
| 60 | if rel_path.endswith('.hpp') |
| 61 | generated_headers += rel_path |
| 62 | elif rel_path.endswith('.cpp') |
| 63 | generated_cpp += rel_path |
| 64 | else |
| 65 | generated_others_files += rel_path |
| 66 | endif |
| 67 | endforeach |
| 68 | endforeach |
| 69 | |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 70 | cxx = meson.get_compiler('cpp') |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 71 | conf_data = configuration_data() |
| 72 | if get_option('hostboot-dump-collection').enabled() |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 73 | conf_data.set('WATCHDOG_DUMP_COLLECTION', true) |
| 74 | extra_deps = [ |
| 75 | cxx.find_library('pdbg'), |
| 76 | cxx.find_library('libdt-api'), |
| 77 | cxx.find_library('phal') |
| 78 | ] |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 79 | subdir('watchdog') |
| 80 | else |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 81 | conf_data.set('WATCHDOG_DUMP_COLLECTION', false) |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 82 | watchdog_lib = [] |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 83 | extra_deps = [] |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 84 | endif |
| 85 | |
deepakala-k | 407e5b6 | 2023-04-24 09:15:09 -0500 | [diff] [blame] | 86 | configure_file(output: 'config.h', configuration: conf_data) |
| 87 | |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 88 | deps = [ |
| 89 | systemd, |
Patrick Williams | eebcf90 | 2022-09-13 11:20:56 -0500 | [diff] [blame] | 90 | sdbusplus_dep, |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 91 | phosphorlogging, |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 92 | extra_deps |
| 93 | ] |
| 94 | |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 95 | executable('watchdog_timeout', |
| 96 | 'watchdog_timeout.cpp', |
| 97 | generated_sources, |
| 98 | dependencies: deps, |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 99 | link_with: watchdog_lib, |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 100 | include_directories: include_directories('gen'), |
| 101 | implicit_include_directories: true, |
| 102 | install: true |
| 103 | ) |
| 104 | |
| 105 | executable('checkstop_app', |
| 106 | 'checkstop_app.cpp', |
| 107 | generated_sources, |
| 108 | dependencies: deps, |
| 109 | include_directories: include_directories('gen'), |
| 110 | implicit_include_directories: true, |
| 111 | install: true |
| 112 | ) |