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