blob: 261191b5cbb705fea36bebd77f9c47ba1d96d1b0 [file] [log] [blame]
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05001project(
2 'openpower-debug-collector',
3 'cpp',
Patrick Williams1485d7c2023-04-12 08:10:13 -05004 meson_version: '>= 0.58.0',
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05005 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
Patrick Williamseebcf902022-09-13 11:20:56 -050016sdbusplus_dep = dependency('sdbusplus')
17sdbusplusplus_prog = find_program('sdbus++')
18sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
19sdbusplusplus_depfiles = files()
20if sdbusplus_dep.type_name() == 'internal'
21 sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
22endif
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050023
24phosphorlogging = dependency(
25 'phosphor-logging',
26 fallback: [
27 'phosphor-logging',
28 'phosphor_logging_dep'
29 ]
30)
31
Dhruvaraj Subhashchandran4bb6d322021-07-26 22:56:50 -050032fmt_dep = dependency('fmt', required: false)
33if 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')
43endif
44
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050045realpath_prog = find_program('realpath')
46
47selected_subdirs = []
48selected_subdirs += 'org/open_power'
49
50generated_root = meson.current_build_dir() / 'gen'
51generated_others = []
52generated_sources = []
53
54# Source the generated meson files
55subdir('gen')
56foreach d : selected_subdirs
57 subdir('gen' / d)
58endforeach
59
60# Parse through the list from sdbus++-gendir and put into sets.
61generated_headers = []
62generated_cpp = []
63generated_others_files = []
64
65foreach 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
81endforeach
82
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050083cxx = meson.get_compiler('cpp')
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050084conf_data = configuration_data()
85if get_option('hostboot-dump-collection').enabled()
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050086 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 Teekappanavar1ac61622021-06-22 19:07:29 -050092 subdir('watchdog')
93else
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050094 conf_data.set('WATCHDOG_DUMP_COLLECTION', false)
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050095 watchdog_lib = []
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050096 extra_deps = []
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050097endif
98
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050099deps = [
100 systemd,
Patrick Williamseebcf902022-09-13 11:20:56 -0500101 sdbusplus_dep,
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -0500102 phosphorlogging,
103 fmt_dep,
104 extra_deps
105]
106
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500107executable('watchdog_timeout',
108 'watchdog_timeout.cpp',
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500109 configure_file(output: 'config.h', configuration: conf_data),
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500110 generated_sources,
111 dependencies: deps,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500112 link_with: watchdog_lib,
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500113 include_directories: include_directories('gen'),
114 implicit_include_directories: true,
115 install: true
116)
117
118executable('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)