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 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"' 52 } 53 ) 54 55common_SOURCES =['common_utility.cpp', 56'vpd-parser/parser_factory.cpp', 57 'vpd-parser/memory_vpd_parser.cpp', 58 'vpd-parser/keyword_vpd_parser.cpp', 59 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp', 60 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c' 61] 62 63if get_option('ibm-parser').enabled() 64 libgpiodcxx = dependency('libgpiodcxx') 65 ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp' 66 ]+common_SOURCES 67 68 ibm_vpd_exe = executable( 69 'ibm-read-vpd', 70 ibm_read_vpd_SOURCES, 71 dependencies: [ 72 sdbusplus, 73 phosphor_logging, 74 libgpiodcxx, 75 ], 76 include_directories : 'vpd-parser/', 77 install: true, 78 cpp_args : '-DIPZ_PARSER' 79 ) 80 81 vpd_tool_SOURCES = ['vpd_tool.cpp', 82 'vpd_tool_impl.cpp', 83 'vpd-manager/editor_impl.cpp', 84 ]+common_SOURCES 85 86 vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager') 87 88 vpd_tool_exe = executable( 89 'vpd-tool', 90 vpd_tool_SOURCES, 91 dependencies: [ 92 sdbusplus 93 ], 94 install: true, 95 include_directories : vpd_tool_INCLUDE 96 ) 97if get_option('vpd-manager').enabled() 98 subdir('vpd-manager') 99endif 100 101else 102 FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML') 103 PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML') 104 105 src_dir = meson.source_root() 106 FRU_GEN_SCRIPT = src_dir + '/writefru.py' 107 FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml' 108 109 PROP_GEN_SCRIPT = src_dir + '/extra-properties.py' 110 PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml' 111 112 writefru_hpp = custom_target('writefru.hpp', 113 command:[python, 114 FRU_GEN_SCRIPT, 115 '-i', 116 get_option('FRU_YAML') 117 ], 118 depend_files :['writefru.mako.hpp', 119 'writefru.py', 120 get_option('FRU_YAML') 121 ], 122 output:'writefru.hpp' 123 ) 124 125 extra_properties_gen_hpp = custom_target( 126 'extra-properties-gen.hpp', 127 command:[ 128 python, 129 PROP_GEN_SCRIPT, 130 '-e', 131 get_option('PROP_YAML') 132 ], 133 depend_files : ['extra-properties.mako.hpp', 134 'extra-properties.py', 135 get_option('PROP_YAML') 136 ], 137 output:'extra-properties-gen.hpp' 138 ) 139 140 openpower_read_vpd_SOURCES = ['app.cpp', 141 'args.cpp', 142 'impl.cpp', 143 'vpd-parser/ipz_parser.cpp', 144 'write.cpp', 145 'common_utility.cpp', 146 writefru_hpp, 147 extra_properties_gen_hpp 148 ] 149 150 openpower_read_vpd_exe= executable( 151 'openpower-read-vpd', 152 openpower_read_vpd_SOURCES, 153 dependencies: [ 154 sdbusplus, 155 phosphor_logging, 156 ], 157 include_directories : 'vpd-parser/', 158 install: true, 159 ) 160endif 161subdir('test') 162