blob: 0962ee5a4bf40c1fa745d59a20d6b6c35d96c264 [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
26sdbusplus_dep = dependency('sdbusplus', required: false)
William A. Kennington III37cf66c2021-05-17 14:56:54 -070027if sdbusplus_dep.found() and sdbusplus_dep.type_name() != 'internal'
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070028 sdbusplusplus_prog = find_program('sdbus++', native: true)
29 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
30else
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')
35endif
36
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070037generated_sources = []
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070038generated_others = []
39yaml_sources = []
40subdir('gen')
41subdir('gen/xyz')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070042networkd_dbus_includes = include_directories('gen')
43
44phosphor_dbus_interfaces_dep = dependency(
45 'phosphor-dbus-interfaces',
46 fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'])
47
48networkd_dbus_deps = [
49 phosphor_dbus_interfaces_dep,
50 sdbusplus_dep,
51]
52
53networkd_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
60generated_files_headers = []
61foreach 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
68endforeach
69
70networkd_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 III0a01b2a2021-05-13 18:38:57 -070075
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070076subdir('src')
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070077
78configure_file(
79 input: 'xyz.openbmc_project.Network.service.in',
80 output: 'xyz.openbmc_project.Network.service',
William A. Kennington III1e710d02021-05-24 13:35:44 -070081 configuration: {
82 'SYSTEMD_TARGET': 'multi-user.target',
83 'DEFAULT_BUSNAME': default_busname,
84 },
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070085 install: true,
86 install_dir: dependency('systemd').get_variable(
87 pkgconfig: 'systemdsystemunitdir'))
88
89configure_file(
90 input: 'xyz.openbmc_project.Network.conf.in',
91 output: 'xyz.openbmc_project.Network.conf',
William A. Kennington III1e710d02021-05-24 13:35:44 -070092 configuration: {'DEFAULT_BUSNAME': default_busname},
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070093 install: true,
94 install_dir: get_option('datadir') / 'dbus-1' / 'system.d')
95
96if not get_option('tests').disabled()
97 subdir('test')
98endif