blob: dcff46e005f9ebc6764508da850aa110aa77a5c5 [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
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050032realpath_prog = find_program('realpath')
33
34selected_subdirs = []
35selected_subdirs += 'org/open_power'
36
37generated_root = meson.current_build_dir() / 'gen'
38generated_others = []
39generated_sources = []
40
41# Source the generated meson files
42subdir('gen')
43foreach d : selected_subdirs
44 subdir('gen' / d)
45endforeach
46
47# Parse through the list from sdbus++-gendir and put into sets.
48generated_headers = []
49generated_cpp = []
50generated_others_files = []
51
52foreach g : generated_sources generated_others
53 foreach f : g.to_list()
54 rel_path = run_command(
55 realpath_prog,
56 '--relative-to', generated_root,
57 f.full_path(),
58 ).stdout().strip().split('\n')[-1]
59
60 if rel_path.endswith('.hpp')
61 generated_headers += rel_path
62 elif rel_path.endswith('.cpp')
63 generated_cpp += rel_path
64 else
65 generated_others_files += rel_path
66 endif
67 endforeach
68endforeach
69
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050070cxx = meson.get_compiler('cpp')
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050071conf_data = configuration_data()
72if get_option('hostboot-dump-collection').enabled()
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050073 conf_data.set('WATCHDOG_DUMP_COLLECTION', true)
74 extra_deps = [
75 cxx.find_library('pdbg'),
76 cxx.find_library('libdt-api'),
77 cxx.find_library('phal')
78 ]
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050079 subdir('watchdog')
80else
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050081 conf_data.set('WATCHDOG_DUMP_COLLECTION', false)
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050082 watchdog_lib = []
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050083 extra_deps = []
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050084endif
85
deepakala-k407e5b62023-04-24 09:15:09 -050086configure_file(output: 'config.h', configuration: conf_data)
87
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050088deps = [
89 systemd,
Patrick Williamseebcf902022-09-13 11:20:56 -050090 sdbusplus_dep,
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050091 phosphorlogging,
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050092 extra_deps
93]
94
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -050095executable('watchdog_timeout',
96 'watchdog_timeout.cpp',
97 generated_sources,
98 dependencies: deps,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050099 link_with: watchdog_lib,
Shantappa Teekappanavar222131c2021-06-02 10:52:56 -0500100 include_directories: include_directories('gen'),
101 implicit_include_directories: true,
102 install: true
103)
104
105executable('checkstop_app',
106 'checkstop_app.cpp',
107 generated_sources,
108 dependencies: deps,
109 include_directories: include_directories('gen'),
110 implicit_include_directories: true,
111 install: true
112)