blob: 45212d5f66d717200b14bcd71c45a184d9fee6d2 [file] [log] [blame]
Brad Bishop39b370a2019-09-02 02:37:32 -04001project(
George Liu690e7802019-08-23 11:04:01 +08002 'phosphor-power',
Brad Bishop39b370a2019-09-02 02:37:32 -04003 'cpp',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
7 'cpp_std=c++17'
8 ],
9 license: 'Apache-2.0',
10 version: '1.0',
11)
12
13build_tests = get_option('tests')
14
15cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
16gmock = dependency('gmock', disabler: true, required: build_tests)
17gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
18openpower_dbus_interfaces = dependency('openpower-dbus-interfaces')
19phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
20phosphor_logging = dependency('phosphor-logging')
21prog_python = import('python').find_installation('python')
22sdbusplus = dependency('sdbusplus')
23sdbuspp = find_program('sdbus++')
24sdeventplus = dependency('sdeventplus')
25
Lei YUbd3bd822019-10-10 15:28:10 +080026systemd = dependency('systemd')
27servicedir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
28
29services = [
30 'power-supply-monitor@.service',
31 'pseq-monitor-pgood.service',
32 'pseq-monitor.service'
33]
34
35foreach service : services
36 configure_file(input: 'services/' + service,
37 output: service,
38 copy: true,
39 install_dir: servicedir)
40endforeach
41
Brad Bishop39b370a2019-09-02 02:37:32 -040042conf = configuration_data()
43conf.set_quoted(
44 'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root'))
45conf.set_quoted(
46 'INPUT_HISTORY_SENSOR_ROOT', get_option('input-history-sensor-root'))
George Liu690e7802019-08-23 11:04:01 +080047conf.set_quoted(
48 'PSU_JSON_PATH', '/usr/share/phosphor-power/psu.json')
Brad Bishop39b370a2019-09-02 02:37:32 -040049conf.set10(
50 'UCD90160_DEVICE_ACCESS', get_option('ucd90160-access'))
51
52configure_file(output: 'config.h', configuration: conf)
53
54# Ensure the generated header here winds up in the correct path in the build
55# tree such that it actually get used and doesn't get found in the sysroot
56# somewhere. Meson doesn't allow path elements (rightfully so) when specifying
57# the output filename of a target definition so the target must be defined in
58# the directory where the artifacts need to be placed. Do that now, because
59# the generated source (cpp) is needed to define the library target.
60subdir('org/open_power/Witherspoon/Fault')
61
62libpower = static_library(
63 'power',
64 error_cpp,
65 error_hpp,
66 'gpio.cpp',
67 'pmbus.cpp',
68 'utility.cpp',
69 dependencies: [
70 cppfs,
71 openpower_dbus_interfaces,
72 phosphor_dbus_interfaces,
73 phosphor_logging,
74 sdbusplus,
75 sdeventplus,
76 ],
77)
78
79subdir('power-sequencer')
80subdir('power-supply')
81subdir('test')