blob: 51125620aae73336ed1a824dfd39761cabb8648d [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'))
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070024
25sdbusplus_dep = dependency('sdbusplus', required: false)
William A. Kennington III37cf66c2021-05-17 14:56:54 -070026if sdbusplus_dep.found() and sdbusplus_dep.type_name() != 'internal'
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070027 sdbusplusplus_prog = find_program('sdbus++', native: true)
28 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
29else
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')
34endif
35
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070036generated_sources = []
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070037generated_others = []
38yaml_sources = []
39subdir('gen')
40subdir('gen/xyz')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070041networkd_dbus_includes = include_directories('gen')
42
43phosphor_dbus_interfaces_dep = dependency(
44 'phosphor-dbus-interfaces',
45 fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'])
46
47networkd_dbus_deps = [
48 phosphor_dbus_interfaces_dep,
49 sdbusplus_dep,
50]
51
52networkd_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
59generated_files_headers = []
60foreach 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
67endforeach
68
69networkd_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 III0a01b2a2021-05-13 18:38:57 -070074
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070075subdir('src')
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070076
77configure_file(
78 input: 'xyz.openbmc_project.Network.service.in',
79 output: 'xyz.openbmc_project.Network.service',
William A. Kennington III1e710d02021-05-24 13:35:44 -070080 configuration: {
81 'SYSTEMD_TARGET': 'multi-user.target',
82 'DEFAULT_BUSNAME': default_busname,
83 },
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070084 install: true,
85 install_dir: dependency('systemd').get_variable(
86 pkgconfig: 'systemdsystemunitdir'))
87
88configure_file(
89 input: 'xyz.openbmc_project.Network.conf.in',
90 output: 'xyz.openbmc_project.Network.conf',
William A. Kennington III1e710d02021-05-24 13:35:44 -070091 configuration: {'DEFAULT_BUSNAME': default_busname},
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070092 install: true,
93 install_dir: get_option('datadir') / 'dbus-1' / 'system.d')
94
95if not get_option('tests').disabled()
96 subdir('test')
97endif