blob: 47cee557c68c4239445bb1a3d7bbb84d3832db43 [file] [log] [blame]
Brad Bishop59061732019-10-07 15:48:37 -04001project(
2 'phosphor-hwmon',
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
Matt Spinler5e034af2020-06-24 15:21:53 -050015fmt = dependency('fmt')
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070016gmock = dependency('gmock')
17gtest = dependency('gtest', main: true)
Brad Bishop59061732019-10-07 15:48:37 -040018
19conf = configuration_data()
20conf.set_quoted('BUSNAME_PREFIX', get_option('busname-prefix'))
21conf.set_quoted('SENSOR_ROOT', get_option('sensor-root'))
22conf.set10('NEGATIVE_ERRNO_ON_FAIL', get_option('negative-errno-on-fail'))
23conf.set10('UPDATE_FUNCTIONAL_ON_FAIL', get_option('update-functional-on-fail'))
24
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070025sysfs_headers = include_directories('.')
Brad Bishop59061732019-10-07 15:48:37 -040026
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070027sysfs_deps = [
28 fmt,
29]
Brad Bishop59061732019-10-07 15:48:37 -040030
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070031sysfs_lib = static_library(
Brad Bishop59061732019-10-07 15:48:37 -040032 'sysfs',
33 'sysfs.cpp',
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070034 include_directories: sysfs_headers,
35 dependencies: sysfs_deps)
Brad Bishop59061732019-10-07 15:48:37 -040036
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070037sysfs_dep = declare_dependency(
38 dependencies: sysfs_deps,
39 include_directories: sysfs_headers,
40 link_with: sysfs_lib)
41
42hwmon_headers = include_directories('.')
43
44hwmon_deps = [
45 fmt,
46 dependency('gpioplus'),
47 dependency('phosphor-dbus-interfaces'),
48 dependency('phosphor-logging'),
49 dependency('sdbusplus'),
50 dependency('sdeventplus'),
51 dependency('stdplus'),
52 sysfs_dep,
53]
54
55hwmon_lib = static_library(
56 'hwmon',
57 'average.cpp',
58 configure_file(output: 'config.h', configuration: conf),
Brad Bishop59061732019-10-07 15:48:37 -040059 'env.cpp',
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070060 'fan_pwm.cpp',
Brad Bishop59061732019-10-07 15:48:37 -040061 'fan_speed.cpp',
62 'gpio_handle.cpp',
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070063 'hwmon.cpp',
64 'hwmonio.cpp',
Brad Bishop59061732019-10-07 15:48:37 -040065 'mainloop.cpp',
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070066 'sensor.cpp',
Brad Bishop59061732019-10-07 15:48:37 -040067 'sensorset.cpp',
William A. Kennington IIIf9aff802021-05-05 12:06:24 -070068 dependencies: hwmon_deps,
69 include_directories: hwmon_headers)
70
71hwmon_dep = declare_dependency(
72 dependencies: hwmon_deps,
73 include_directories: hwmon_headers,
74 link_with: hwmon_lib)
Brad Bishop59061732019-10-07 15:48:37 -040075
William A. Kennington IIId3e87942021-05-05 12:26:53 -070076# CLI11 might not have a pkg-config. It is header only so just make
77# sure we can access the needed symbols from the header.
78cli11_dep = dependency('cli11', required: false)
79has_cli11 = meson.get_compiler('cpp').has_header_symbol(
80 'CLI/CLI.hpp',
81 'CLI::App',
82 dependencies: cli11_dep,
83 required: false)
84if not has_cli11
85 cli11_proj = subproject('cli11', required: false)
86 assert(cli11_proj.found(), 'CLI11 is required')
87 cli11_dep = cli11_proj.get_variable('CLI11_dep')
88endif
89
Brad Bishop59061732019-10-07 15:48:37 -040090executable(
91 'phosphor-hwmon-readd',
92 'readd.cpp',
William A. Kennington IIId3e87942021-05-05 12:26:53 -070093 dependencies: [
94 cli11_dep,
95 hwmon_dep,
96 ],
97 install: true)
Brad Bishop59061732019-10-07 15:48:37 -040098
99subdir('msl')
100subdir('test')
101subdir('tools')