blob: dac2a21075907637a8d61a45fcd2e2ef95c589cc [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')+'"',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053050 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"',
Alpana Kumarif05effd2021-04-07 07:32:53 -050051 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"',
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -060052 'SYSTEM_JSON' : '"'+get_option('SYSTEM_JSON')+'"',
53 'BAD_VPD_DIR': '"'+get_option('BAD_VPD_DIR')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060054 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053055 )
SunnySrivastava198443306542020-04-01 02:50:20 -050056
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050057common_SOURCES =['common_utility.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053058'vpd-parser/parser_factory.cpp',
59 'vpd-parser/memory_vpd_parser.cpp',
60 'vpd-parser/keyword_vpd_parser.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050061 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053062 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c'
63]
64
SunnySrivastava198443306542020-04-01 02:50:20 -050065if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050066 libgpiodcxx = dependency('libgpiodcxx')
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053067 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp'
68 ]+common_SOURCES
SunnySrivastava19847ef54422019-12-03 02:47:37 -060069
70 ibm_vpd_exe = executable(
71 'ibm-read-vpd',
72 ibm_read_vpd_SOURCES,
73 dependencies: [
74 sdbusplus,
75 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050076 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060077 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050078 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060079 install: true,
80 cpp_args : '-DIPZ_PARSER'
81 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053082
83 vpd_tool_SOURCES = ['vpd_tool.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053084 'vpd_tool_impl.cpp',
85 'vpd-manager/editor_impl.cpp',
86 ]+common_SOURCES
87
88 vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager')
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053089
90 vpd_tool_exe = executable(
91 'vpd-tool',
92 vpd_tool_SOURCES,
93 dependencies: [
94 sdbusplus
95 ],
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053096 install: true,
97 include_directories : vpd_tool_INCLUDE
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053098 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050099if get_option('vpd-manager').enabled()
100 subdir('vpd-manager')
101endif
102
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600103else
104 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
105 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
106
107 src_dir = meson.source_root()
108 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
109 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
110
111 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
112 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
113
114 writefru_hpp = custom_target('writefru.hpp',
115 command:[python,
116 FRU_GEN_SCRIPT,
117 '-i',
118 get_option('FRU_YAML')
119 ],
120 depend_files :['writefru.mako.hpp',
121 'writefru.py',
122 get_option('FRU_YAML')
123 ],
124 output:'writefru.hpp'
125 )
126
127 extra_properties_gen_hpp = custom_target(
128 'extra-properties-gen.hpp',
129 command:[
130 python,
131 PROP_GEN_SCRIPT,
132 '-e',
133 get_option('PROP_YAML')
134 ],
135 depend_files : ['extra-properties.mako.hpp',
136 'extra-properties.py',
137 get_option('PROP_YAML')
138 ],
139 output:'extra-properties-gen.hpp'
140 )
141
142 openpower_read_vpd_SOURCES = ['app.cpp',
143 'args.cpp',
144 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500145 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600146 'write.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -0500147 'common_utility.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600148 writefru_hpp,
149 extra_properties_gen_hpp
150 ]
151
152 openpower_read_vpd_exe= executable(
153 'openpower-read-vpd',
154 openpower_read_vpd_SOURCES,
155 dependencies: [
156 sdbusplus,
157 phosphor_logging,
158 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500159 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600160 install: true,
161 )
162endif
163subdir('test')