1project( 2 'openpower-vpd-parser', 3 'c', 4 'cpp', 5 default_options: [ 6 'warning_level=3', 7 'werror=true', 8 'cpp_std=c++17' 9 ], 10 version: '1.0' 11) 12 13build_tests = get_option('tests') 14 15sdbusplus = dependency('sdbusplus') 16phosphor_logging = dependency('phosphor-logging') 17phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') 18 19compiler = meson.get_compiler('cpp') 20python = find_program('python3', required:true) 21 22compiler.has_header('CLI/CLI.hpp') 23compiler.has_header('nlohmann/json.hpp') 24add_global_arguments('-Wno-psabi', language : ['c', 'cpp']) 25configure_file(output: 'config.h', 26 configuration :{ 27 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"', 28 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"', 29 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"', 30 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"', 31 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"', 32 'BUSNAME' : '"' + get_option('BUSNAME') + '"', 33 'OBJPATH' : '"' + get_option('OBJPATH') + '"', 34 'IFACE' : '"' + get_option('IFACE') + '"', 35 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"', 36 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"', 37 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"', 38 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"', 39 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"', 40 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"', 41 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"', 42 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"' 43 } 44 ) 45 46if get_option('ibm-parser').enabled() 47 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp', 48 'vpd-parser/ipz_parser.cpp', 49 'impl.cpp', 50 'utils.cpp', 51 'vpd-parser/keyword_vpd_parser.cpp', 52 'vpdecc/vpdecc.c', 53 'vpdecc/vpdecc_support.c', 54 'vpd-parser/memory_vpd_parser.cpp', 55 'vpd-parser/parser_factory.cpp' 56 ] 57 58 ibm_vpd_exe = executable( 59 'ibm-read-vpd', 60 ibm_read_vpd_SOURCES, 61 dependencies: [ 62 sdbusplus, 63 phosphor_logging, 64 ], 65 include_directories : 'vpd-parser/', 66 install: true, 67 cpp_args : '-DIPZ_PARSER' 68 ) 69 70 vpd_tool_SOURCES = ['vpd_tool.cpp', 71 'vpd_tool_impl.cpp' 72 ] 73 74 vpd_tool_exe = executable( 75 'vpd-tool', 76 vpd_tool_SOURCES, 77 dependencies: [ 78 sdbusplus 79 ], 80 install: true 81 ) 82if get_option('vpd-manager').enabled() 83 subdir('vpd-manager') 84endif 85 86else 87 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML') 88 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML') 89 90 src_dir = meson.source_root() 91 FRU_GEN_SCRIPT = src_dir + '/writefru.py' 92 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml' 93 94 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py' 95 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml' 96 97 writefru_hpp = custom_target('writefru.hpp', 98 command:[python, 99 FRU_GEN_SCRIPT, 100 '-i', 101 get_option('FRU_YAML') 102 ], 103 depend_files :['writefru.mako.hpp', 104 'writefru.py', 105 get_option('FRU_YAML') 106 ], 107 output:'writefru.hpp' 108 ) 109 110 extra_properties_gen_hpp = custom_target( 111 'extra-properties-gen.hpp', 112 command:[ 113 python, 114 PROP_GEN_SCRIPT, 115 '-e', 116 get_option('PROP_YAML') 117 ], 118 depend_files : ['extra-properties.mako.hpp', 119 'extra-properties.py', 120 get_option('PROP_YAML') 121 ], 122 output:'extra-properties-gen.hpp' 123 ) 124 125 openpower_read_vpd_SOURCES = ['app.cpp', 126 'args.cpp', 127 'impl.cpp', 128 'vpd-parser/ipz_parser.cpp', 129 'write.cpp', 130 'utils.cpp', 131 writefru_hpp, 132 extra_properties_gen_hpp 133 ] 134 135 openpower_read_vpd_exe= executable( 136 'openpower-read-vpd', 137 openpower_read_vpd_SOURCES, 138 dependencies: [ 139 sdbusplus, 140 phosphor_logging, 141 ], 142 include_directories : 'vpd-parser/', 143 install: true, 144 ) 145endif 146subdir('test') 147