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