blob: 2f0ec244f666a94f9c77d8b8222bbfa15693249c [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
19if get_option('ibm-parser').enabled()
20compiler.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')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050026 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
PriyangaRamasamy02d4d4e2020-02-24 14:54:45 +053027 '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') + '"',
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053031 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
32 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
PriyangaRamasamy0407b172020-03-31 13:57:18 +053033 '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 )
SunnySrivastava19847ef54422019-12-03 02:47:37 -060037 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
38 'ibm_vpd_type_check.cpp',
39 'parser.cpp',
40 'impl.cpp',
41 'utils.cpp',
42 'keyword_vpd_parser.cpp',
43 'vpdecc/vpdecc.c',
44 'vpdecc/vpdecc_support.c'
45 ]
46
47 ibm_vpd_exe = executable(
48 'ibm-read-vpd',
49 ibm_read_vpd_SOURCES,
50 dependencies: [
51 sdbusplus,
52 phosphor_logging,
53 ],
54 install: true,
55 cpp_args : '-DIPZ_PARSER'
56 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053057
58 vpd_tool_SOURCES = ['vpd_tool.cpp',
59 'vpd_tool_impl.cpp'
60 ]
61
62 vpd_tool_exe = executable(
63 'vpd-tool',
64 vpd_tool_SOURCES,
65 dependencies: [
66 sdbusplus
67 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053068 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053069 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050070if get_option('vpd-manager').enabled()
71 subdir('vpd-manager')
72endif
73
SunnySrivastava19847ef54422019-12-03 02:47:37 -060074else
75 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
76 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
77
78 src_dir = meson.source_root()
79 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
80 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
81
82 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
83 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
84
85 writefru_hpp = custom_target('writefru.hpp',
86 command:[python,
87 FRU_GEN_SCRIPT,
88 '-i',
89 get_option('FRU_YAML')
90 ],
91 depend_files :['writefru.mako.hpp',
92 'writefru.py',
93 get_option('FRU_YAML')
94 ],
95 output:'writefru.hpp'
96 )
97
98 extra_properties_gen_hpp = custom_target(
99 'extra-properties-gen.hpp',
100 command:[
101 python,
102 PROP_GEN_SCRIPT,
103 '-e',
104 get_option('PROP_YAML')
105 ],
106 depend_files : ['extra-properties.mako.hpp',
107 'extra-properties.py',
108 get_option('PROP_YAML')
109 ],
110 output:'extra-properties-gen.hpp'
111 )
112
113 openpower_read_vpd_SOURCES = ['app.cpp',
114 'args.cpp',
115 'impl.cpp',
116 'parser.cpp',
117 'write.cpp',
118 'utils.cpp',
119 writefru_hpp,
120 extra_properties_gen_hpp
121 ]
122
123 openpower_read_vpd_exe= executable(
124 'openpower-read-vpd',
125 openpower_read_vpd_SOURCES,
126 dependencies: [
127 sdbusplus,
128 phosphor_logging,
129 ],
130 install: true,
131 )
132endif
133subdir('test')