| George Liu | 918e4aa | 2022-05-10 13:59:25 +0800 | [diff] [blame] | 1 | project( | 
|  | 2 | 'phosphor-snmp', 'cpp', | 
|  | 3 | version : '1.0.0', | 
| Patrick Williams | 47652f2 | 2023-07-12 11:15:22 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', | 
| George Liu | 918e4aa | 2022-05-10 13:59:25 +0800 | [diff] [blame] | 5 | default_options: [ | 
|  | 6 | 'warning_level=3', | 
|  | 7 | 'werror=true', | 
| Patrick Williams | 47652f2 | 2023-07-12 11:15:22 -0500 | [diff] [blame] | 8 | 'cpp_std=c++23', | 
| George Liu | 918e4aa | 2022-05-10 13:59:25 +0800 | [diff] [blame] | 9 | 'buildtype=debugoptimized', | 
|  | 10 | ] | 
|  | 11 | ) | 
|  | 12 |  | 
|  | 13 | conf_data = configuration_data() | 
|  | 14 | conf_data.set_quoted('BUSNAME_NETWORK_SNMP', 'xyz.openbmc_project.Network.SNMP') | 
|  | 15 | conf_data.set_quoted('OBJ_NETWORK_SNMP', '/xyz/openbmc_project/network/snmp/manager') | 
|  | 16 | conf_data.set_quoted('SNMP_CONF_PERSIST_PATH', '/var/lib/phosphor-snmp/managers/') | 
|  | 17 | conf_data.set('CLASS_VERSION', 1) | 
|  | 18 |  | 
|  | 19 | sdbusplus_dep = dependency('sdbusplus') | 
|  | 20 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') | 
|  | 21 | phosphor_logging_dep = dependency('phosphor-logging') | 
|  | 22 | libsystemd_dep = dependency('libsystemd') | 
|  | 23 | netsnmp_dep = dependency('netsnmp') | 
|  | 24 | libcrypto_dep = dependency('libcrypto') | 
|  | 25 |  | 
|  | 26 | snmp_headers = include_directories('.') | 
|  | 27 |  | 
|  | 28 | deps = [ | 
|  | 29 | libsystemd_dep, | 
|  | 30 | phosphor_dbus_interfaces_dep, | 
|  | 31 | phosphor_logging_dep, | 
|  | 32 | sdbusplus_dep, | 
|  | 33 | ] | 
|  | 34 |  | 
|  | 35 | sources = [ | 
|  | 36 | 'snmp_main.cpp', | 
|  | 37 | 'snmp_conf_manager.cpp', | 
|  | 38 | 'snmp_client.cpp', | 
|  | 39 | 'snmp_util.cpp', | 
|  | 40 | 'snmp_serialize.cpp', | 
|  | 41 | ] | 
|  | 42 |  | 
|  | 43 | configure_file(output: 'config.h', | 
|  | 44 | configuration: conf_data | 
|  | 45 | ) | 
|  | 46 |  | 
|  | 47 | executable( | 
|  | 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 |  | 
|  | 56 | libsnmp_deps = [ | 
|  | 57 | sdbusplus_dep, | 
|  | 58 | phosphor_logging_dep, | 
|  | 59 | phosphor_dbus_interfaces_dep, | 
|  | 60 | netsnmp_dep, | 
|  | 61 | libcrypto_dep, | 
|  | 62 | ] | 
|  | 63 |  | 
|  | 64 | libsnmp_sources = files( | 
|  | 65 | 'snmp_notification.cpp', | 
|  | 66 | 'snmp_util.cpp', | 
|  | 67 | ) | 
|  | 68 |  | 
|  | 69 | libsnmp_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 |  | 
|  | 79 | phosphor_snmp_dep = declare_dependency( | 
|  | 80 | include_directories: snmp_headers, | 
|  | 81 | link_with: libsnmp_lib, | 
|  | 82 | ) | 
|  | 83 |  | 
|  | 84 | import('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 |  | 
|  | 92 | install_headers( | 
|  | 93 | 'snmp.hpp', | 
|  | 94 | 'snmp_notification.hpp', | 
|  | 95 | subdir: '.', | 
|  | 96 | ) | 
|  | 97 |  | 
| George Liu | 208acee | 2022-05-10 14:01:30 +0800 | [diff] [blame] | 98 | build_tests = get_option('tests') | 
|  | 99 | if not build_tests.disabled() | 
|  | 100 | subdir('test') | 
|  | 101 | endif |