blob: d44ef75e2bdf81cd963551271ea3bd46665a7381 [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',
Matthew Barthd13feab2019-12-20 14:09:19 -06007 'cpp_std=c++17',
8 'prefix=/usr'
Brad Bishop39b370a2019-09-02 02:37:32 -04009 ],
10 license: 'Apache-2.0',
11 version: '1.0',
12)
13
14build_tests = get_option('tests')
15
16cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
17gmock = dependency('gmock', disabler: true, required: build_tests)
18gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Brad Bishop39b370a2019-09-02 02:37:32 -040019phosphor_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')
Cheng C Yange83604b2020-01-09 09:41:47 +080025pthread = dependency('threads')
Brad Bishop39b370a2019-09-02 02:37:32 -040026
Lei YUbd3bd822019-10-10 15:28:10 +080027systemd = dependency('systemd')
28servicedir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
29
30services = [
31 'power-supply-monitor@.service',
32 'pseq-monitor-pgood.service',
Brandon Wymanbd1c4ff2020-01-14 14:09:56 -060033 'pseq-monitor.service',
34 'phosphor-psu-monitor.service'
Lei YUbd3bd822019-10-10 15:28:10 +080035]
36
37foreach service : services
38 configure_file(input: 'services/' + service,
39 output: service,
40 copy: true,
41 install_dir: servicedir)
42endforeach
43
Brad Bishop39b370a2019-09-02 02:37:32 -040044conf = configuration_data()
45conf.set_quoted(
46 'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root'))
47conf.set_quoted(
48 'INPUT_HISTORY_SENSOR_ROOT', get_option('input-history-sensor-root'))
George Liu690e7802019-08-23 11:04:01 +080049conf.set_quoted(
50 'PSU_JSON_PATH', '/usr/share/phosphor-power/psu.json')
Brad Bishop39b370a2019-09-02 02:37:32 -040051conf.set10(
52 'UCD90160_DEVICE_ACCESS', get_option('ucd90160-access'))
53
54configure_file(output: 'config.h', configuration: conf)
55
56# Ensure the generated header here winds up in the correct path in the build
57# tree such that it actually get used and doesn't get found in the sysroot
58# somewhere. Meson doesn't allow path elements (rightfully so) when specifying
59# the output filename of a target definition so the target must be defined in
60# the directory where the artifacts need to be placed. Do that now, because
61# the generated source (cpp) is needed to define the library target.
62subdir('org/open_power/Witherspoon/Fault')
63
64libpower = static_library(
65 'power',
66 error_cpp,
67 error_hpp,
68 'gpio.cpp',
69 'pmbus.cpp',
70 'utility.cpp',
71 dependencies: [
72 cppfs,
Brad Bishop39b370a2019-09-02 02:37:32 -040073 phosphor_dbus_interfaces,
74 phosphor_logging,
75 sdbusplus,
76 sdeventplus,
77 ],
78)
79
Lei YU7c2fbbb2019-11-06 14:56:02 +080080libpower_inc = include_directories('.')
81
Shawn McCarney4c94bc72019-12-13 17:49:31 -060082# Build the tools/i2c sub-directory first. Other sub-directories depend on
83# Meson variables defined there.
84subdir('tools/i2c')
85
Shawn McCarneya2461b32019-10-24 18:53:01 -050086subdir('phosphor-regulators')
Brad Bishop39b370a2019-09-02 02:37:32 -040087subdir('power-sequencer')
88subdir('power-supply')
Brandon Wyman2ad76bd2019-08-26 17:15:04 -050089subdir('phosphor-power-supply')
Lei YU0bf1b782019-08-29 16:02:30 +080090subdir('tools/power-utils')
Brad Bishop39b370a2019-09-02 02:37:32 -040091subdir('test')
Cheng C Yange83604b2020-01-09 09:41:47 +080092subdir('cold-redundancy')