blob: c2f2806494a8959595a4d71bf2f4af75c4055033 [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
SunnySrivastava19847ef54422019-12-03 02:47:37 -060018sdbusplus = dependency('sdbusplus')
19phosphor_logging = dependency('phosphor-logging')
SunnySrivastava198497f8df02020-05-30 12:05:53 -050020phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
SunnySrivastava19847ef54422019-12-03 02:47:37 -060021
22compiler = meson.get_compiler('cpp')
23python = find_program('python3', required:true)
24
SunnySrivastava19847ef54422019-12-03 02:47:37 -060025compiler.has_header('CLI/CLI.hpp')
26compiler.has_header('nlohmann/json.hpp')
PriyangaRamasamyf8f9c862021-02-22 22:53:35 -060027
28# Disable FORTIFY_SOURCE when compiling with no optimization
29if(get_option('optimization') == '0')
30 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
31 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
32endif
33
SunnySrivastava19847ef54422019-12-03 02:47:37 -060034configure_file(output: 'config.h',
35 configuration :{
Santosh Puranik0246a4d2020-11-04 16:57:39 +053036 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',
37 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"',
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053038 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
SunnySrivastava198443306542020-04-01 02:50:20 -050039 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
40 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
SunnySrivastava1984a7392592020-03-09 10:19:33 -050041 'BUSNAME' : '"' + get_option('BUSNAME') + '"',
42 'OBJPATH' : '"' + get_option('OBJPATH') + '"',
43 'IFACE' : '"' + get_option('IFACE') + '"',
SunnySrivastava198443306542020-04-01 02:50:20 -050044 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
45 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
46 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053047 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
Santosh Puranik0246a4d2020-11-04 16:57:39 +053048 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
49 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
Santosh Puranik4641bff2020-11-30 20:26:44 +053050 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053051 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"',
Alpana Kumarif05effd2021-04-07 07:32:53 -050052 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"',
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -060053 'SYSTEM_JSON' : '"'+get_option('SYSTEM_JSON')+'"',
PriyangaRamasamy8cc5b152021-06-03 13:05:17 -050054 'BAD_VPD_DIR': '"'+get_option('BAD_VPD_DIR')+'"',
55 'FAN_INTERFACE': '"'+get_option('FAN_INTERFACE')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060056 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053057 )
SunnySrivastava198443306542020-04-01 02:50:20 -050058
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050059common_SOURCES =['common_utility.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053060'vpd-parser/parser_factory.cpp',
61 'vpd-parser/memory_vpd_parser.cpp',
62 'vpd-parser/keyword_vpd_parser.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050063 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053064 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c'
65]
66
SunnySrivastava198443306542020-04-01 02:50:20 -050067if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050068 libgpiodcxx = dependency('libgpiodcxx')
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053069 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp'
70 ]+common_SOURCES
SunnySrivastava19847ef54422019-12-03 02:47:37 -060071
72 ibm_vpd_exe = executable(
73 'ibm-read-vpd',
74 ibm_read_vpd_SOURCES,
75 dependencies: [
76 sdbusplus,
77 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050078 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060079 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050080 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060081 install: true,
82 cpp_args : '-DIPZ_PARSER'
83 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053084
85 vpd_tool_SOURCES = ['vpd_tool.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053086 'vpd_tool_impl.cpp',
87 'vpd-manager/editor_impl.cpp',
88 ]+common_SOURCES
89
90 vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager')
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053091
92 vpd_tool_exe = executable(
93 'vpd-tool',
94 vpd_tool_SOURCES,
95 dependencies: [
96 sdbusplus
97 ],
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053098 install: true,
99 include_directories : vpd_tool_INCLUDE
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +0530100 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -0500101if get_option('vpd-manager').enabled()
102 subdir('vpd-manager')
103endif
104
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600105else
106 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
107 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
108
109 src_dir = meson.source_root()
110 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
111 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
112
113 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
114 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
115
116 writefru_hpp = custom_target('writefru.hpp',
117 command:[python,
118 FRU_GEN_SCRIPT,
119 '-i',
120 get_option('FRU_YAML')
121 ],
122 depend_files :['writefru.mako.hpp',
123 'writefru.py',
124 get_option('FRU_YAML')
125 ],
126 output:'writefru.hpp'
127 )
128
129 extra_properties_gen_hpp = custom_target(
130 'extra-properties-gen.hpp',
131 command:[
132 python,
133 PROP_GEN_SCRIPT,
134 '-e',
135 get_option('PROP_YAML')
136 ],
137 depend_files : ['extra-properties.mako.hpp',
138 'extra-properties.py',
139 get_option('PROP_YAML')
140 ],
141 output:'extra-properties-gen.hpp'
142 )
143
144 openpower_read_vpd_SOURCES = ['app.cpp',
145 'args.cpp',
146 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500147 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600148 'write.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -0500149 'common_utility.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600150 writefru_hpp,
151 extra_properties_gen_hpp
152 ]
153
154 openpower_read_vpd_exe= executable(
155 'openpower-read-vpd',
156 openpower_read_vpd_SOURCES,
157 dependencies: [
158 sdbusplus,
159 phosphor_logging,
160 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500161 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600162 install: true,
163 )
164endif
165subdir('test')