blob: beddf1c7acd10cc4f833cac181df5ef37e31226f [file] [log] [blame]
Patrick Williams76ca53e2025-03-03 11:08:20 -05001project(
2 'phosphor-time-manager',
3 'cpp',
4 version: '0.1',
5 meson_version: '>=1.1.1',
6 default_options: [
7 'warning_level=3',
8 'werror=true',
9 'cpp_std=c++23',
10 'buildtype=debugoptimized',
11 ],
12)
Ratan Gupta8af2a892021-02-02 05:48:18 -060013
14########################################################################
15
16# Project Links
17
18project_pretty_name = 'phosphor-time-manager'
19project_url = 'https://github.com/openbmc/' + project_pretty_name
20project_issues_url = project_url + '/issues/new'
21
Patrick Williams76ca53e2025-03-03 11:08:20 -050022summary('Issue', project_issues_url, section: 'Report Issues')
Ratan Gupta8af2a892021-02-02 05:48:18 -060023
24#####################################################################
25
Ratan Gupta8af2a892021-02-02 05:48:18 -060026# Get Compiler and default build type
27
28compiler = meson.get_compiler('cpp')
29
30#########################################################################
31
32# Find the dependencies
33
Patrick Williams76ca53e2025-03-03 11:08:20 -050034sdbusplus_dep = dependency('sdbusplus')
35phosphor_logging_dep = dependency('phosphor-logging')
36phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
37deps = [sdbusplus_dep, phosphor_logging_dep, phosphor_dbus_interfaces_dep]
Ratan Gupta8af2a892021-02-02 05:48:18 -060038
39###########################################################################
40
41# Get the config data and enable options
42
43conf_data = configuration_data()
Ratan Gupta8af2a892021-02-02 05:48:18 -060044conf_data.set('DEFAULT_TIME_MODE', get_option('default_time_mode'))
Patrick Williams76ca53e2025-03-03 11:08:20 -050045conf_data.set_quoted(
46 'DEFAULT_TIME_SYNC_OBJECT_PATH',
47 get_option('default_time_sync_object_path'),
48)
Ratan Gupta8af2a892021-02-02 05:48:18 -060049
50configure_file(output: 'config.h', configuration: conf_data)
51
52
53############################################################################
54
55# Gather sources for the target binaries
56
57phosphor_time_manager_sources = [
Patrick Williams76ca53e2025-03-03 11:08:20 -050058 'bmc_epoch.cpp',
59 'manager.cpp',
60 'utils.cpp',
61 'settings.cpp',
62]
Ratan Gupta8af2a892021-02-02 05:48:18 -060063
Patrick Williams76ca53e2025-03-03 11:08:20 -050064libtimemanager = static_library(
65 'libtimemanager',
66 phosphor_time_manager_sources,
67 dependencies: deps,
68)
Ratan Gupta8af2a892021-02-02 05:48:18 -060069############################################################################
70
Ratan Guptaf901e9c2021-02-03 09:04:59 +053071# Install the files into the build directory
72
Patrick Williams76ca53e2025-03-03 11:08:20 -050073systemd = dependency('systemd')
Pavithra Barithaya667563c2022-08-01 07:25:35 -050074systemd_system_unit_dir = systemd.get_variable(
Patrick Williams4c5143f2023-04-12 08:01:11 -050075 'systemdsystemunitdir',
Patrick Williams76ca53e2025-03-03 11:08:20 -050076 pkgconfig_define: ['prefix', get_option('prefix')],
77)
Manojkiran Eda83a3bfe2023-07-27 05:30:37 +053078
79filesystem = import('fs')
Patrick Williams76ca53e2025-03-03 11:08:20 -050080filesystem.copyfile(
81 'xyz.openbmc_project.Time.Manager.service',
82 install: true,
83 install_dir: systemd_system_unit_dir,
84)
Ratan Guptaf901e9c2021-02-03 09:04:59 +053085
86#############################################################################
87
Ratan Gupta8af2a892021-02-02 05:48:18 -060088# Build binaries
89
Patrick Williams76ca53e2025-03-03 11:08:20 -050090executable(
91 'phosphor-time-manager',
92 'main.cpp',
93 link_with: libtimemanager,
94 dependencies: deps,
95 install: true,
96)
Ratan Gupta8af2a892021-02-02 05:48:18 -060097
Patrick Williams31ca09a2023-11-29 06:44:26 -060098if get_option('tests').allowed()
Ratan Gupta8af2a892021-02-02 05:48:18 -060099 subdir('test')
100endif