SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-vpd-parser', |
| 3 | 'c', |
| 4 | 'cpp', |
| 5 | default_options: [ |
| 6 | 'cpp_std=c++17' |
| 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')+'"', |
| 25 | } |
| 26 | ) |
| 27 | ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp', |
| 28 | 'ibm_vpd_type_check.cpp', |
| 29 | 'parser.cpp', |
| 30 | 'impl.cpp', |
| 31 | 'utils.cpp', |
| 32 | 'keyword_vpd_parser.cpp', |
| 33 | 'vpdecc/vpdecc.c', |
| 34 | 'vpdecc/vpdecc_support.c' |
| 35 | ] |
| 36 | |
| 37 | ibm_vpd_exe = executable( |
| 38 | 'ibm-read-vpd', |
| 39 | ibm_read_vpd_SOURCES, |
| 40 | dependencies: [ |
| 41 | sdbusplus, |
| 42 | phosphor_logging, |
| 43 | ], |
| 44 | install: true, |
| 45 | cpp_args : '-DIPZ_PARSER' |
| 46 | ) |
| 47 | else |
| 48 | FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML') |
| 49 | PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML') |
| 50 | |
| 51 | src_dir = meson.source_root() |
| 52 | FRU_GEN_SCRIPT = src_dir + '/writefru.py' |
| 53 | FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml' |
| 54 | |
| 55 | PROP_GEN_SCRIPT = src_dir + '/extra-properties.py' |
| 56 | PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml' |
| 57 | |
| 58 | writefru_hpp = custom_target('writefru.hpp', |
| 59 | command:[python, |
| 60 | FRU_GEN_SCRIPT, |
| 61 | '-i', |
| 62 | get_option('FRU_YAML') |
| 63 | ], |
| 64 | depend_files :['writefru.mako.hpp', |
| 65 | 'writefru.py', |
| 66 | get_option('FRU_YAML') |
| 67 | ], |
| 68 | output:'writefru.hpp' |
| 69 | ) |
| 70 | |
| 71 | extra_properties_gen_hpp = custom_target( |
| 72 | 'extra-properties-gen.hpp', |
| 73 | command:[ |
| 74 | python, |
| 75 | PROP_GEN_SCRIPT, |
| 76 | '-e', |
| 77 | get_option('PROP_YAML') |
| 78 | ], |
| 79 | depend_files : ['extra-properties.mako.hpp', |
| 80 | 'extra-properties.py', |
| 81 | get_option('PROP_YAML') |
| 82 | ], |
| 83 | output:'extra-properties-gen.hpp' |
| 84 | ) |
| 85 | |
| 86 | openpower_read_vpd_SOURCES = ['app.cpp', |
| 87 | 'args.cpp', |
| 88 | 'impl.cpp', |
| 89 | 'parser.cpp', |
| 90 | 'write.cpp', |
| 91 | 'utils.cpp', |
| 92 | writefru_hpp, |
| 93 | extra_properties_gen_hpp |
| 94 | ] |
| 95 | |
| 96 | openpower_read_vpd_exe= executable( |
| 97 | 'openpower-read-vpd', |
| 98 | openpower_read_vpd_SOURCES, |
| 99 | dependencies: [ |
| 100 | sdbusplus, |
| 101 | phosphor_logging, |
| 102 | ], |
| 103 | install: true, |
| 104 | ) |
| 105 | endif |
| 106 | subdir('test') |