1project(
2    'witherspoon-pfault-analysis',
3    'cpp',
4    default_options: [
5        'warning_level=3',
6        'werror=true',
7        'cpp_std=c++20'
8    ],
9    license: 'Apache-2.0',
10    version: '1.0',
11    meson_version: '>=0.57.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)
19phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
20phosphor_logging = dependency('phosphor-logging')
21prog_python = import('python').find_installation('python3')
22sdbusplus = dependency('sdbusplus')
23sdbuspp = find_program('sdbus++')
24sdeventplus = dependency('sdeventplus')
25
26conf = configuration_data()
27conf.set_quoted(
28    'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root'))
29conf.set_quoted(
30    'INPUT_HISTORY_SENSOR_ROOT', get_option('input-history-sensor-root'))
31conf.set10(
32    'UCD90160_DEVICE_ACCESS', get_option('ucd90160-access'))
33
34configure_file(output: 'config.h', configuration: conf)
35
36# Ensure the generated header here winds up in the correct path in the build
37# tree such that it actually get used and doesn't get found in the sysroot
38# somewhere.  Meson doesn't allow path elements (rightfully so) when specifying
39# the output filename of a target definition so the target must be defined in
40# the directory where the artifacts need to be placed.  Do that now, because
41# the generated source (cpp) is needed to define the library target.
42subdir('org/open_power/Witherspoon/Fault')
43
44libpower = static_library(
45    'power',
46    error_cpp,
47    error_hpp,
48    'gpio.cpp',
49    'pmbus.cpp',
50    'utility.cpp',
51    dependencies: [
52        cppfs,
53        phosphor_dbus_interfaces,
54        phosphor_logging,
55        sdbusplus,
56        sdeventplus,
57    ],
58)
59
60subdir('power-sequencer')
61subdir('power-supply')
62subdir('test')
63