blob: d5080b35cdb676e4107bc51f5c246d127248fd92 [file] [log] [blame]
SunnySrivastava19847ef54422019-12-03 02:47:37 -06001project(
2 'openpower-vpd-parser',
3 'c',
4 'cpp',
5 default_options: [
Priyanga Ramasamy9d149342020-07-16 23:41:26 +05306 'warning_level=3',
7 'werror=true',
PriyangaRamasamyf8f9c862021-02-22 22:53:35 -06008 'cpp_std=c++17',
PriyangaRamasamyf272efc2021-03-03 23:24:31 -06009 'buildtype=debugoptimized'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060010 ],
11 version: '1.0'
12)
13
14build_tests = get_option('tests')
15
16sdbusplus = dependency('sdbusplus')
17phosphor_logging = dependency('phosphor-logging')
SunnySrivastava198497f8df02020-05-30 12:05:53 -050018phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060019
20compiler = meson.get_compiler('cpp')
21python = find_program('python3', required:true)
22
SunnySrivastava19847ef54422019-12-03 02:47:37 -060023compiler.has_header('CLI/CLI.hpp')
24compiler.has_header('nlohmann/json.hpp')
Santosh Puranikb665c552020-10-29 14:23:04 +053025add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
PriyangaRamasamyf8f9c862021-02-22 22:53:35 -060026
27# Disable FORTIFY_SOURCE when compiling with no optimization
28if(get_option('optimization') == '0')
29 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
30 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
31endif
32
SunnySrivastava19847ef54422019-12-03 02:47:37 -060033configure_file(output: 'config.h',
34 configuration :{
Santosh Puranik0246a4d2020-11-04 16:57:39 +053035 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',
36 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053037 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050038 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
39 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050040 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
41 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
42 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050043 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
44 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
45 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053046 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
Santosh Puranik0246a4d2020-11-04 16:57:39 +053047 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
48 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
Santosh Puranik4641bff2020-11-30 20:26:44 +053049 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"',
50 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060051 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053052 )
SunnySrivastava198443306542020-04-01 02:50:20 -050053
54if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050055 libgpiodcxx = dependency('libgpiodcxx')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060056 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050057 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060058 'impl.cpp',
59 'utils.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050060 'vpd-parser/keyword_vpd_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060061 'vpdecc/vpdecc.c',
Alpana Kumaria00936f2020-04-14 07:15:46 -050062 'vpdecc/vpdecc_support.c',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050063 'vpd-parser/memory_vpd_parser.cpp',
64 'vpd-parser/parser_factory.cpp'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060065 ]
66
67 ibm_vpd_exe = executable(
68 'ibm-read-vpd',
69 ibm_read_vpd_SOURCES,
70 dependencies: [
71 sdbusplus,
72 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050073 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060074 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050075 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060076 install: true,
77 cpp_args : '-DIPZ_PARSER'
78 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053079
80 vpd_tool_SOURCES = ['vpd_tool.cpp',
81 'vpd_tool_impl.cpp'
82 ]
83
84 vpd_tool_exe = executable(
85 'vpd-tool',
86 vpd_tool_SOURCES,
87 dependencies: [
88 sdbusplus
89 ],
PriyangaRamasamycdf943c2020-03-18 02:25:30 +053090 install: true
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053091 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050092if get_option('vpd-manager').enabled()
93 subdir('vpd-manager')
94endif
95
SunnySrivastava19847ef54422019-12-03 02:47:37 -060096else
97 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
98 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
99
100 src_dir = meson.source_root()
101 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
102 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
103
104 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
105 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
106
107 writefru_hpp = custom_target('writefru.hpp',
108 command:[python,
109 FRU_GEN_SCRIPT,
110 '-i',
111 get_option('FRU_YAML')
112 ],
113 depend_files :['writefru.mako.hpp',
114 'writefru.py',
115 get_option('FRU_YAML')
116 ],
117 output:'writefru.hpp'
118 )
119
120 extra_properties_gen_hpp = custom_target(
121 'extra-properties-gen.hpp',
122 command:[
123 python,
124 PROP_GEN_SCRIPT,
125 '-e',
126 get_option('PROP_YAML')
127 ],
128 depend_files : ['extra-properties.mako.hpp',
129 'extra-properties.py',
130 get_option('PROP_YAML')
131 ],
132 output:'extra-properties-gen.hpp'
133 )
134
135 openpower_read_vpd_SOURCES = ['app.cpp',
136 'args.cpp',
137 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500138 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600139 'write.cpp',
140 'utils.cpp',
141 writefru_hpp,
142 extra_properties_gen_hpp
143 ]
144
145 openpower_read_vpd_exe= executable(
146 'openpower-read-vpd',
147 openpower_read_vpd_SOURCES,
148 dependencies: [
149 sdbusplus,
150 phosphor_logging,
151 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500152 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600153 install: true,
154 )
155endif
156subdir('test')