blob: ede41389c8d4f5b2108fdc337822b381d90ee2bd [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
Andrew Jeffery3aec4782021-06-15 11:45:23 +093016add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
17
Andrew Jeffery60b5bd22021-06-15 10:41:28 +093018phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces',
19 default_options: [ 'data_com_ibm=true', 'data_org_open_power=true' ],
20 fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'])
21
22phosphor_logging = dependency('phosphor-logging',
23 default_options: [ 'openpower-pel-extension=enabled' ],
24 fallback: ['phosphor-logging', 'phosphor_logging_dep'])
25
26sdbusplus = dependency('sdbusplus', fallback: [ 'sdbusplus', 'sdbusplus_dep' ])
SunnySrivastava19847ef54422019-12-03 02:47:37 -060027
28compiler = meson.get_compiler('cpp')
29python = find_program('python3', required:true)
30
SunnySrivastava19847ef54422019-12-03 02:47:37 -060031compiler.has_header('CLI/CLI.hpp')
32compiler.has_header('nlohmann/json.hpp')
PriyangaRamasamyf8f9c862021-02-22 22:53:35 -060033
34# Disable FORTIFY_SOURCE when compiling with no optimization
35if(get_option('optimization') == '0')
36 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
37 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
38endif
39
SunnySrivastava19847ef54422019-12-03 02:47:37 -060040configure_file(output: 'config.h',
41 configuration :{
Santosh Puranik0246a4d2020-11-04 16:57:39 +053042 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',
43 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053044 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050045 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
46 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050047 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
48 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
49 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050050 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
51 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
52 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053053 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
Santosh Puranik0246a4d2020-11-04 16:57:39 +053054 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
55 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
Santosh Puranik4641bff2020-11-30 20:26:44 +053056 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053057 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"',
Alpana Kumarif05effd2021-04-07 07:32:53 -050058 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"',
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -060059 'SYSTEM_JSON' : '"'+get_option('SYSTEM_JSON')+'"',
PriyangaRamasamy8cc5b152021-06-03 13:05:17 -050060 'BAD_VPD_DIR': '"'+get_option('BAD_VPD_DIR')+'"',
61 'FAN_INTERFACE': '"'+get_option('FAN_INTERFACE')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060062 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053063 )
SunnySrivastava198443306542020-04-01 02:50:20 -050064
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050065common_SOURCES =['common_utility.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053066'vpd-parser/parser_factory.cpp',
67 'vpd-parser/memory_vpd_parser.cpp',
68 'vpd-parser/keyword_vpd_parser.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050069 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053070 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c'
71]
72
SunnySrivastava198443306542020-04-01 02:50:20 -050073if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050074 libgpiodcxx = dependency('libgpiodcxx')
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053075 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp'
76 ]+common_SOURCES
SunnySrivastava19847ef54422019-12-03 02:47:37 -060077
78 ibm_vpd_exe = executable(
79 'ibm-read-vpd',
80 ibm_read_vpd_SOURCES,
81 dependencies: [
82 sdbusplus,
83 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050084 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060085 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050086 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060087 install: true,
88 cpp_args : '-DIPZ_PARSER'
89 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053090
91 vpd_tool_SOURCES = ['vpd_tool.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053092 'vpd_tool_impl.cpp',
93 'vpd-manager/editor_impl.cpp',
94 ]+common_SOURCES
95
96 vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager')
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053097
98 vpd_tool_exe = executable(
99 'vpd-tool',
100 vpd_tool_SOURCES,
101 dependencies: [
102 sdbusplus
103 ],
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +0530104 install: true,
105 include_directories : vpd_tool_INCLUDE
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +0530106 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -0500107if get_option('vpd-manager').enabled()
108 subdir('vpd-manager')
109endif
110
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600111else
112 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
113 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
114
115 src_dir = meson.source_root()
116 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
117 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
118
119 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
120 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
121
122 writefru_hpp = custom_target('writefru.hpp',
123 command:[python,
124 FRU_GEN_SCRIPT,
125 '-i',
126 get_option('FRU_YAML')
127 ],
128 depend_files :['writefru.mako.hpp',
129 'writefru.py',
130 get_option('FRU_YAML')
131 ],
132 output:'writefru.hpp'
133 )
134
135 extra_properties_gen_hpp = custom_target(
136 'extra-properties-gen.hpp',
137 command:[
138 python,
139 PROP_GEN_SCRIPT,
140 '-e',
141 get_option('PROP_YAML')
142 ],
143 depend_files : ['extra-properties.mako.hpp',
144 'extra-properties.py',
145 get_option('PROP_YAML')
146 ],
147 output:'extra-properties-gen.hpp'
148 )
149
150 openpower_read_vpd_SOURCES = ['app.cpp',
151 'args.cpp',
152 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500153 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600154 'write.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -0500155 'common_utility.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600156 writefru_hpp,
157 extra_properties_gen_hpp
158 ]
159
160 openpower_read_vpd_exe= executable(
161 'openpower-read-vpd',
162 openpower_read_vpd_SOURCES,
163 dependencies: [
164 sdbusplus,
165 phosphor_logging,
166 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500167 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600168 install: true,
169 )
170endif
171subdir('test')