blob: 36b00f624b359090cd175792c0632271a3a4703e [file] [log] [blame]
William A. Kennington III0a01b2a2021-05-13 18:38:57 -07001project(
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 III1e710d02021-05-24 13:35:44 -070011default_busname = 'xyz.openbmc_project.Network'
12
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070013conf_data = configuration_data()
William A. Kennington III1e710d02021-05-24 13:35:44 -070014conf_data.set_quoted('DEFAULT_BUSNAME', default_busname)
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070015conf_data.set('HAVE_UBOOT_ENV', get_option('uboot-env'))
16conf_data.set(
17 'LINK_LOCAL_AUTOCONFIGURATION',
18 get_option('default-link-local-autoconf'))
19conf_data.set(
20 'ENABLE_IPV6_ACCEPT_RA',
21 get_option('default-ipv6-accept-ra'))
22conf_data.set('NIC_SUPPORTS_ETHTOOL', get_option('nic-ethtool'))
23conf_data.set('SYNC_MAC_FROM_INVENTORY', get_option('sync-mac'))
Johnathan Mantey609c12d2022-02-03 09:23:09 -080024conf_data.set('PERSIST_MAC', get_option('persist-mac'))
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070025
Patrick Williams3397be32022-03-21 09:52:57 -050026sdbusplus_dep = dependency('sdbusplus')
27sdbusplusplus_prog = find_program('sdbus++', native: true)
28sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
William A. Kennington III4b604172022-09-20 13:13:54 -070029sdbusplusplus_depfiles = files()
30if sdbusplus_dep.type_name() == 'internal'
31 sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
32endif
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070033
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070034generated_sources = []
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070035generated_others = []
36yaml_sources = []
37subdir('gen')
38subdir('gen/xyz')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070039networkd_dbus_includes = include_directories('gen')
40
Patrick Williams3397be32022-03-21 09:52:57 -050041phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070042
43networkd_dbus_deps = [
44 phosphor_dbus_interfaces_dep,
45 sdbusplus_dep,
46]
47
48networkd_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
55generated_files_headers = []
56foreach 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
63endforeach
64
65networkd_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 III0a01b2a2021-05-13 18:38:57 -070070
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070071subdir('src')
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070072
73configure_file(
74 input: 'xyz.openbmc_project.Network.service.in',
75 output: 'xyz.openbmc_project.Network.service',
William A. Kennington III1e710d02021-05-24 13:35:44 -070076 configuration: {
77 'SYSTEMD_TARGET': 'multi-user.target',
78 'DEFAULT_BUSNAME': default_busname,
79 },
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070080 install: true,
81 install_dir: dependency('systemd').get_variable(
82 pkgconfig: 'systemdsystemunitdir'))
83
84configure_file(
85 input: 'xyz.openbmc_project.Network.conf.in',
86 output: 'xyz.openbmc_project.Network.conf',
William A. Kennington III1e710d02021-05-24 13:35:44 -070087 configuration: {'DEFAULT_BUSNAME': default_busname},
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070088 install: true,
89 install_dir: get_option('datadir') / 'dbus-1' / 'system.d')
90
91if not get_option('tests').disabled()
92 subdir('test')
93endif