blob: 08decbdc945b83ab5d90ea14f67f69951eb6f349 [file] [log] [blame]
Patrick Williams3397be32022-03-21 09:52:57 -05001phosphor_logging_dep = dependency('phosphor-logging')
William A. Kennington III1bbe3d12021-05-13 23:45:09 -07002
3src_includes = include_directories('.')
4
William A. Kennington IIIa68ab4b2021-10-07 19:16:16 -07005fmt_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
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070020executable(
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: [
William A. Kennington IIIa68ab4b2021-10-07 19:16:16 -070028 fmt_dep,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070029 dependency('libnl-3.0'),
30 dependency('libnl-genl-3.0'),
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070031 ],
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
Patrick Williams3397be32022-03-21 09:52:57 -050044 json_dep = dependency('nlohmann_json')
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070045 endif
46endif
47
48networkd_deps = [
49 json_dep,
50 phosphor_dbus_interfaces_dep,
51 phosphor_logging_dep,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070052 networkd_dbus_dep,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070053 sdbusplus_dep,
Patrick Williams3397be32022-03-21 09:52:57 -050054 dependency('sdeventplus'),
55 dependency('stdplus'),
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070056]
57
58conf_header = configure_file(
59 output: 'config.h',
60 configuration: conf_data)
61
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070062networkd_lib = static_library(
63 'networkd',
William A. Kennington III37cf66c2021-05-17 14:56:54 -070064 conf_header,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070065 '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,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070081 include_directories: src_includes,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070082 dependencies: networkd_deps)
83
84networkd_dep = declare_dependency(
William A. Kennington III37cf66c2021-05-17 14:56:54 -070085 sources: conf_header,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070086 dependencies: networkd_deps,
William A. Kennington III37cf66c2021-05-17 14:56:54 -070087 include_directories: src_includes,
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070088 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'))
Asmitha Karunanithibe2bdec2021-05-13 02:54:29 -050097
98if (get_option('hyp-nw-config') == true)
99 subdir('ibm')
100endif