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