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