blob: 32775adda4d3def945cbd5222109fbfa216bd3c9 [file] [log] [blame]
SunnySrivastava19847ef54422019-12-03 02:47:37 -06001project(
2 'openpower-vpd-parser',
3 'c',
4 'cpp',
5 default_options: [
Priyanga Ramasamy9d149342020-07-16 23:41:26 +05306 'warning_level=3',
7 'werror=true',
8 'cpp_std=c++17'
SunnySrivastava19847ef54422019-12-03 02:47:37 -06009 ],
10 version: '1.0'
11)
12
13build_tests = get_option('tests')
14
15sdbusplus = dependency('sdbusplus')
16phosphor_logging = dependency('phosphor-logging')
SunnySrivastava198497f8df02020-05-30 12:05:53 -050017phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060018
19compiler = meson.get_compiler('cpp')
20python = find_program('python3', required:true)
21
SunnySrivastava19847ef54422019-12-03 02:47:37 -060022compiler.has_header('CLI/CLI.hpp')
23compiler.has_header('nlohmann/json.hpp')
Santosh Puranikb665c552020-10-29 14:23:04 +053024add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
SunnySrivastava19847ef54422019-12-03 02:47:37 -060025configure_file(output: 'config.h',
26 configuration :{
Santosh Puranik0246a4d2020-11-04 16:57:39 +053027 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',
28 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053029 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050030 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
31 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050032 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
33 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
34 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050035 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
36 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
37 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053038 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
Santosh Puranik0246a4d2020-11-04 16:57:39 +053039 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
40 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
Santosh Puranik4641bff2020-11-30 20:26:44 +053041 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"',
42 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060043 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053044 )
SunnySrivastava198443306542020-04-01 02:50:20 -050045
46if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050047 libgpiodcxx = dependency('libgpiodcxx')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060048 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050049 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060050 'impl.cpp',
51 'utils.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050052 'vpd-parser/keyword_vpd_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060053 'vpdecc/vpdecc.c',
Alpana Kumaria00936f2020-04-14 07:15:46 -050054 'vpdecc/vpdecc_support.c',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050055 'vpd-parser/memory_vpd_parser.cpp',
56 'vpd-parser/parser_factory.cpp'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060057 ]
58
59 ibm_vpd_exe = executable(
60 'ibm-read-vpd',
61 ibm_read_vpd_SOURCES,
62 dependencies: [
63 sdbusplus,
64 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050065 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060066 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050067 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060068 install: true,
69 cpp_args : '-DIPZ_PARSER'
70 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053071
72 vpd_tool_SOURCES = ['vpd_tool.cpp',
73 'vpd_tool_impl.cpp'
74 ]
75
76 vpd_tool_exe = executable(
77 'vpd-tool',
78 vpd_tool_SOURCES,
79 dependencies: [
80 sdbusplus
81 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053082 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053083 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050084if get_option('vpd-manager').enabled()
85 subdir('vpd-manager')
86endif
87
SunnySrivastava19847ef54422019-12-03 02:47:37 -060088else
89 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
90 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
91
92 src_dir = meson.source_root()
93 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
94 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
95
96 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
97 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
98
99 writefru_hpp = custom_target('writefru.hpp',
100 command:[python,
101 FRU_GEN_SCRIPT,
102 '-i',
103 get_option('FRU_YAML')
104 ],
105 depend_files :['writefru.mako.hpp',
106 'writefru.py',
107 get_option('FRU_YAML')
108 ],
109 output:'writefru.hpp'
110 )
111
112 extra_properties_gen_hpp = custom_target(
113 'extra-properties-gen.hpp',
114 command:[
115 python,
116 PROP_GEN_SCRIPT,
117 '-e',
118 get_option('PROP_YAML')
119 ],
120 depend_files : ['extra-properties.mako.hpp',
121 'extra-properties.py',
122 get_option('PROP_YAML')
123 ],
124 output:'extra-properties-gen.hpp'
125 )
126
127 openpower_read_vpd_SOURCES = ['app.cpp',
128 'args.cpp',
129 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500130 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600131 'write.cpp',
132 'utils.cpp',
133 writefru_hpp,
134 extra_properties_gen_hpp
135 ]
136
137 openpower_read_vpd_exe= executable(
138 'openpower-read-vpd',
139 openpower_read_vpd_SOURCES,
140 dependencies: [
141 sdbusplus,
142 phosphor_logging,
143 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500144 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600145 install: true,
146 )
147endif
148subdir('test')