blob: 4203295ad343259735ecb308ed85d3996935f2af [file] [log] [blame]
George Liu918e4aa2022-05-10 13:59:25 +08001project(
2 'phosphor-snmp', 'cpp',
3 version : '1.0.0',
Patrick Williams47652f22023-07-12 11:15:22 -05004 meson_version: '>=1.1.1',
George Liu918e4aa2022-05-10 13:59:25 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams47652f22023-07-12 11:15:22 -05008 'cpp_std=c++23',
George Liu918e4aa2022-05-10 13:59:25 +08009 '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(),
Konstantin Aladyshev673d9ce2024-03-29 16:08:19 +030088 libraries: sdbusplus_dep,
George Liu918e4aa2022-05-10 13:59:25 +080089 description: 'Phosphor snmp utilities',
90)
91
92install_headers(
93 'snmp.hpp',
94 'snmp_notification.hpp',
95 subdir: '.',
96)
97
George Liu208acee2022-05-10 14:01:30 +080098build_tests = get_option('tests')
99if not build_tests.disabled()
100 subdir('test')
101endif