William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-networkd', |
| 3 | 'cpp', |
| 4 | version: '0.1', |
| 5 | meson_version: '>=0.57.0', |
| 6 | default_options: [ |
| 7 | 'warning_level=3', |
| 8 | 'cpp_std=c++20', |
| 9 | ]) |
| 10 | |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 11 | default_busname = 'xyz.openbmc_project.Network' |
| 12 | |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 13 | conf_data = configuration_data() |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 14 | conf_data.set_quoted('DEFAULT_BUSNAME', default_busname) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 15 | conf_data.set('HAVE_UBOOT_ENV', get_option('uboot-env')) |
| 16 | conf_data.set( |
| 17 | 'LINK_LOCAL_AUTOCONFIGURATION', |
| 18 | get_option('default-link-local-autoconf')) |
| 19 | conf_data.set( |
| 20 | 'ENABLE_IPV6_ACCEPT_RA', |
| 21 | get_option('default-ipv6-accept-ra')) |
| 22 | conf_data.set('NIC_SUPPORTS_ETHTOOL', get_option('nic-ethtool')) |
| 23 | conf_data.set('SYNC_MAC_FROM_INVENTORY', get_option('sync-mac')) |
Johnathan Mantey | 609c12d | 2022-02-03 09:23:09 -0800 | [diff] [blame] | 24 | conf_data.set('PERSIST_MAC', get_option('persist-mac')) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 25 | |
| 26 | sdbusplus_dep = dependency('sdbusplus', required: false) |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 27 | if sdbusplus_dep.found() and sdbusplus_dep.type_name() != 'internal' |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 28 | sdbusplusplus_prog = find_program('sdbus++', native: true) |
| 29 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) |
| 30 | else |
| 31 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 32 | sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 33 | sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog') |
| 34 | sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable('sdbuspp_gen_meson_prog') |
| 35 | endif |
| 36 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 37 | generated_sources = [] |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 38 | generated_others = [] |
| 39 | yaml_sources = [] |
| 40 | subdir('gen') |
| 41 | subdir('gen/xyz') |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 42 | networkd_dbus_includes = include_directories('gen') |
| 43 | |
| 44 | phosphor_dbus_interfaces_dep = dependency( |
| 45 | 'phosphor-dbus-interfaces', |
| 46 | fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep']) |
| 47 | |
| 48 | networkd_dbus_deps = [ |
| 49 | phosphor_dbus_interfaces_dep, |
| 50 | sdbusplus_dep, |
| 51 | ] |
| 52 | |
| 53 | networkd_dbus_lib = static_library( |
| 54 | 'networkd_dbus', |
| 55 | generated_sources, |
| 56 | implicit_include_directories: false, |
| 57 | include_directories: networkd_dbus_includes, |
| 58 | dependencies: networkd_dbus_deps) |
| 59 | |
| 60 | generated_files_headers = [] |
| 61 | foreach s : generated_sources |
| 62 | foreach f : s.to_list() |
| 63 | p = f.full_path() |
| 64 | if p.endswith('.hpp') |
| 65 | generated_files_headers += f |
| 66 | endif |
| 67 | endforeach |
| 68 | endforeach |
| 69 | |
| 70 | networkd_dbus_dep = declare_dependency( |
| 71 | sources: generated_files_headers, |
| 72 | include_directories: networkd_dbus_includes, |
| 73 | link_with: networkd_dbus_lib, |
| 74 | dependencies: networkd_dbus_deps) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 75 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 76 | subdir('src') |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 77 | |
| 78 | configure_file( |
| 79 | input: 'xyz.openbmc_project.Network.service.in', |
| 80 | output: 'xyz.openbmc_project.Network.service', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 81 | configuration: { |
| 82 | 'SYSTEMD_TARGET': 'multi-user.target', |
| 83 | 'DEFAULT_BUSNAME': default_busname, |
| 84 | }, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 85 | install: true, |
| 86 | install_dir: dependency('systemd').get_variable( |
| 87 | pkgconfig: 'systemdsystemunitdir')) |
| 88 | |
| 89 | configure_file( |
| 90 | input: 'xyz.openbmc_project.Network.conf.in', |
| 91 | output: 'xyz.openbmc_project.Network.conf', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 92 | configuration: {'DEFAULT_BUSNAME': default_busname}, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 93 | install: true, |
| 94 | install_dir: get_option('datadir') / 'dbus-1' / 'system.d') |
| 95 | |
| 96 | if not get_option('tests').disabled() |
| 97 | subdir('test') |
| 98 | endif |