Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 1 | project( |
George Liu | 690e780 | 2019-08-23 11:04:01 +0800 | [diff] [blame] | 2 | 'phosphor-power', |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 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 | |
| 13 | build_tests = get_option('tests') |
| 14 | |
| 15 | cppfs = meson.get_compiler('cpp').find_library('stdc++fs') |
| 16 | gmock = dependency('gmock', disabler: true, required: build_tests) |
| 17 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 18 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
| 19 | phosphor_logging = dependency('phosphor-logging') |
| 20 | prog_python = import('python').find_installation('python') |
| 21 | sdbusplus = dependency('sdbusplus') |
| 22 | sdbuspp = find_program('sdbus++') |
| 23 | sdeventplus = dependency('sdeventplus') |
Cheng C Yang | e83604b | 2020-01-09 09:41:47 +0800 | [diff] [blame] | 24 | pthread = dependency('threads') |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 25 | |
Lei YU | bd3bd82 | 2019-10-10 15:28:10 +0800 | [diff] [blame] | 26 | systemd = dependency('systemd') |
| 27 | servicedir = systemd.get_pkgconfig_variable('systemdsystemunitdir') |
| 28 | |
| 29 | services = [ |
| 30 | 'power-supply-monitor@.service', |
| 31 | 'pseq-monitor-pgood.service', |
| 32 | 'pseq-monitor.service' |
| 33 | ] |
| 34 | |
| 35 | foreach service : services |
| 36 | configure_file(input: 'services/' + service, |
| 37 | output: service, |
| 38 | copy: true, |
| 39 | install_dir: servicedir) |
| 40 | endforeach |
| 41 | |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 42 | conf = configuration_data() |
| 43 | conf.set_quoted( |
| 44 | 'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root')) |
| 45 | conf.set_quoted( |
| 46 | 'INPUT_HISTORY_SENSOR_ROOT', get_option('input-history-sensor-root')) |
George Liu | 690e780 | 2019-08-23 11:04:01 +0800 | [diff] [blame] | 47 | conf.set_quoted( |
| 48 | 'PSU_JSON_PATH', '/usr/share/phosphor-power/psu.json') |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 49 | conf.set10( |
| 50 | 'UCD90160_DEVICE_ACCESS', get_option('ucd90160-access')) |
| 51 | |
| 52 | configure_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. |
| 60 | subdir('org/open_power/Witherspoon/Fault') |
| 61 | |
| 62 | libpower = static_library( |
| 63 | 'power', |
| 64 | error_cpp, |
| 65 | error_hpp, |
| 66 | 'gpio.cpp', |
| 67 | 'pmbus.cpp', |
| 68 | 'utility.cpp', |
| 69 | dependencies: [ |
| 70 | cppfs, |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 71 | phosphor_dbus_interfaces, |
| 72 | phosphor_logging, |
| 73 | sdbusplus, |
| 74 | sdeventplus, |
| 75 | ], |
| 76 | ) |
| 77 | |
Lei YU | 7c2fbbb | 2019-11-06 14:56:02 +0800 | [diff] [blame] | 78 | libpower_inc = include_directories('.') |
| 79 | |
Shawn McCarney | 4c94bc7 | 2019-12-13 17:49:31 -0600 | [diff] [blame] | 80 | # Build the tools/i2c sub-directory first. Other sub-directories depend on |
| 81 | # Meson variables defined there. |
| 82 | subdir('tools/i2c') |
| 83 | |
Shawn McCarney | a2461b3 | 2019-10-24 18:53:01 -0500 | [diff] [blame] | 84 | subdir('phosphor-regulators') |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 85 | subdir('power-sequencer') |
| 86 | subdir('power-supply') |
Brandon Wyman | 2ad76bd | 2019-08-26 17:15:04 -0500 | [diff] [blame] | 87 | subdir('phosphor-power-supply') |
Lei YU | 0bf1b78 | 2019-08-29 16:02:30 +0800 | [diff] [blame] | 88 | subdir('tools/power-utils') |
Brad Bishop | 39b370a | 2019-09-02 02:37:32 -0400 | [diff] [blame] | 89 | subdir('test') |
Cheng C Yang | e83604b | 2020-01-09 09:41:47 +0800 | [diff] [blame] | 90 | subdir('cold-redundancy') |