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