blob: d0ac5ce492e05d1f6b2c4b58386456faf7fcd14c [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'))
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070022conf_data.set('SYNC_MAC_FROM_INVENTORY', get_option('sync-mac'))
Johnathan Mantey609c12d2022-02-03 09:23:09 -080023conf_data.set('PERSIST_MAC', get_option('persist-mac'))
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070024
Patrick Williams3397be32022-03-21 09:52:57 -050025sdbusplus_dep = dependency('sdbusplus')
26sdbusplusplus_prog = find_program('sdbus++', native: true)
27sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
William A. Kennington III4b604172022-09-20 13:13:54 -070028sdbusplusplus_depfiles = files()
29if sdbusplus_dep.type_name() == 'internal'
30 sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
31endif
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070032
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070033generated_sources = []
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070034generated_others = []
35yaml_sources = []
36subdir('gen')
37subdir('gen/xyz')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070038networkd_dbus_includes = include_directories('gen')
39
Patrick Williams3397be32022-03-21 09:52:57 -050040phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
William A. Kennington III37cf66c2021-05-17 14:56:54 -070041
42networkd_dbus_deps = [
43 phosphor_dbus_interfaces_dep,
44 sdbusplus_dep,
45]
46
47networkd_dbus_lib = static_library(
48 'networkd_dbus',
49 generated_sources,
50 implicit_include_directories: false,
51 include_directories: networkd_dbus_includes,
52 dependencies: networkd_dbus_deps)
53
54generated_files_headers = []
55foreach s : generated_sources
56 foreach f : s.to_list()
57 p = f.full_path()
58 if p.endswith('.hpp')
59 generated_files_headers += f
60 endif
61 endforeach
62endforeach
63
64networkd_dbus_dep = declare_dependency(
65 sources: generated_files_headers,
66 include_directories: networkd_dbus_includes,
67 link_with: networkd_dbus_lib,
68 dependencies: networkd_dbus_deps)
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070069
William A. Kennington III1bbe3d12021-05-13 23:45:09 -070070subdir('src')
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070071
72configure_file(
73 input: 'xyz.openbmc_project.Network.service.in',
74 output: 'xyz.openbmc_project.Network.service',
William A. Kennington III1e710d02021-05-24 13:35:44 -070075 configuration: {
76 'SYSTEMD_TARGET': 'multi-user.target',
77 'DEFAULT_BUSNAME': default_busname,
78 },
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070079 install: true,
80 install_dir: dependency('systemd').get_variable(
81 pkgconfig: 'systemdsystemunitdir'))
82
83configure_file(
84 input: 'xyz.openbmc_project.Network.conf.in',
85 output: 'xyz.openbmc_project.Network.conf',
William A. Kennington III1e710d02021-05-24 13:35:44 -070086 configuration: {'DEFAULT_BUSNAME': default_busname},
William A. Kennington III0a01b2a2021-05-13 18:38:57 -070087 install: true,
88 install_dir: get_option('datadir') / 'dbus-1' / 'system.d')
89
90if not get_option('tests').disabled()
91 subdir('test')
92endif