blob: 8a272a48e1ffaa58234a7c1b4e650d533421380c [file] [log] [blame]
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05001project(
2 'openpower-debug-collector',
3 'cpp',
Patrick Williams704170c2023-07-12 11:15:14 -05004 meson_version: '>=1.1.1',
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams704170c2023-07-12 11:15:14 -05008 'cpp_std=c++23'
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -05009 ],
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
deepakala-k407e5b62023-04-24 09:15:09 -050099configure_file(output: 'config.h', configuration: conf_data)
100
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -0500101deps = [
102 systemd,
Patrick Williamseebcf902022-09-13 11:20:56 -0500103 sdbusplus_dep,
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -0500104 phosphorlogging,
105 fmt_dep,
106 extra_deps
107]
108
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500109executable('watchdog_timeout',
110 'watchdog_timeout.cpp',
111 generated_sources,
112 dependencies: deps,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -0500113 link_with: watchdog_lib,
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500114 include_directories: include_directories('gen'),
115 implicit_include_directories: true,
116 install: true
117)
118
119executable('checkstop_app',
120 'checkstop_app.cpp',
121 generated_sources,
122 dependencies: deps,
123 include_directories: include_directories('gen'),
124 implicit_include_directories: true,
125 install: true
126)