SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-vpd-parser', |
| 3 | 'c', |
| 4 | 'cpp', |
| 5 | default_options: [ |
Priyanga Ramasamy | 9d14934 | 2020-07-16 23:41:26 +0530 | [diff] [blame^] | 6 | 'warning_level=3', |
| 7 | 'werror=true', |
| 8 | 'cpp_std=c++17' |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 9 | ], |
| 10 | version: '1.0' |
| 11 | ) |
| 12 | |
| 13 | build_tests = get_option('tests') |
| 14 | |
| 15 | sdbusplus = dependency('sdbusplus') |
| 16 | phosphor_logging = dependency('phosphor-logging') |
SunnySrivastava1984 | 97f8df0 | 2020-05-30 12:05:53 -0500 | [diff] [blame] | 17 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 18 | |
| 19 | compiler = meson.get_compiler('cpp') |
| 20 | python = find_program('python3', required:true) |
| 21 | |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 22 | compiler.has_header('CLI/CLI.hpp') |
| 23 | compiler.has_header('nlohmann/json.hpp') |
Santosh Puranik | b665c55 | 2020-10-29 14:23:04 +0530 | [diff] [blame] | 24 | add_global_arguments('-Wno-psabi', language : ['c', 'cpp']) |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 25 | configure_file(output: 'config.h', |
| 26 | configuration :{ |
Santosh Puranik | 0246a4d | 2020-11-04 16:57:39 +0530 | [diff] [blame] | 27 | 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"', |
| 28 | 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"', |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 29 | 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"', |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 30 | 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"', |
| 31 | 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"', |
SunnySrivastava1984 | a739259 | 2020-03-09 10:19:33 -0500 | [diff] [blame] | 32 | 'BUSNAME' : '"' + get_option('BUSNAME') + '"', |
| 33 | 'OBJPATH' : '"' + get_option('OBJPATH') + '"', |
| 34 | 'IFACE' : '"' + get_option('IFACE') + '"', |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 35 | 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"', |
| 36 | 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"', |
| 37 | 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"', |
PriyangaRamasamy | 83a1d5d | 2020-04-30 19:15:43 +0530 | [diff] [blame] | 38 | 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"', |
Santosh Puranik | 0246a4d | 2020-11-04 16:57:39 +0530 | [diff] [blame] | 39 | 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"', |
| 40 | 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"', |
| 41 | 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"' |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 42 | } |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 43 | ) |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 44 | |
| 45 | if get_option('ibm-parser').enabled() |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 46 | ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp', |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 47 | 'vpd-parser/ipz_parser.cpp', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 48 | 'impl.cpp', |
| 49 | 'utils.cpp', |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 50 | 'vpd-parser/keyword_vpd_parser.cpp', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 51 | 'vpdecc/vpdecc.c', |
Alpana Kumari | a00936f | 2020-04-14 07:15:46 -0500 | [diff] [blame] | 52 | 'vpdecc/vpdecc_support.c', |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 53 | 'vpd-parser/memory_vpd_parser.cpp', |
| 54 | 'vpd-parser/parser_factory.cpp' |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 55 | ] |
| 56 | |
| 57 | ibm_vpd_exe = executable( |
| 58 | 'ibm-read-vpd', |
| 59 | ibm_read_vpd_SOURCES, |
| 60 | dependencies: [ |
| 61 | sdbusplus, |
| 62 | phosphor_logging, |
| 63 | ], |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 64 | include_directories : 'vpd-parser/', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 65 | install: true, |
| 66 | cpp_args : '-DIPZ_PARSER' |
| 67 | ) |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 68 | |
| 69 | vpd_tool_SOURCES = ['vpd_tool.cpp', |
| 70 | 'vpd_tool_impl.cpp' |
| 71 | ] |
| 72 | |
| 73 | vpd_tool_exe = executable( |
| 74 | 'vpd-tool', |
| 75 | vpd_tool_SOURCES, |
| 76 | dependencies: [ |
| 77 | sdbusplus |
| 78 | ], |
PriyangaRamasamy | cdf943c | 2020-03-18 02:25:30 +0530 | [diff] [blame] | 79 | install: true |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 80 | ) |
SunnySrivastava1984 | a739259 | 2020-03-09 10:19:33 -0500 | [diff] [blame] | 81 | if get_option('vpd-manager').enabled() |
| 82 | subdir('vpd-manager') |
| 83 | endif |
| 84 | |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 85 | else |
| 86 | FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML') |
| 87 | PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML') |
| 88 | |
| 89 | src_dir = meson.source_root() |
| 90 | FRU_GEN_SCRIPT = src_dir + '/writefru.py' |
| 91 | FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml' |
| 92 | |
| 93 | PROP_GEN_SCRIPT = src_dir + '/extra-properties.py' |
| 94 | PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml' |
| 95 | |
| 96 | writefru_hpp = custom_target('writefru.hpp', |
| 97 | command:[python, |
| 98 | FRU_GEN_SCRIPT, |
| 99 | '-i', |
| 100 | get_option('FRU_YAML') |
| 101 | ], |
| 102 | depend_files :['writefru.mako.hpp', |
| 103 | 'writefru.py', |
| 104 | get_option('FRU_YAML') |
| 105 | ], |
| 106 | output:'writefru.hpp' |
| 107 | ) |
| 108 | |
| 109 | extra_properties_gen_hpp = custom_target( |
| 110 | 'extra-properties-gen.hpp', |
| 111 | command:[ |
| 112 | python, |
| 113 | PROP_GEN_SCRIPT, |
| 114 | '-e', |
| 115 | get_option('PROP_YAML') |
| 116 | ], |
| 117 | depend_files : ['extra-properties.mako.hpp', |
| 118 | 'extra-properties.py', |
| 119 | get_option('PROP_YAML') |
| 120 | ], |
| 121 | output:'extra-properties-gen.hpp' |
| 122 | ) |
| 123 | |
| 124 | openpower_read_vpd_SOURCES = ['app.cpp', |
| 125 | 'args.cpp', |
| 126 | 'impl.cpp', |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 127 | 'vpd-parser/ipz_parser.cpp', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 128 | 'write.cpp', |
| 129 | 'utils.cpp', |
| 130 | writefru_hpp, |
| 131 | extra_properties_gen_hpp |
| 132 | ] |
| 133 | |
| 134 | openpower_read_vpd_exe= executable( |
| 135 | 'openpower-read-vpd', |
| 136 | openpower_read_vpd_SOURCES, |
| 137 | dependencies: [ |
| 138 | sdbusplus, |
| 139 | phosphor_logging, |
| 140 | ], |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 141 | include_directories : 'vpd-parser/', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 142 | install: true, |
| 143 | ) |
| 144 | endif |
| 145 | subdir('test') |