1project('phosphor-time-manager',
2        'cpp',
3         version: '0.1',
4         meson_version: '>=0.57.0',
5         default_options: [ 'warning_level=3',
6                            'werror=true',
7                            'cpp_std=c++20',
8                            'buildtype=debugoptimized' ])
9
10########################################################################
11
12# Project Links
13
14project_pretty_name = 'phosphor-time-manager'
15project_url = 'https://github.com/openbmc/' + project_pretty_name
16project_issues_url = project_url + '/issues/new'
17
18summary('Issue', project_issues_url, section : 'Report Issues')
19
20#####################################################################
21
22# Get Compiler and default build type
23
24compiler = meson.get_compiler('cpp')
25
26#########################################################################
27
28# Find the dependencies
29
30sdbusplus_dep = dependency ('sdbusplus')
31phosphor_logging_dep = dependency ('phosphor-logging')
32phosphor_dbus_interfaces_dep = dependency ('phosphor-dbus-interfaces')
33deps = [
34    sdbusplus_dep,
35    phosphor_logging_dep,
36    phosphor_dbus_interfaces_dep,
37]
38
39###########################################################################
40
41# Get the config data and enable options
42
43conf_data = configuration_data()
44conf_data.set('DEFAULT_TIME_MODE', get_option('default_time_mode'))
45
46configure_file(output: 'config.h', configuration: conf_data)
47
48
49############################################################################
50
51# Gather sources for the target binaries
52
53phosphor_time_manager_sources = [
54                                 'epoch_base.cpp',
55                                 'bmc_epoch.cpp',
56                                 'manager.cpp',
57                                 'utils.cpp',
58                                 'settings.cpp',
59                                 ]
60
61libtimemanager = static_library('libtimemanager',
62                                 phosphor_time_manager_sources,
63                                 dependencies : deps)
64############################################################################
65
66# Install the files into the build directory
67
68systemd = dependency ('systemd')
69systemd_system_unit_dir = systemd.get_variable(
70    pkgconfig : 'systemdsystemunitdir',
71    pkgconfig_define: ['prefix', get_option('prefix')])
72configure_file(input : 'xyz.openbmc_project.Time.Manager.service',
73               output : 'xyz.openbmc_project.Time.Manager.service',
74               copy : true,
75               install_dir : systemd_system_unit_dir)
76
77#############################################################################
78
79# Build binaries
80
81executable('phosphor-time-manager',
82           'main.cpp',
83           link_with : libtimemanager,
84           dependencies : deps,
85           install : true)
86
87if get_option('tests').enabled()
88    subdir('test')
89endif
90