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')) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 24 | |
| 25 | sdbusplus_dep = dependency('sdbusplus', required: false) |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 26 | if sdbusplus_dep.found() and sdbusplus_dep.type_name() != 'internal' |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 27 | sdbusplusplus_prog = find_program('sdbus++', native: true) |
| 28 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) |
| 29 | else |
| 30 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 31 | sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 32 | sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog') |
| 33 | sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable('sdbuspp_gen_meson_prog') |
| 34 | endif |
| 35 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 36 | generated_sources = [] |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 37 | generated_others = [] |
| 38 | yaml_sources = [] |
| 39 | subdir('gen') |
| 40 | subdir('gen/xyz') |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 41 | networkd_dbus_includes = include_directories('gen') |
| 42 | |
| 43 | phosphor_dbus_interfaces_dep = dependency( |
| 44 | 'phosphor-dbus-interfaces', |
| 45 | fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep']) |
| 46 | |
| 47 | networkd_dbus_deps = [ |
| 48 | phosphor_dbus_interfaces_dep, |
| 49 | sdbusplus_dep, |
| 50 | ] |
| 51 | |
| 52 | networkd_dbus_lib = static_library( |
| 53 | 'networkd_dbus', |
| 54 | generated_sources, |
| 55 | implicit_include_directories: false, |
| 56 | include_directories: networkd_dbus_includes, |
| 57 | dependencies: networkd_dbus_deps) |
| 58 | |
| 59 | generated_files_headers = [] |
| 60 | foreach s : generated_sources |
| 61 | foreach f : s.to_list() |
| 62 | p = f.full_path() |
| 63 | if p.endswith('.hpp') |
| 64 | generated_files_headers += f |
| 65 | endif |
| 66 | endforeach |
| 67 | endforeach |
| 68 | |
| 69 | networkd_dbus_dep = declare_dependency( |
| 70 | sources: generated_files_headers, |
| 71 | include_directories: networkd_dbus_includes, |
| 72 | link_with: networkd_dbus_lib, |
| 73 | dependencies: networkd_dbus_deps) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 74 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 75 | subdir('src') |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 76 | |
| 77 | configure_file( |
| 78 | input: 'xyz.openbmc_project.Network.service.in', |
| 79 | output: 'xyz.openbmc_project.Network.service', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 80 | configuration: { |
| 81 | 'SYSTEMD_TARGET': 'multi-user.target', |
| 82 | 'DEFAULT_BUSNAME': default_busname, |
| 83 | }, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 84 | install: true, |
| 85 | install_dir: dependency('systemd').get_variable( |
| 86 | pkgconfig: 'systemdsystemunitdir')) |
| 87 | |
| 88 | configure_file( |
| 89 | input: 'xyz.openbmc_project.Network.conf.in', |
| 90 | output: 'xyz.openbmc_project.Network.conf', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 91 | configuration: {'DEFAULT_BUSNAME': default_busname}, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 92 | install: true, |
| 93 | install_dir: get_option('datadir') / 'dbus-1' / 'system.d') |
| 94 | |
| 95 | if not get_option('tests').disabled() |
| 96 | subdir('test') |
| 97 | endif |