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