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