blob: b03d995dfaa677c62d897a15a53ed942758bd7db [file] [log] [blame]
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05001project(
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
14systemd = dependency('systemd', required : true)
15
16sdbusplus = dependency(
17 'sdbusplus',
18 fallback: [
19 'sdbusplus',
20 'sdbusplus_dep'
21 ]
22)
23sdbusplusplus_prog = find_program('sdbus++', required : true)
24sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', required : true)
25
26phosphorlogging = dependency(
27 'phosphor-logging',
28 fallback: [
29 'phosphor-logging',
30 'phosphor_logging_dep'
31 ]
32)
33
Dhruvaraj Subhashchandran4bb6d322021-07-26 22:56:50 -050034fmt_dep = dependency('fmt', required: false)
35if 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')
45endif
46
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050047deps = [
Dhruvaraj Subhashchandran4bb6d322021-07-26 22:56:50 -050048 systemd, sdbusplus, phosphorlogging, fmt_dep
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050049]
50
51realpath_prog = find_program('realpath')
52
53selected_subdirs = []
54selected_subdirs += 'org/open_power'
55
56generated_root = meson.current_build_dir() / 'gen'
57generated_others = []
58generated_sources = []
59
60# Source the generated meson files
61subdir('gen')
62foreach d : selected_subdirs
63 subdir('gen' / d)
64endforeach
65
66# Parse through the list from sdbus++-gendir and put into sets.
67generated_headers = []
68generated_cpp = []
69generated_others_files = []
70
71foreach 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
87endforeach
88
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050089conf_data = configuration_data()
90if get_option('hostboot-dump-collection').enabled()
91 conf_data.set('HOSTBOOT_DUMP_COLLECTION', true)
92 subdir('watchdog')
93else
94 conf_data.set('HOSTBOOT_DUMP_COLLECTION', false)
95 watchdog_lib = []
96endif
97
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050098executable('watchdog_timeout',
99 'watchdog_timeout.cpp',
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500100 configure_file(output: 'config.h', configuration: conf_data),
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500101 generated_sources,
102 dependencies: deps,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500103 link_with: watchdog_lib,
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500104 include_directories: include_directories('gen'),
105 implicit_include_directories: true,
106 install: true
107)
108
109executable('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)