blob: 6c55635ffb17f4c8e987aef2db594f45121d45fa [file] [log] [blame]
Brad Bishopfeb19ef2019-11-07 18:02:16 -05001project(
2 'dbus-sensors',
3 'cpp',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
Andrew Jefferyfbf92542021-05-27 15:00:47 +09307 'cpp_std=c++20'
Brad Bishopfeb19ef2019-11-07 18:02:16 -05008 ],
9 license: 'Apache-2.0',
10 version: '0.1',
Andrew Jefferyfbf92542021-05-27 15:00:47 +093011 meson_version: '>=0.57.0',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050012)
13
14add_project_arguments(
15 '-DBOOST_SYSTEM_NO_DEPRECATED',
16 '-DBOOST_ERROR_CODE_HEADER_ONLY',
17 '-DBOOST_NO_RTTI',
18 '-DBOOST_NO_TYPEID',
19 '-DBOOST_ALL_NO_LIB',
20 '-DBOOST_ASIO_DISABLE_THREADS',
21 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
22 language: 'cpp',
23)
24
Patrick Williams1889ebf2021-08-27 14:38:52 -050025cpp = meson.get_compiler('cpp')
26
Brad Bishopfeb19ef2019-11-07 18:02:16 -050027build_tests = get_option('tests')
Patrick Williams3911b822021-08-27 14:31:50 -050028gpiodcxx = dependency(
29 'libgpiodcxx',
30 fallback: ['libgpiod', 'gpiodcxx_dep'],
31 default_options: ['bindings=cxx'],
32)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093033
34# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050035i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093036
Andrew Jeffery3f2e0522021-05-27 13:26:20 +093037sdbusplus = dependency(
38 'sdbusplus',
39 fallback: [
40 'sdbusplus',
41 'sdbusplus_dep'
42 ],
43)
44
Patrick Williams1889ebf2021-08-27 14:38:52 -050045if cpp.has_header('nlohmann/json.hpp')
46 nlohmann_json = declare_dependency()
47else
48 subproject('nlohmann-json')
49 nlohmann_json = declare_dependency(
50 include_directories: include_directories(
51 'subprojects/nlohmann-json/single_include',
52 'subprojects/nlohmann-json/single_include/nlohmann',
53 )
54 )
55endif
56
Brad Bishopfeb19ef2019-11-07 18:02:16 -050057systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093058systemd_system_unit_dir = systemd.get_variable(
59 pkgconfig: 'systemdsystemunitdir',
60 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050061threads = dependency('threads')
62
63thresholds_a = static_library(
64 'thresholds_a',
65 'src/Thresholds.cpp',
Andrew Jeffery8ed93af2021-05-27 13:45:38 +093066 dependencies: [ sdbusplus ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050067 implicit_include_directories: false,
68 include_directories: 'include',
69)
70
71utils_a = static_library(
72 'utils_a',
Ed Tanous6cb732a2021-02-18 15:33:51 -080073 ['src/Utils.cpp', 'src/SensorPaths.cpp'],
Andrew Jeffery8ed93af2021-05-27 13:45:38 +093074 dependencies: [ sdbusplus ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050075 implicit_include_directories: false,
76 include_directories: 'include',
77)
78
79pwmsensor_a = static_library(
80 'pwmsensor_a',
81 'src/PwmSensor.cpp',
Andrew Jeffery8ed93af2021-05-27 13:45:38 +093082 dependencies: [ sdbusplus ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050083 implicit_include_directories: false,
84 include_directories: 'include',
85)
86
Bruce Lee1263c3d2021-06-04 15:16:33 +080087subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -050088subdir('service_files')
89subdir('src')
90
91if not build_tests.disabled()
92 subdir('tests')
93endif