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