blob: 9603762a6aa9e639f2e746f7d985adbadb02834c [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')
22configure_file(output: 'config.h',
23 configuration :{
24 'INVENTORY_JSON': '"'+get_option('INVENTORY_JSON')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053025 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050026 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
27 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050028 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
29 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
30 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050031 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
32 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
33 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
34 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060035 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053036 )
SunnySrivastava198443306542020-04-01 02:50:20 -050037
38if get_option('ibm-parser').enabled()
SunnySrivastava19847ef54422019-12-03 02:47:37 -060039 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
40 'ibm_vpd_type_check.cpp',
41 'parser.cpp',
42 'impl.cpp',
43 'utils.cpp',
44 'keyword_vpd_parser.cpp',
45 'vpdecc/vpdecc.c',
46 'vpdecc/vpdecc_support.c'
47 ]
48
49 ibm_vpd_exe = executable(
50 'ibm-read-vpd',
51 ibm_read_vpd_SOURCES,
52 dependencies: [
53 sdbusplus,
54 phosphor_logging,
55 ],
56 install: true,
57 cpp_args : '-DIPZ_PARSER'
58 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053059
60 vpd_tool_SOURCES = ['vpd_tool.cpp',
61 'vpd_tool_impl.cpp'
62 ]
63
64 vpd_tool_exe = executable(
65 'vpd-tool',
66 vpd_tool_SOURCES,
67 dependencies: [
68 sdbusplus
69 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053070 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053071 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050072if get_option('vpd-manager').enabled()
73 subdir('vpd-manager')
74endif
75
SunnySrivastava19847ef54422019-12-03 02:47:37 -060076else
77 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
78 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
79
80 src_dir = meson.source_root()
81 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
82 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
83
84 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
85 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
86
87 writefru_hpp = custom_target('writefru.hpp',
88 command:[python,
89 FRU_GEN_SCRIPT,
90 '-i',
91 get_option('FRU_YAML')
92 ],
93 depend_files :['writefru.mako.hpp',
94 'writefru.py',
95 get_option('FRU_YAML')
96 ],
97 output:'writefru.hpp'
98 )
99
100 extra_properties_gen_hpp = custom_target(
101 'extra-properties-gen.hpp',
102 command:[
103 python,
104 PROP_GEN_SCRIPT,
105 '-e',
106 get_option('PROP_YAML')
107 ],
108 depend_files : ['extra-properties.mako.hpp',
109 'extra-properties.py',
110 get_option('PROP_YAML')
111 ],
112 output:'extra-properties-gen.hpp'
113 )
114
115 openpower_read_vpd_SOURCES = ['app.cpp',
116 'args.cpp',
117 'impl.cpp',
118 'parser.cpp',
119 'write.cpp',
120 'utils.cpp',
121 writefru_hpp,
122 extra_properties_gen_hpp
123 ]
124
125 openpower_read_vpd_exe= executable(
126 'openpower-read-vpd',
127 openpower_read_vpd_SOURCES,
128 dependencies: [
129 sdbusplus,
130 phosphor_logging,
131 ],
132 install: true,
133 )
134endif
135subdir('test')