blob: 90ce1614138931bf41ff2d12f34ff06f35a26474 [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',
Patrick Williams8b8f6062021-08-27 14:53:50 -050066 dependencies: [ sdbusplus, nlohmann_json ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050067 implicit_include_directories: false,
68 include_directories: 'include',
69)
70
Patrick Williams8b8f6062021-08-27 14:53:50 -050071thresholds_dep = declare_dependency(
72 link_with: [ thresholds_a ],
73 dependencies: [ nlohmann_json ],
74)
75
Brad Bishopfeb19ef2019-11-07 18:02:16 -050076utils_a = static_library(
77 'utils_a',
Ed Tanous6cb732a2021-02-18 15:33:51 -080078 ['src/Utils.cpp', 'src/SensorPaths.cpp'],
Andrew Jeffery8ed93af2021-05-27 13:45:38 +093079 dependencies: [ sdbusplus ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050080 implicit_include_directories: false,
81 include_directories: 'include',
82)
83
Patrick Williams8b8f6062021-08-27 14:53:50 -050084utils_dep = declare_dependency(
85 link_with: [ utils_a ],
86 dependencies: [ sdbusplus ],
87)
88
Brad Bishopfeb19ef2019-11-07 18:02:16 -050089pwmsensor_a = static_library(
90 'pwmsensor_a',
91 'src/PwmSensor.cpp',
Patrick Williams8b8f6062021-08-27 14:53:50 -050092 dependencies: [ sdbusplus, thresholds_dep ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050093 implicit_include_directories: false,
94 include_directories: 'include',
95)
96
Patrick Williams8b8f6062021-08-27 14:53:50 -050097pwmsensor_dep = declare_dependency(
98 link_with: [ pwmsensor_a ],
99 dependencies: [ sdbusplus, thresholds_dep ],
100)
101
Bruce Lee1263c3d2021-06-04 15:16:33 +0800102subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500103subdir('service_files')
104subdir('src')
105
106if not build_tests.disabled()
107 subdir('tests')
108endif