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