Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 1 | project('phosphor-time-manager', |
| 2 | 'cpp', |
| 3 | version: '0.1', |
Patrick Williams | 4f0dfa2 | 2023-07-17 10:07:07 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 5 | default_options: [ 'warning_level=3', |
| 6 | 'werror=true', |
Patrick Williams | 4f0dfa2 | 2023-07-17 10:07:07 -0500 | [diff] [blame] | 7 | 'cpp_std=c++23', |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 8 | 'buildtype=debugoptimized' ]) |
| 9 | |
| 10 | ######################################################################## |
| 11 | |
| 12 | # Project Links |
| 13 | |
| 14 | project_pretty_name = 'phosphor-time-manager' |
| 15 | project_url = 'https://github.com/openbmc/' + project_pretty_name |
| 16 | project_issues_url = project_url + '/issues/new' |
| 17 | |
| 18 | summary('Issue', project_issues_url, section : 'Report Issues') |
| 19 | |
| 20 | ##################################################################### |
| 21 | |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 22 | # Get Compiler and default build type |
| 23 | |
| 24 | compiler = meson.get_compiler('cpp') |
| 25 | |
| 26 | ######################################################################### |
| 27 | |
| 28 | # Find the dependencies |
| 29 | |
George Liu | 0fb8ed4 | 2022-07-01 16:21:59 +0800 | [diff] [blame] | 30 | sdbusplus_dep = dependency ('sdbusplus') |
| 31 | phosphor_logging_dep = dependency ('phosphor-logging') |
| 32 | phosphor_dbus_interfaces_dep = dependency ('phosphor-dbus-interfaces') |
| 33 | deps = [ |
| 34 | sdbusplus_dep, |
| 35 | phosphor_logging_dep, |
| 36 | phosphor_dbus_interfaces_dep, |
| 37 | ] |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 38 | |
| 39 | ########################################################################### |
| 40 | |
| 41 | # Get the config data and enable options |
| 42 | |
| 43 | conf_data = configuration_data() |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 44 | conf_data.set('DEFAULT_TIME_MODE', get_option('default_time_mode')) |
Lei YU | 3afad18 | 2023-07-18 13:41:30 +0800 | [diff] [blame] | 45 | conf_data.set_quoted('DEFAULT_TIME_SYNC_OBJECT_PATH', get_option('default_time_sync_object_path')) |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 46 | |
| 47 | configure_file(output: 'config.h', configuration: conf_data) |
| 48 | |
| 49 | |
| 50 | ############################################################################ |
| 51 | |
| 52 | # Gather sources for the target binaries |
| 53 | |
| 54 | phosphor_time_manager_sources = [ |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 55 | 'bmc_epoch.cpp', |
| 56 | 'manager.cpp', |
| 57 | 'utils.cpp', |
| 58 | 'settings.cpp', |
| 59 | ] |
| 60 | |
| 61 | libtimemanager = static_library('libtimemanager', |
| 62 | phosphor_time_manager_sources, |
| 63 | dependencies : deps) |
| 64 | ############################################################################ |
| 65 | |
Ratan Gupta | f901e9c | 2021-02-03 09:04:59 +0530 | [diff] [blame] | 66 | # Install the files into the build directory |
| 67 | |
| 68 | systemd = dependency ('systemd') |
Pavithra Barithaya | 667563c | 2022-08-01 07:25:35 -0500 | [diff] [blame] | 69 | systemd_system_unit_dir = systemd.get_variable( |
Patrick Williams | 4c5143f | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 70 | 'systemdsystemunitdir', |
Pavithra Barithaya | 667563c | 2022-08-01 07:25:35 -0500 | [diff] [blame] | 71 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Manojkiran Eda | 83a3bfe | 2023-07-27 05:30:37 +0530 | [diff] [blame] | 72 | |
| 73 | filesystem = import('fs') |
| 74 | filesystem.copyfile('xyz.openbmc_project.Time.Manager.service', |
| 75 | install: true, |
| 76 | install_dir: systemd_system_unit_dir) |
Ratan Gupta | f901e9c | 2021-02-03 09:04:59 +0530 | [diff] [blame] | 77 | |
| 78 | ############################################################################# |
| 79 | |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 80 | # Build binaries |
| 81 | |
| 82 | executable('phosphor-time-manager', |
| 83 | 'main.cpp', |
| 84 | link_with : libtimemanager, |
| 85 | dependencies : deps, |
| 86 | install : true) |
| 87 | |
Patrick Williams | 31ca09a | 2023-11-29 06:44:26 -0600 | [diff] [blame] | 88 | if get_option('tests').allowed() |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 89 | subdir('test') |
| 90 | endif |