xref: /openbmc/phosphor-power/meson.build (revision 386d33fff72fadce4df1394f1a283d4e5c5f118c)
1project(
2    'phosphor-power',
3    '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')
25pthread = dependency('threads')
26
27systemd = dependency('systemd')
28servicedir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
29
30services = [
31    'power-supply-monitor@.service',
32    'pseq-monitor-pgood.service',
33    'pseq-monitor.service'
34]
35
36foreach service : services
37  configure_file(input: 'services/' + service,
38                 output: service,
39                 copy: true,
40                 install_dir: servicedir)
41endforeach
42
43conf = configuration_data()
44conf.set_quoted(
45    'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root'))
46conf.set_quoted(
47    'INPUT_HISTORY_SENSOR_ROOT', get_option('input-history-sensor-root'))
48conf.set_quoted(
49    'PSU_JSON_PATH', '/usr/share/phosphor-power/psu.json')
50conf.set10(
51    'UCD90160_DEVICE_ACCESS', get_option('ucd90160-access'))
52
53configure_file(output: 'config.h', configuration: conf)
54
55# Ensure the generated header here winds up in the correct path in the build
56# tree such that it actually get used and doesn't get found in the sysroot
57# somewhere.  Meson doesn't allow path elements (rightfully so) when specifying
58# the output filename of a target definition so the target must be defined in
59# the directory where the artifacts need to be placed.  Do that now, because
60# the generated source (cpp) is needed to define the library target.
61subdir('org/open_power/Witherspoon/Fault')
62
63libpower = static_library(
64    'power',
65    error_cpp,
66    error_hpp,
67    'gpio.cpp',
68    'pmbus.cpp',
69    'utility.cpp',
70    dependencies: [
71        cppfs,
72        openpower_dbus_interfaces,
73        phosphor_dbus_interfaces,
74        phosphor_logging,
75        sdbusplus,
76        sdeventplus,
77    ],
78)
79
80libpower_inc = include_directories('.')
81
82# Build the tools/i2c sub-directory first.  Other sub-directories depend on
83# Meson variables defined there.
84subdir('tools/i2c')
85
86subdir('phosphor-regulators')
87subdir('power-sequencer')
88subdir('power-supply')
89subdir('tools/power-utils')
90subdir('test')
91subdir('cold-redundancy')
92