blob: c3ab050c2c4b4c09275625354ec667fdaa14a87a [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(
Andrew Jefferye3b23c02021-09-23 11:29:49 +093015 '-Wno-psabi',
Ed Tanousa771f6a2022-01-14 09:36:51 -080016 '-Wuninitialized',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050017 '-DBOOST_SYSTEM_NO_DEPRECATED',
18 '-DBOOST_ERROR_CODE_HEADER_ONLY',
19 '-DBOOST_NO_RTTI',
20 '-DBOOST_NO_TYPEID',
21 '-DBOOST_ALL_NO_LIB',
22 '-DBOOST_ASIO_DISABLE_THREADS',
23 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
24 language: 'cpp',
25)
26
Patrick Williams1889ebf2021-08-27 14:38:52 -050027cpp = meson.get_compiler('cpp')
28
Brad Bishopfeb19ef2019-11-07 18:02:16 -050029build_tests = get_option('tests')
Patrick Williams3911b822021-08-27 14:31:50 -050030gpiodcxx = dependency(
31 'libgpiodcxx',
32 fallback: ['libgpiod', 'gpiodcxx_dep'],
33 default_options: ['bindings=cxx'],
34)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093035
36# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050037i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093038
Andrew Jeffery3f2e0522021-05-27 13:26:20 +093039sdbusplus = dependency(
40 'sdbusplus',
41 fallback: [
42 'sdbusplus',
43 'sdbusplus_dep'
44 ],
45)
46
Patrick Williams08d684a2021-08-27 15:15:34 -050047phosphor_logging_dep = dependency(
48 'phosphor-logging',
49 fallback: ['phosphor-logging', 'phosphor_logging_dep'],
50)
51
Patrick Williams1889ebf2021-08-27 14:38:52 -050052if cpp.has_header('nlohmann/json.hpp')
53 nlohmann_json = declare_dependency()
54else
55 subproject('nlohmann-json')
56 nlohmann_json = declare_dependency(
57 include_directories: include_directories(
58 'subprojects/nlohmann-json/single_include',
59 'subprojects/nlohmann-json/single_include/nlohmann',
60 )
61 )
62endif
63
Brad Bishopfeb19ef2019-11-07 18:02:16 -050064systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093065systemd_system_unit_dir = systemd.get_variable(
66 pkgconfig: 'systemdsystemunitdir',
67 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050068threads = dependency('threads')
69
Patrick Williams302a61a2021-08-27 15:40:08 -050070default_deps = [
71 nlohmann_json,
Patrick Williams0c42f402021-08-27 16:05:45 -050072 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050073 sdbusplus,
74]
75
Brad Bishopfeb19ef2019-11-07 18:02:16 -050076thresholds_a = static_library(
77 'thresholds_a',
78 'src/Thresholds.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -050079 dependencies: default_deps,
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 -050084thresholds_dep = declare_dependency(
85 link_with: [ thresholds_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -050086 dependencies: default_deps,
Patrick Williams8b8f6062021-08-27 14:53:50 -050087)
88
Brad Bishopfeb19ef2019-11-07 18:02:16 -050089utils_a = static_library(
90 'utils_a',
Ed Tanous6cb732a2021-02-18 15:33:51 -080091 ['src/Utils.cpp', 'src/SensorPaths.cpp'],
Patrick Williams302a61a2021-08-27 15:40:08 -050092 dependencies: default_deps,
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 -050097utils_dep = declare_dependency(
98 link_with: [ utils_a ],
99 dependencies: [ sdbusplus ],
100)
101
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500102pwmsensor_a = static_library(
103 'pwmsensor_a',
104 'src/PwmSensor.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -0500105 dependencies: [ default_deps, thresholds_dep ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500106 implicit_include_directories: false,
107 include_directories: 'include',
108)
109
Patrick Williams8b8f6062021-08-27 14:53:50 -0500110pwmsensor_dep = declare_dependency(
111 link_with: [ pwmsensor_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -0500112 dependencies: [ default_deps, thresholds_dep ],
Patrick Williams8b8f6062021-08-27 14:53:50 -0500113)
114
Bruce Lee1263c3d2021-06-04 15:16:33 +0800115subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500116subdir('service_files')
117subdir('src')
118
119if not build_tests.disabled()
120 subdir('tests')
121endif