xref: /openbmc/phosphor-hwmon/meson.build (revision f9aff805)
1project(
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
15fmt = dependency('fmt')
16gmock = dependency('gmock')
17gtest = dependency('gtest', main: true)
18
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
25sysfs_headers = include_directories('.')
26
27sysfs_deps = [
28    fmt,
29]
30
31sysfs_lib = static_library(
32    'sysfs',
33    'sysfs.cpp',
34    include_directories: sysfs_headers,
35    dependencies: sysfs_deps)
36
37sysfs_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),
59    'env.cpp',
60    'fan_pwm.cpp',
61    'fan_speed.cpp',
62    'gpio_handle.cpp',
63    'hwmon.cpp',
64    'hwmonio.cpp',
65    'mainloop.cpp',
66    'sensor.cpp',
67    'sensorset.cpp',
68    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)
75
76executable(
77    'phosphor-hwmon-readd',
78    'readd.cpp',
79    dependencies: hwmon_dep,
80    install: true,
81)
82
83subdir('msl')
84subdir('test')
85subdir('tools')
86