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