xref: /openbmc/phosphor-networkd/src/meson.build (revision 1bbe3d1e)
1phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
2phosphor_logging_dep = dependency('phosphor-logging')
3
4src_includes = include_directories('.')
5
6executable(
7  'ncsi-netlink',
8  'argument.cpp',
9  'ncsi_netlink_main.cpp',
10  'ncsi_util.cpp',
11  implicit_include_directories: false,
12  include_directories: src_includes,
13  dependencies: [
14    dependency('libnl-3.0'),
15    dependency('libnl-genl-3.0'),
16    phosphor_dbus_interfaces_dep,
17    phosphor_logging_dep,
18  ],
19  install: true,
20  install_dir: get_option('bindir'))
21
22json_dep = declare_dependency()
23if get_option('sync-mac')
24  # nlohmann_json might not have a pkg-config. It is header only so just make
25  # sure we can access the needed symbols from the header.
26  has_json = meson.get_compiler('cpp').has_header_symbol(
27    'nlohmann/json.hpp',
28    'nlohmann::json::string_t',
29    required: false)
30  if not has_json
31    json_dep = dependency(
32      'nlohmann_json',
33      fallback: ['nlohmann_json', 'nlohmann_json_dep'],
34      required: true)
35  endif
36endif
37
38networkd_deps = [
39  json_dep,
40  phosphor_dbus_interfaces_dep,
41  phosphor_logging_dep,
42  sdbusplus_dep,
43  dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']),
44  dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']),
45]
46
47conf_header = configure_file(
48  output: 'config.h',
49  configuration: conf_data)
50
51networkd_generated = [
52  conf_header,
53] + generated_sources
54
55networkd_includes = [
56  src_includes,
57  generated_includes,
58]
59
60networkd_lib = static_library(
61  'networkd',
62  networkd_generated,
63  'ethernet_interface.cpp',
64  'neighbor.cpp',
65  'ipaddress.cpp',
66  'netlink.cpp',
67  'network_config.cpp',
68  'network_manager.cpp',
69  'system_configuration.cpp',
70  'util.cpp',
71  'routing_table.cpp',
72  'config_parser.cpp',
73  'dhcp_configuration.cpp',
74  'vlan_interface.cpp',
75  'rtnetlink_server.cpp',
76  'dns_updater.cpp',
77  'watch.cpp',
78  implicit_include_directories: false,
79  include_directories: networkd_includes,
80  dependencies: networkd_deps)
81
82networkd_dep = declare_dependency(
83  sources: networkd_generated,
84  dependencies: networkd_deps,
85  include_directories: networkd_includes,
86  link_with: networkd_lib)
87
88executable(
89  'phosphor-network-manager',
90  'network_manager_main.cpp',
91  implicit_include_directories: false,
92  dependencies: networkd_dep,
93  install: true,
94  install_dir: get_option('bindir'))
95