1project( 2 'phosphor-snmp', 'cpp', 3 version : '1.0.0', 4 meson_version: '>=1.1.1', 5 default_options: [ 6 'warning_level=3', 7 'werror=true', 8 'cpp_std=c++23', 9 'buildtype=debugoptimized', 10 ] 11) 12 13conf_data = configuration_data() 14conf_data.set_quoted('BUSNAME_NETWORK_SNMP', 'xyz.openbmc_project.Network.SNMP') 15conf_data.set_quoted('OBJ_NETWORK_SNMP', '/xyz/openbmc_project/network/snmp/manager') 16conf_data.set_quoted('SNMP_CONF_PERSIST_PATH', '/var/lib/phosphor-snmp/managers/') 17conf_data.set('CLASS_VERSION', 1) 18 19sdbusplus_dep = dependency('sdbusplus') 20phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 21phosphor_logging_dep = dependency('phosphor-logging') 22libsystemd_dep = dependency('libsystemd') 23netsnmp_dep = dependency('netsnmp') 24libcrypto_dep = dependency('libcrypto') 25 26snmp_headers = include_directories('.') 27 28deps = [ 29 libsystemd_dep, 30 phosphor_dbus_interfaces_dep, 31 phosphor_logging_dep, 32 sdbusplus_dep, 33] 34 35sources = [ 36 'snmp_main.cpp', 37 'snmp_conf_manager.cpp', 38 'snmp_client.cpp', 39 'snmp_util.cpp', 40 'snmp_serialize.cpp', 41] 42 43configure_file(output: 'config.h', 44 configuration: conf_data 45) 46 47executable( 48 'phosphor-network-snmpconf', 49 sources, 50 implicit_include_directories: true, 51 dependencies: deps, 52 install: true, 53 install_dir: get_option('bindir') 54) 55 56libsnmp_deps = [ 57 sdbusplus_dep, 58 phosphor_logging_dep, 59 phosphor_dbus_interfaces_dep, 60 netsnmp_dep, 61 libcrypto_dep, 62] 63 64libsnmp_sources = files( 65 'snmp_notification.cpp', 66 'snmp_util.cpp', 67) 68 69libsnmp_lib = library( 70 'snmp', 71 libsnmp_sources, 72 include_directories: snmp_headers, 73 implicit_include_directories: false, 74 dependencies: libsnmp_deps, 75 version: meson.project_version(), 76 install: true, 77) 78 79phosphor_snmp_dep = declare_dependency( 80 include_directories: snmp_headers, 81 link_with: libsnmp_lib, 82) 83 84import('pkgconfig').generate( 85 libsnmp_lib, 86 name: meson.project_name(), 87 version: meson.project_version(), 88 requires: sdbusplus_dep, 89 description: 'Phosphor snmp utilities', 90) 91 92install_headers( 93 'snmp.hpp', 94 'snmp_notification.hpp', 95 subdir: '.', 96) 97 98build_tests = get_option('tests') 99if not build_tests.disabled() 100 subdir('test') 101endif 102