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 | deps = [ |
Dhruvaraj Subhashchandran | 4bb6d32 | 2021-07-26 22:56:50 -0500 | [diff] [blame] | 48 | systemd, sdbusplus, phosphorlogging, fmt_dep |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 49 | ] |
| 50 | |
| 51 | realpath_prog = find_program('realpath') |
| 52 | |
| 53 | selected_subdirs = [] |
| 54 | selected_subdirs += 'org/open_power' |
| 55 | |
| 56 | generated_root = meson.current_build_dir() / 'gen' |
| 57 | generated_others = [] |
| 58 | generated_sources = [] |
| 59 | |
| 60 | # Source the generated meson files |
| 61 | subdir('gen') |
| 62 | foreach d : selected_subdirs |
| 63 | subdir('gen' / d) |
| 64 | endforeach |
| 65 | |
| 66 | # Parse through the list from sdbus++-gendir and put into sets. |
| 67 | generated_headers = [] |
| 68 | generated_cpp = [] |
| 69 | generated_others_files = [] |
| 70 | |
| 71 | foreach g : generated_sources generated_others |
| 72 | foreach f : g.to_list() |
| 73 | rel_path = run_command( |
| 74 | realpath_prog, |
| 75 | '--relative-to', generated_root, |
| 76 | f.full_path(), |
| 77 | ).stdout().strip().split('\n')[-1] |
| 78 | |
| 79 | if rel_path.endswith('.hpp') |
| 80 | generated_headers += rel_path |
| 81 | elif rel_path.endswith('.cpp') |
| 82 | generated_cpp += rel_path |
| 83 | else |
| 84 | generated_others_files += rel_path |
| 85 | endif |
| 86 | endforeach |
| 87 | endforeach |
| 88 | |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 89 | conf_data = configuration_data() |
| 90 | if get_option('hostboot-dump-collection').enabled() |
| 91 | conf_data.set('HOSTBOOT_DUMP_COLLECTION', true) |
| 92 | subdir('watchdog') |
| 93 | else |
| 94 | conf_data.set('HOSTBOOT_DUMP_COLLECTION', false) |
| 95 | watchdog_lib = [] |
| 96 | endif |
| 97 | |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 98 | executable('watchdog_timeout', |
| 99 | 'watchdog_timeout.cpp', |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 100 | configure_file(output: 'config.h', configuration: conf_data), |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 101 | generated_sources, |
| 102 | dependencies: deps, |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 103 | link_with: watchdog_lib, |
Shantappa Teekappanavar | 222131c | 2021-06-02 10:52:56 -0500 | [diff] [blame] | 104 | include_directories: include_directories('gen'), |
| 105 | implicit_include_directories: true, |
| 106 | install: true |
| 107 | ) |
| 108 | |
| 109 | executable('checkstop_app', |
| 110 | 'checkstop_app.cpp', |
| 111 | generated_sources, |
| 112 | dependencies: deps, |
| 113 | include_directories: include_directories('gen'), |
| 114 | implicit_include_directories: true, |
| 115 | install: true |
| 116 | ) |