blob: e05edc35383fdef207f3de9e9468089cded3fd9d [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')+'"',
51 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"'
SunnySrivastava19847ef54422019-12-03 02:47:37 -060052 }
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053053 )
SunnySrivastava198443306542020-04-01 02:50:20 -050054
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050055common_SOURCES =['common_utility.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053056'vpd-parser/parser_factory.cpp',
57 'vpd-parser/memory_vpd_parser.cpp',
58 'vpd-parser/keyword_vpd_parser.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -050059 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053060 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c'
61]
62
SunnySrivastava198443306542020-04-01 02:50:20 -050063if get_option('ibm-parser').enabled()
Alpana Kumari2f793042020-08-18 05:51:03 -050064 libgpiodcxx = dependency('libgpiodcxx')
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053065 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp'
66 ]+common_SOURCES
SunnySrivastava19847ef54422019-12-03 02:47:37 -060067
68 ibm_vpd_exe = executable(
69 'ibm-read-vpd',
70 ibm_read_vpd_SOURCES,
71 dependencies: [
72 sdbusplus,
73 phosphor_logging,
Alpana Kumari2f793042020-08-18 05:51:03 -050074 libgpiodcxx,
SunnySrivastava19847ef54422019-12-03 02:47:37 -060075 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050076 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -060077 install: true,
78 cpp_args : '-DIPZ_PARSER'
79 )
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053080
81 vpd_tool_SOURCES = ['vpd_tool.cpp',
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053082 'vpd_tool_impl.cpp',
83 'vpd-manager/editor_impl.cpp',
84 ]+common_SOURCES
85
86 vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager')
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053087
88 vpd_tool_exe = executable(
89 'vpd-tool',
90 vpd_tool_SOURCES,
91 dependencies: [
92 sdbusplus
93 ],
PriyangaRamasamyc0a534f2020-08-24 21:29:18 +053094 install: true,
95 include_directories : vpd_tool_INCLUDE
PriyangaRamasamy1f0b1e62020-02-20 20:48:25 +053096 )
SunnySrivastava1984a7392592020-03-09 10:19:33 -050097if get_option('vpd-manager').enabled()
98 subdir('vpd-manager')
99endif
100
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600101else
102 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
103 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
104
105 src_dir = meson.source_root()
106 FRU_GEN_SCRIPT = src_dir + '/writefru.py'
107 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
108
109 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
110 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
111
112 writefru_hpp = custom_target('writefru.hpp',
113 command:[python,
114 FRU_GEN_SCRIPT,
115 '-i',
116 get_option('FRU_YAML')
117 ],
118 depend_files :['writefru.mako.hpp',
119 'writefru.py',
120 get_option('FRU_YAML')
121 ],
122 output:'writefru.hpp'
123 )
124
125 extra_properties_gen_hpp = custom_target(
126 'extra-properties-gen.hpp',
127 command:[
128 python,
129 PROP_GEN_SCRIPT,
130 '-e',
131 get_option('PROP_YAML')
132 ],
133 depend_files : ['extra-properties.mako.hpp',
134 'extra-properties.py',
135 get_option('PROP_YAML')
136 ],
137 output:'extra-properties-gen.hpp'
138 )
139
140 openpower_read_vpd_SOURCES = ['app.cpp',
141 'args.cpp',
142 'impl.cpp',
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500143 'vpd-parser/ipz_parser.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600144 'write.cpp',
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -0500145 'common_utility.cpp',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600146 writefru_hpp,
147 extra_properties_gen_hpp
148 ]
149
150 openpower_read_vpd_exe= executable(
151 'openpower-read-vpd',
152 openpower_read_vpd_SOURCES,
153 dependencies: [
154 sdbusplus,
155 phosphor_logging,
156 ],
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500157 include_directories : 'vpd-parser/',
SunnySrivastava19847ef54422019-12-03 02:47:37 -0600158 install: true,
159 )
160endif
161subdir('test')