William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 1 | phosphor_logging_dep = dependency( |
| 2 | 'phosphor-logging', |
| 3 | fallback: ['phosphor-logging', 'phosphor_logging_dep']) |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 4 | |
| 5 | src_includes = include_directories('.') |
| 6 | |
William A. Kennington III | a68ab4b | 2021-10-07 19:16:16 -0700 | [diff] [blame] | 7 | fmt_dep = dependency('fmt', required: false) |
| 8 | if 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') |
| 20 | endif |
| 21 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 22 | executable( |
| 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 III | a68ab4b | 2021-10-07 19:16:16 -0700 | [diff] [blame] | 30 | fmt_dep, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 31 | 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 | |
| 39 | json_dep = declare_dependency() |
| 40 | if 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 |
| 53 | endif |
| 54 | |
| 55 | networkd_deps = [ |
| 56 | json_dep, |
| 57 | phosphor_dbus_interfaces_dep, |
| 58 | phosphor_logging_dep, |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 59 | networkd_dbus_dep, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 60 | sdbusplus_dep, |
| 61 | dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']), |
| 62 | dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']), |
| 63 | ] |
| 64 | |
| 65 | conf_header = configure_file( |
| 66 | output: 'config.h', |
| 67 | configuration: conf_data) |
| 68 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 69 | networkd_lib = static_library( |
| 70 | 'networkd', |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 71 | conf_header, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 72 | '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 III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 88 | include_directories: src_includes, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 89 | dependencies: networkd_deps) |
| 90 | |
| 91 | networkd_dep = declare_dependency( |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 92 | sources: conf_header, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 93 | dependencies: networkd_deps, |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 94 | include_directories: src_includes, |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 95 | link_with: networkd_lib) |
| 96 | |
| 97 | executable( |
| 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')) |