xref: /openbmc/phosphor-networkd/src/meson.build (revision 04fea761)
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  implicit_include_directories: false,
80  include_directories: src_includes,
81  dependencies: networkd_deps)
82
83networkd_dep = declare_dependency(
84  sources: conf_header,
85  dependencies: networkd_deps,
86  include_directories: src_includes,
87  link_with: networkd_lib)
88
89executable(
90  'phosphor-network-manager',
91  'network_manager_main.cpp',
92  implicit_include_directories: false,
93  dependencies: networkd_dep,
94  install: true,
95  install_dir: get_option('bindir'))
96
97if (get_option('hyp-nw-config') == true)
98  subdir('ibm')
99endif
100