xref: /openbmc/phosphor-networkd/src/meson.build (revision 7c44a78e)
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  ],
32  install: true,
33  install_dir: get_option('bindir'))
34
35json_dep = declare_dependency()
36if get_option('sync-mac')
37  # nlohmann_json might not have a pkg-config. It is header only so just make
38  # sure we can access the needed symbols from the header.
39  has_json = meson.get_compiler('cpp').has_header_symbol(
40    'nlohmann/json.hpp',
41    'nlohmann::json::string_t',
42    required: false)
43  if not has_json
44    json_dep = dependency('nlohmann_json')
45  endif
46endif
47
48networkd_deps = [
49  json_dep,
50  phosphor_dbus_interfaces_dep,
51  phosphor_logging_dep,
52  networkd_dbus_dep,
53  sdbusplus_dep,
54  dependency('sdeventplus'),
55  dependency('stdplus'),
56]
57
58conf_header = configure_file(
59  output: 'config.h',
60  configuration: conf_data)
61
62networkd_lib = static_library(
63  'networkd',
64  conf_header,
65  'ethernet_interface.cpp',
66  'neighbor.cpp',
67  'ipaddress.cpp',
68  'netlink.cpp',
69  'network_config.cpp',
70  'network_manager.cpp',
71  'system_configuration.cpp',
72  'util.cpp',
73  'routing_table.cpp',
74  'config_parser.cpp',
75  'dhcp_configuration.cpp',
76  'vlan_interface.cpp',
77  'rtnetlink_server.cpp',
78  'dns_updater.cpp',
79  'watch.cpp',
80  implicit_include_directories: false,
81  include_directories: src_includes,
82  dependencies: networkd_deps)
83
84networkd_dep = declare_dependency(
85  sources: conf_header,
86  dependencies: networkd_deps,
87  include_directories: src_includes,
88  link_with: networkd_lib)
89
90executable(
91  'phosphor-network-manager',
92  'network_manager_main.cpp',
93  implicit_include_directories: false,
94  dependencies: networkd_dep,
95  install: true,
96  install_dir: get_option('bindir'))
97
98if (get_option('hyp-nw-config') == true)
99  subdir('ibm')
100endif
101