Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-debug-collector', |
| 3 | 'cpp', |
Patrick Williams | 1485d7c | 2023-04-12 08:10:13 -0500 | [diff] [blame^] | 4 | meson_version: '>= 0.58.0', |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
| 8 | 'cpp_std=c++20' |
| 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 | |
Dhruvaraj Subhashchandran | 4bb6d32 | 2021-07-26 22:56:50 -0500 | [diff] [blame] | 32 | fmt_dep = dependency('fmt', required: false) |
| 33 | if not fmt_dep.found() |
| 34 | fmt_proj = import('cmake').subproject( |
| 35 | 'fmt', |
| 36 | cmake_options: [ |
| 37 | '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', |
| 38 | '-DMASTER_PROJECT=OFF' |
| 39 | ], |
| 40 | required: false) |
| 41 | assert(fmt_proj.found(), 'fmtlib is required') |
| 42 | fmt_dep = fmt_proj.dependency('fmt') |
| 43 | endif |
| 44 | |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 45 | realpath_prog = find_program('realpath') |
| 46 | |
| 47 | selected_subdirs = [] |
| 48 | selected_subdirs += 'org/open_power' |
| 49 | |
| 50 | generated_root = meson.current_build_dir() / 'gen' |
| 51 | generated_others = [] |
| 52 | generated_sources = [] |
| 53 | |
| 54 | # Source the generated meson files |
| 55 | subdir('gen') |
| 56 | foreach d : selected_subdirs |
| 57 | subdir('gen' / d) |
| 58 | endforeach |
| 59 | |
| 60 | # Parse through the list from sdbus++-gendir and put into sets. |
| 61 | generated_headers = [] |
| 62 | generated_cpp = [] |
| 63 | generated_others_files = [] |
| 64 | |
| 65 | foreach g : generated_sources generated_others |
| 66 | foreach f : g.to_list() |
| 67 | rel_path = run_command( |
| 68 | realpath_prog, |
| 69 | '--relative-to', generated_root, |
| 70 | f.full_path(), |
| 71 | ).stdout().strip().split('\n')[-1] |
| 72 | |
| 73 | if rel_path.endswith('.hpp') |
| 74 | generated_headers += rel_path |
| 75 | elif rel_path.endswith('.cpp') |
| 76 | generated_cpp += rel_path |
| 77 | else |
| 78 | generated_others_files += rel_path |
| 79 | endif |
| 80 | endforeach |
| 81 | endforeach |
| 82 | |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 83 | cxx = meson.get_compiler('cpp') |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 84 | conf_data = configuration_data() |
| 85 | if get_option('hostboot-dump-collection').enabled() |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 86 | conf_data.set('WATCHDOG_DUMP_COLLECTION', true) |
| 87 | extra_deps = [ |
| 88 | cxx.find_library('pdbg'), |
| 89 | cxx.find_library('libdt-api'), |
| 90 | cxx.find_library('phal') |
| 91 | ] |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 92 | subdir('watchdog') |
| 93 | else |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 94 | conf_data.set('WATCHDOG_DUMP_COLLECTION', false) |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 95 | watchdog_lib = [] |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 96 | extra_deps = [] |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 97 | endif |
| 98 | |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 99 | deps = [ |
| 100 | systemd, |
Patrick Williams | eebcf90 | 2022-09-13 11:20:56 -0500 | [diff] [blame] | 101 | sdbusplus_dep, |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 102 | phosphorlogging, |
| 103 | fmt_dep, |
| 104 | extra_deps |
| 105 | ] |
| 106 | |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 107 | executable('watchdog_timeout', |
| 108 | 'watchdog_timeout.cpp', |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 109 | configure_file(output: 'config.h', configuration: conf_data), |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 110 | generated_sources, |
| 111 | dependencies: deps, |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 112 | link_with: watchdog_lib, |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 113 | include_directories: include_directories('gen'), |
| 114 | implicit_include_directories: true, |
| 115 | install: true |
| 116 | ) |
| 117 | |
| 118 | executable('checkstop_app', |
| 119 | 'checkstop_app.cpp', |
| 120 | generated_sources, |
| 121 | dependencies: deps, |
| 122 | include_directories: include_directories('gen'), |
| 123 | implicit_include_directories: true, |
| 124 | install: true |
| 125 | ) |