blob: e72ab81b12c17464b0c3612434b17c5d7e1e5ae5 [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')
15
16compiler = meson.get_compiler('cpp')
17python = find_program('python3', required:true)
18
SunnySrivastava19847ef54422019-12-03 02:47:37 -060019compiler.has_header('CLI/CLI.hpp')
20compiler.has_header('nlohmann/json.hpp')
21configure_file(output: 'config.h',
22 configuration :{
23 'INVENTORY_JSON': '"'+get_option('INVENTORY_JSON')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053024 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050025 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
26 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050027 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
28 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
29 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050030 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
31 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
32 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
33 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060034 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053035 )
SunnySrivastava198443306542020-04-01 02:50:20 -050036
37if get_option('ibm-parser').enabled()
SunnySrivastava19847ef54422019-12-03 02:47:37 -060038 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
39 'ibm_vpd_type_check.cpp',
40 'parser.cpp',
41 'impl.cpp',
42 'utils.cpp',
43 'keyword_vpd_parser.cpp',
44 'vpdecc/vpdecc.c',
45 'vpdecc/vpdecc_support.c'
46 ]
47
48 ibm_vpd_exe = executable(
49 'ibm-read-vpd',
50 ibm_read_vpd_SOURCES,
51 dependencies: [
52 sdbusplus,
53 phosphor_logging,
54 ],
55 install: true,
56 cpp_args : '-DIPZ_PARSER'
57 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053058
59 vpd_tool_SOURCES = ['vpd_tool.cpp',
60 'vpd_tool_impl.cpp'
61 ]
62
63 vpd_tool_exe = executable(
64 'vpd-tool',
65 vpd_tool_SOURCES,
66 dependencies: [
67 sdbusplus
68 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053069 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053070 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050071if get_option('vpd-manager').enabled()
72 subdir('vpd-manager')
73endif
74
SunnySrivastava19847ef54422019-12-03 02:47:37 -060075else
76 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
77 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
78
79 src_dir = meson.source_root()
80 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
81 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
82
83 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
84 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
85
86 writefru_hpp = custom_target('writefru.hpp',
87 command:[python,
88 FRU_GEN_SCRIPT,
89 '-i',
90 get_option('FRU_YAML')
91 ],
92 depend_files :['writefru.mako.hpp',
93 'writefru.py',
94 get_option('FRU_YAML')
95 ],
96 output:'writefru.hpp'
97 )
98
99 extra_properties_gen_hpp = custom_target(
100 'extra-properties-gen.hpp',
101 command:[
102 python,
103 PROP_GEN_SCRIPT,
104 '-e',
105 get_option('PROP_YAML')
106 ],
107 depend_files : ['extra-properties.mako.hpp',
108 'extra-properties.py',
109 get_option('PROP_YAML')
110 ],
111 output:'extra-properties-gen.hpp'
112 )
113
114 openpower_read_vpd_SOURCES = ['app.cpp',
115 'args.cpp',
116 'impl.cpp',
117 'parser.cpp',
118 'write.cpp',
119 'utils.cpp',
120 writefru_hpp,
121 extra_properties_gen_hpp
122 ]
123
124 openpower_read_vpd_exe= executable(
125 'openpower-read-vpd',
126 openpower_read_vpd_SOURCES,
127 dependencies: [
128 sdbusplus,
129 phosphor_logging,
130 ],
131 install: true,
132 )
133endif
134subdir('test')