blob: 791685681c7a9a52a605a39df0e50859442427c4 [file] [log] [blame]
William A. Kennington III37cf66c2021-05-17 14:56:54 -07001phosphor_logging_dep = dependency(
2 'phosphor-logging',
3 fallback: ['phosphor-logging', 'phosphor_logging_dep'])
William A. Kennington III1bbe3d12021-05-13 23:45:09 -07004
5src_includes = include_directories('.')
6
William A. Kennington IIIa68ab4b2021-10-07 19:16:16 -07007fmt_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
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070022executable(
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: [
William A. Kennington IIIa68ab4b2021-10-07 19:16:16 -070030 fmt_dep,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070031 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,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070059 networkd_dbus_dep,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070060 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
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070069networkd_lib = static_library(
70 'networkd',
William A. Kennington III37cf66c2021-05-17 14:56:54 -070071 conf_header,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070072 '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,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070088 include_directories: src_includes,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070089 dependencies: networkd_deps)
90
91networkd_dep = declare_dependency(
William A. Kennington III37cf66c2021-05-17 14:56:54 -070092 sources: conf_header,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070093 dependencies: networkd_deps,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070094 include_directories: src_includes,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070095 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'))
Asmitha Karunanithibe2bdec2021-05-13 02:54:29 -0500104
105if (get_option('hyp-nw-config') == true)
106 subdir('ibm')
107endif