Patrick Williams | 3397be3 | 2022-03-21 09:52:57 -0500 | [diff] [blame] | 1 | phosphor_logging_dep = dependency('phosphor-logging') |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 2 | |
| 3 | src_includes = include_directories('.') |
| 4 | |
William A. Kennington III | a68ab4b | 2021-10-07 19:16:16 -0700 | [diff] [blame] | 5 | fmt_dep = dependency('fmt', required: false) |
| 6 | if 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') |
| 18 | endif |
| 19 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 20 | executable( |
| 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 III | a68ab4b | 2021-10-07 19:16:16 -0700 | [diff] [blame] | 28 | fmt_dep, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 29 | dependency('libnl-3.0'), |
| 30 | dependency('libnl-genl-3.0'), |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 31 | ], |
| 32 | install: true, |
| 33 | install_dir: get_option('bindir')) |
| 34 | |
| 35 | json_dep = declare_dependency() |
| 36 | if 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 Williams | 3397be3 | 2022-03-21 09:52:57 -0500 | [diff] [blame] | 44 | json_dep = dependency('nlohmann_json') |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 45 | endif |
| 46 | endif |
| 47 | |
| 48 | networkd_deps = [ |
| 49 | json_dep, |
| 50 | phosphor_dbus_interfaces_dep, |
| 51 | phosphor_logging_dep, |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 52 | networkd_dbus_dep, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 53 | sdbusplus_dep, |
Patrick Williams | 3397be3 | 2022-03-21 09:52:57 -0500 | [diff] [blame] | 54 | dependency('sdeventplus'), |
| 55 | dependency('stdplus'), |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 56 | ] |
| 57 | |
| 58 | conf_header = configure_file( |
| 59 | output: 'config.h', |
| 60 | configuration: conf_data) |
| 61 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 62 | networkd_lib = static_library( |
| 63 | 'networkd', |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 64 | conf_header, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 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, |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 81 | include_directories: src_includes, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 82 | dependencies: networkd_deps) |
| 83 | |
| 84 | networkd_dep = declare_dependency( |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 85 | sources: conf_header, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 86 | dependencies: networkd_deps, |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 87 | include_directories: src_includes, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 88 | link_with: networkd_lib) |
| 89 | |
| 90 | executable( |
| 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 Karunanithi | be2bdec | 2021-05-13 02:54:29 -0500 | [diff] [blame] | 97 | |
| 98 | if (get_option('hyp-nw-config') == true) |
| 99 | subdir('ibm') |
| 100 | endif |