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', |
Patrick Williams | cc7f5bf | 2023-04-12 08:01:22 -0500 | [diff] [blame] | 5 | meson_version: '>=0.58.0', |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 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')) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 22 | conf_data.set('SYNC_MAC_FROM_INVENTORY', get_option('sync-mac')) |
Johnathan Mantey | 609c12d | 2022-02-03 09:23:09 -0800 | [diff] [blame] | 23 | conf_data.set('PERSIST_MAC', get_option('persist-mac')) |
Potin Lai | 9f621f3 | 2022-11-18 12:03:09 +0800 | [diff] [blame] | 24 | conf_data.set10('FORCE_SYNC_MAC_FROM_INVENTORY', get_option('force-sync-mac')) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 25 | |
Patrick Williams | 3397be3 | 2022-03-21 09:52:57 -0500 | [diff] [blame] | 26 | sdbusplus_dep = dependency('sdbusplus') |
| 27 | sdbusplusplus_prog = find_program('sdbus++', native: true) |
| 28 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) |
William A. Kennington III | 4b60417 | 2022-09-20 13:13:54 -0700 | [diff] [blame] | 29 | sdbusplusplus_depfiles = files() |
| 30 | if sdbusplus_dep.type_name() == 'internal' |
| 31 | sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles') |
| 32 | endif |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 33 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 34 | generated_sources = [] |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 35 | generated_others = [] |
| 36 | yaml_sources = [] |
| 37 | subdir('gen') |
| 38 | subdir('gen/xyz') |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 39 | networkd_dbus_includes = include_directories('gen') |
| 40 | |
Patrick Williams | 3397be3 | 2022-03-21 09:52:57 -0500 | [diff] [blame] | 41 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
William A. Kennington III | 37cf66c | 2021-05-17 14:56:54 -0700 | [diff] [blame] | 42 | |
| 43 | networkd_dbus_deps = [ |
| 44 | phosphor_dbus_interfaces_dep, |
| 45 | sdbusplus_dep, |
| 46 | ] |
| 47 | |
| 48 | networkd_dbus_lib = static_library( |
| 49 | 'networkd_dbus', |
| 50 | generated_sources, |
| 51 | implicit_include_directories: false, |
| 52 | include_directories: networkd_dbus_includes, |
| 53 | dependencies: networkd_dbus_deps) |
| 54 | |
| 55 | generated_files_headers = [] |
| 56 | foreach s : generated_sources |
| 57 | foreach f : s.to_list() |
| 58 | p = f.full_path() |
| 59 | if p.endswith('.hpp') |
| 60 | generated_files_headers += f |
| 61 | endif |
| 62 | endforeach |
| 63 | endforeach |
| 64 | |
| 65 | networkd_dbus_dep = declare_dependency( |
| 66 | sources: generated_files_headers, |
| 67 | include_directories: networkd_dbus_includes, |
| 68 | link_with: networkd_dbus_lib, |
| 69 | dependencies: networkd_dbus_deps) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 70 | |
William A. Kennington III | 1bbe3d1 | 2021-05-13 23:45:09 -0700 | [diff] [blame] | 71 | subdir('src') |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 72 | |
| 73 | configure_file( |
William A. Kennington III | 93433c1 | 2022-08-25 17:54:01 -0700 | [diff] [blame] | 74 | input: '60-phosphor-networkd-default.network.in', |
| 75 | output: '60-phosphor-networkd-default.network', |
| 76 | configuration: conf_data, |
| 77 | install: true, |
| 78 | install_dir: dependency('systemd').get_variable( |
Patrick Williams | cc7f5bf | 2023-04-12 08:01:22 -0500 | [diff] [blame] | 79 | 'systemdutildir') / 'network') |
William A. Kennington III | 93433c1 | 2022-08-25 17:54:01 -0700 | [diff] [blame] | 80 | |
| 81 | configure_file( |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 82 | input: 'xyz.openbmc_project.Network.service.in', |
| 83 | output: 'xyz.openbmc_project.Network.service', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 84 | configuration: { |
| 85 | 'SYSTEMD_TARGET': 'multi-user.target', |
| 86 | 'DEFAULT_BUSNAME': default_busname, |
| 87 | }, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 88 | install: true, |
| 89 | install_dir: dependency('systemd').get_variable( |
Patrick Williams | cc7f5bf | 2023-04-12 08:01:22 -0500 | [diff] [blame] | 90 | 'systemdsystemunitdir')) |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 91 | |
| 92 | configure_file( |
| 93 | input: 'xyz.openbmc_project.Network.conf.in', |
| 94 | output: 'xyz.openbmc_project.Network.conf', |
William A. Kennington III | 1e710d0 | 2021-05-24 13:35:44 -0700 | [diff] [blame] | 95 | configuration: {'DEFAULT_BUSNAME': default_busname}, |
William A. Kennington III | 0a01b2a | 2021-05-13 18:38:57 -0700 | [diff] [blame] | 96 | install: true, |
| 97 | install_dir: get_option('datadir') / 'dbus-1' / 'system.d') |
| 98 | |
| 99 | if not get_option('tests').disabled() |
| 100 | subdir('test') |
| 101 | endif |