blob: 05485969e0c254c432386d66babb4fc72c2ad670 [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 Williams08d684a2021-08-27 15:15:34 -050045phosphor_logging_dep = dependency(
46 'phosphor-logging',
47 fallback: ['phosphor-logging', 'phosphor_logging_dep'],
48)
49
Patrick Williams1889ebf2021-08-27 14:38:52 -050050if cpp.has_header('nlohmann/json.hpp')
51 nlohmann_json = declare_dependency()
52else
53 subproject('nlohmann-json')
54 nlohmann_json = declare_dependency(
55 include_directories: include_directories(
56 'subprojects/nlohmann-json/single_include',
57 'subprojects/nlohmann-json/single_include/nlohmann',
58 )
59 )
60endif
61
Brad Bishopfeb19ef2019-11-07 18:02:16 -050062systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093063systemd_system_unit_dir = systemd.get_variable(
64 pkgconfig: 'systemdsystemunitdir',
65 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050066threads = dependency('threads')
67
Patrick Williams302a61a2021-08-27 15:40:08 -050068default_deps = [
69 nlohmann_json,
70 sdbusplus,
71]
72
Brad Bishopfeb19ef2019-11-07 18:02:16 -050073thresholds_a = static_library(
74 'thresholds_a',
75 'src/Thresholds.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -050076 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -050077 implicit_include_directories: false,
78 include_directories: 'include',
79)
80
Patrick Williams8b8f6062021-08-27 14:53:50 -050081thresholds_dep = declare_dependency(
82 link_with: [ thresholds_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -050083 dependencies: default_deps,
Patrick Williams8b8f6062021-08-27 14:53:50 -050084)
85
Brad Bishopfeb19ef2019-11-07 18:02:16 -050086utils_a = static_library(
87 'utils_a',
Ed Tanous6cb732a2021-02-18 15:33:51 -080088 ['src/Utils.cpp', 'src/SensorPaths.cpp'],
Patrick Williams302a61a2021-08-27 15:40:08 -050089 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -050090 implicit_include_directories: false,
91 include_directories: 'include',
92)
93
Patrick Williams8b8f6062021-08-27 14:53:50 -050094utils_dep = declare_dependency(
95 link_with: [ utils_a ],
96 dependencies: [ sdbusplus ],
97)
98
Brad Bishopfeb19ef2019-11-07 18:02:16 -050099pwmsensor_a = static_library(
100 'pwmsensor_a',
101 'src/PwmSensor.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -0500102 dependencies: [ default_deps, thresholds_dep ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500103 implicit_include_directories: false,
104 include_directories: 'include',
105)
106
Patrick Williams8b8f6062021-08-27 14:53:50 -0500107pwmsensor_dep = declare_dependency(
108 link_with: [ pwmsensor_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -0500109 dependencies: [ default_deps, thresholds_dep ],
Patrick Williams8b8f6062021-08-27 14:53:50 -0500110)
111
Bruce Lee1263c3d2021-06-04 15:16:33 +0800112subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500113subdir('service_files')
114subdir('src')
115
116if not build_tests.disabled()
117 subdir('tests')
118endif