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