blob: 35947a25406df0620928688a2c2b23b944be3974 [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 :{
25 'INVENTORY_JSON': '"'+get_option('INVENTORY_JSON')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053026 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050027 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
28 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050029 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
30 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
31 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050032 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
33 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
34 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053035 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
36 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
37 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
38 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060039 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053040 )
SunnySrivastava198443306542020-04-01 02:50:20 -050041
42if get_option('ibm-parser').enabled()
SunnySrivastava19847ef54422019-12-03 02:47:37 -060043 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
44 'ibm_vpd_type_check.cpp',
45 'parser.cpp',
46 'impl.cpp',
47 'utils.cpp',
48 'keyword_vpd_parser.cpp',
49 'vpdecc/vpdecc.c',
50 'vpdecc/vpdecc_support.c'
51 ]
52
53 ibm_vpd_exe = executable(
54 'ibm-read-vpd',
55 ibm_read_vpd_SOURCES,
56 dependencies: [
57 sdbusplus,
58 phosphor_logging,
59 ],
60 install: true,
61 cpp_args : '-DIPZ_PARSER'
62 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053063
64 vpd_tool_SOURCES = ['vpd_tool.cpp',
65 'vpd_tool_impl.cpp'
66 ]
67
68 vpd_tool_exe = executable(
69 'vpd-tool',
70 vpd_tool_SOURCES,
71 dependencies: [
72 sdbusplus
73 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053074 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053075 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050076if get_option('vpd-manager').enabled()
77 subdir('vpd-manager')
78endif
79
SunnySrivastava19847ef54422019-12-03 02:47:37 -060080else
81 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
82 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
83
84 src_dir = meson.source_root()
85 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
86 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
87
88 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
89 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
90
91 writefru_hpp = custom_target('writefru.hpp',
92 command:[python,
93 FRU_GEN_SCRIPT,
94 '-i',
95 get_option('FRU_YAML')
96 ],
97 depend_files :['writefru.mako.hpp',
98 'writefru.py',
99 get_option('FRU_YAML')
100 ],
101 output:'writefru.hpp'
102 )
103
104 extra_properties_gen_hpp = custom_target(
105 'extra-properties-gen.hpp',
106 command:[
107 python,
108 PROP_GEN_SCRIPT,
109 '-e',
110 get_option('PROP_YAML')
111 ],
112 depend_files : ['extra-properties.mako.hpp',
113 'extra-properties.py',
114 get_option('PROP_YAML')
115 ],
116 output:'extra-properties-gen.hpp'
117 )
118
119 openpower_read_vpd_SOURCES = ['app.cpp',
120 'args.cpp',
121 'impl.cpp',
122 'parser.cpp',
123 'write.cpp',
124 'utils.cpp',
125 writefru_hpp,
126 extra_properties_gen_hpp
127 ]
128
129 openpower_read_vpd_exe= executable(
130 'openpower-read-vpd',
131 openpower_read_vpd_SOURCES,
132 dependencies: [
133 sdbusplus,
134 phosphor_logging,
135 ],
136 install: true,
137 )
138endif
139subdir('test')