Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 1 | project('phosphor-time-manager', |
| 2 | 'cpp', |
| 3 | version: '0.1', |
| 4 | meson_version: '>=0.53.2', |
| 5 | default_options: [ 'warning_level=3', |
| 6 | 'werror=true', |
| 7 | 'cpp_std=c++17', |
| 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 | |
| 22 | # Validate the c++ Standard |
| 23 | |
| 24 | if get_option('cpp_std') != 'c++17' |
| 25 | error('This project requires cpp std to be in c++17 mode') |
| 26 | endif |
| 27 | |
| 28 | ######################################################################### |
| 29 | |
| 30 | # Get Compiler and default build type |
| 31 | |
| 32 | compiler = meson.get_compiler('cpp') |
| 33 | |
| 34 | ######################################################################### |
| 35 | |
| 36 | # Find the dependencies |
| 37 | |
| 38 | sdbusplus = dependency ('sdbusplus') |
| 39 | logging = dependency ('phosphor-logging') |
| 40 | dbus = dependency ('phosphor-dbus-interfaces') |
| 41 | deps = [sdbusplus, logging, dbus] |
| 42 | |
| 43 | ########################################################################### |
| 44 | |
| 45 | # Get the config data and enable options |
| 46 | |
| 47 | conf_data = configuration_data() |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 48 | conf_data.set('DEFAULT_TIME_MODE', get_option('default_time_mode')) |
| 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 = [ |
| 58 | 'epoch_base.cpp', |
| 59 | 'bmc_epoch.cpp', |
| 60 | 'manager.cpp', |
| 61 | 'utils.cpp', |
| 62 | 'settings.cpp', |
| 63 | ] |
| 64 | |
| 65 | libtimemanager = static_library('libtimemanager', |
| 66 | phosphor_time_manager_sources, |
| 67 | dependencies : deps) |
| 68 | ############################################################################ |
| 69 | |
Ratan Gupta | f901e9c | 2021-02-03 09:04:59 +0530 | [diff] [blame] | 70 | # Install the files into the build directory |
| 71 | |
| 72 | systemd = dependency ('systemd') |
| 73 | systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir', |
| 74 | define_variable: ['prefix', |
| 75 | get_option('prefix') |
| 76 | ]) |
| 77 | configure_file(input : 'xyz.openbmc_project.Time.Manager.service', |
| 78 | output : 'xyz.openbmc_project.Time.Manager.service', |
| 79 | copy : true, |
| 80 | install_dir : systemd_system_unit_dir) |
| 81 | |
| 82 | ############################################################################# |
| 83 | |
Ratan Gupta | 8af2a89 | 2021-02-02 05:48:18 -0600 | [diff] [blame] | 84 | # Build binaries |
| 85 | |
| 86 | executable('phosphor-time-manager', |
| 87 | 'main.cpp', |
| 88 | link_with : libtimemanager, |
| 89 | dependencies : deps, |
| 90 | install : true) |
| 91 | |
| 92 | if get_option('tests').enabled() |
| 93 | subdir('test') |
| 94 | endif |