blob: 7cb1e69ce3fd34f4da319d96cff04920e4fd0384 [file] [log] [blame]
SunnySrivastava19847ef54422019-12-03 02:47:37 -06001project(
2 'openpower-vpd-parser',
3 'c',
4 'cpp',
5 default_options: [
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +05306 'cpp_std=c++17'
SunnySrivastava19847ef54422019-12-03 02:47:37 -06007 ],
8 version: '1.0'
9)
10
11build_tests = get_option('tests')
12
13sdbusplus = dependency('sdbusplus')
14phosphor_logging = dependency('phosphor-logging')
SunnySrivastava198497f8df02020-05-30 12:05:53 -050015phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060016
17compiler = meson.get_compiler('cpp')
18python = find_program('python3', required:true)
19
SunnySrivastava19847ef54422019-12-03 02:47:37 -060020compiler.has_header('CLI/CLI.hpp')
21compiler.has_header('nlohmann/json.hpp')
Santosh Puranikb665c552020-10-29 14:23:04 +053022add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
SunnySrivastava19847ef54422019-12-03 02:47:37 -060023configure_file(output: 'config.h',
24 configuration :{
Santosh Puranik0246a4d2020-11-04 16:57:39 +053025 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',
26 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053027 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050028 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
29 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050030 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
31 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
32 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050033 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
34 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
35 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053036 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
Santosh Puranik0246a4d2020-11-04 16:57:39 +053037 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
38 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
39 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060040 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053041 )
SunnySrivastava198443306542020-04-01 02:50:20 -050042
43if get_option('ibm-parser').enabled()
SunnySrivastava19847ef54422019-12-03 02:47:37 -060044 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050045 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060046 'impl.cpp',
47 'utils.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050048 'vpd-parser/keyword_vpd_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060049 'vpdecc/vpdecc.c',
Alpana Kumaria00936f2020-04-14 07:15:46 -050050 'vpdecc/vpdecc_support.c',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050051 'vpd-parser/memory_vpd_parser.cpp',
52 'vpd-parser/parser_factory.cpp'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060053 ]
54
55 ibm_vpd_exe = executable(
56 'ibm-read-vpd',
57 ibm_read_vpd_SOURCES,
58 dependencies: [
59 sdbusplus,
60 phosphor_logging,
61 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050062 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060063 install: true,
64 cpp_args : '-DIPZ_PARSER'
65 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053066
67 vpd_tool_SOURCES = ['vpd_tool.cpp',
68 'vpd_tool_impl.cpp'
69 ]
70
71 vpd_tool_exe = executable(
72 'vpd-tool',
73 vpd_tool_SOURCES,
74 dependencies: [
75 sdbusplus
76 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053077 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053078 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050079if get_option('vpd-manager').enabled()
80 subdir('vpd-manager')
81endif
82
SunnySrivastava19847ef54422019-12-03 02:47:37 -060083else
84 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
85 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
86
87 src_dir = meson.source_root()
88 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
89 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
90
91 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
92 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
93
94 writefru_hpp = custom_target('writefru.hpp',
95 command:[python,
96 FRU_GEN_SCRIPT,
97 '-i',
98 get_option('FRU_YAML')
99 ],
100 depend_files :['writefru.mako.hpp',
101 'writefru.py',
102 get_option('FRU_YAML')
103 ],
104 output:'writefru.hpp'
105 )
106
107 extra_properties_gen_hpp = custom_target(
108 'extra-properties-gen.hpp',
109 command:[
110 python,
111 PROP_GEN_SCRIPT,
112 '-e',
113 get_option('PROP_YAML')
114 ],
115 depend_files : ['extra-properties.mako.hpp',
116 'extra-properties.py',
117 get_option('PROP_YAML')
118 ],
119 output:'extra-properties-gen.hpp'
120 )
121
122 openpower_read_vpd_SOURCES = ['app.cpp',
123 'args.cpp',
124 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500125 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600126 'write.cpp',
127 'utils.cpp',
128 writefru_hpp,
129 extra_properties_gen_hpp
130 ]
131
132 openpower_read_vpd_exe= executable(
133 'openpower-read-vpd',
134 openpower_read_vpd_SOURCES,
135 dependencies: [
136 sdbusplus,
137 phosphor_logging,
138 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500139 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600140 install: true,
141 )
142endif
143subdir('test')