blob: ac6ba2977475e02e5a7fd8a3d979f98698b6abf8 [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')+'"',
26 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060027 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053028 )
SunnySrivastava19847ef54422019-12-03 02:47:37 -060029 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
30 'ibm_vpd_type_check.cpp',
31 'parser.cpp',
32 'impl.cpp',
33 'utils.cpp',
34 'keyword_vpd_parser.cpp',
35 'vpdecc/vpdecc.c',
36 'vpdecc/vpdecc_support.c'
37 ]
38
39 ibm_vpd_exe = executable(
40 'ibm-read-vpd',
41 ibm_read_vpd_SOURCES,
42 dependencies: [
43 sdbusplus,
44 phosphor_logging,
45 ],
46 install: true,
47 cpp_args : '-DIPZ_PARSER'
48 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053049
50 vpd_tool_SOURCES = ['vpd_tool.cpp',
51 'vpd_tool_impl.cpp'
52 ]
53
54 vpd_tool_exe = executable(
55 'vpd-tool',
56 vpd_tool_SOURCES,
57 dependencies: [
58 sdbusplus
59 ],
60 install: true,
61 )
SunnySrivastava19847ef54422019-12-03 02:47:37 -060062else
63 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
64 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
65
66 src_dir = meson.source_root()
67 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
68 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
69
70 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
71 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
72
73 writefru_hpp = custom_target('writefru.hpp',
74 command:[python,
75 FRU_GEN_SCRIPT,
76 '-i',
77 get_option('FRU_YAML')
78 ],
79 depend_files :['writefru.mako.hpp',
80 'writefru.py',
81 get_option('FRU_YAML')
82 ],
83 output:'writefru.hpp'
84 )
85
86 extra_properties_gen_hpp = custom_target(
87 'extra-properties-gen.hpp',
88 command:[
89 python,
90 PROP_GEN_SCRIPT,
91 '-e',
92 get_option('PROP_YAML')
93 ],
94 depend_files : ['extra-properties.mako.hpp',
95 'extra-properties.py',
96 get_option('PROP_YAML')
97 ],
98 output:'extra-properties-gen.hpp'
99 )
100
101 openpower_read_vpd_SOURCES = ['app.cpp',
102 'args.cpp',
103 'impl.cpp',
104 'parser.cpp',
105 'write.cpp',
106 'utils.cpp',
107 writefru_hpp,
108 extra_properties_gen_hpp
109 ]
110
111 openpower_read_vpd_exe= executable(
112 'openpower-read-vpd',
113 openpower_read_vpd_SOURCES,
114 dependencies: [
115 sdbusplus,
116 phosphor_logging,
117 ],
118 install: true,
119 )
120endif
121subdir('test')