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