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