blob: 4f3415c9795c1ddda3b9fac4d415d17dc8011217 [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 -050047realpath_prog = find_program('realpath')
48
49selected_subdirs = []
50selected_subdirs += 'org/open_power'
51
52generated_root = meson.current_build_dir() / 'gen'
53generated_others = []
54generated_sources = []
55
56# Source the generated meson files
57subdir('gen')
58foreach d : selected_subdirs
59 subdir('gen' / d)
60endforeach
61
62# Parse through the list from sdbus++-gendir and put into sets.
63generated_headers = []
64generated_cpp = []
65generated_others_files = []
66
67foreach 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
83endforeach
84
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050085cxx = meson.get_compiler('cpp')
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050086conf_data = configuration_data()
87if get_option('hostboot-dump-collection').enabled()
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050088 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 Teekappanavar1ac61622021-06-22 19:07:29 -050094 subdir('watchdog')
95else
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050096 conf_data.set('WATCHDOG_DUMP_COLLECTION', false)
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050097 watchdog_lib = []
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050098 extra_deps = []
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050099endif
100
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -0500101deps = [
102 systemd,
103 sdbusplus,
104 phosphorlogging,
105 fmt_dep,
106 extra_deps
107]
108
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500109executable('watchdog_timeout',
110 'watchdog_timeout.cpp',
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500111 configure_file(output: 'config.h', configuration: conf_data),
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500112 generated_sources,
113 dependencies: deps,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500114 link_with: watchdog_lib,
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500115 include_directories: include_directories('gen'),
116 implicit_include_directories: true,
117 install: true
118)
119
120executable('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)