blob: 48c7c276315245190a621dfceee97bfd9f928863 [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 Williams3f556a82022-03-21 11:25:15 -050030gpiodcxx = dependency('libgpiodcxx',
Patrick Williams3911b822021-08-27 14:31:50 -050031 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
Patrick Williams3f556a82022-03-21 11:25:15 -050037sdbusplus = dependency('sdbusplus')
38phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams08d684a2021-08-27 15:15:34 -050039
Patrick Williams1889ebf2021-08-27 14:38:52 -050040if cpp.has_header('nlohmann/json.hpp')
41 nlohmann_json = declare_dependency()
42else
Patrick Williams3f556a82022-03-21 11:25:15 -050043 nlohmann_json = dependency('nlohmann_json')
Patrick Williams1889ebf2021-08-27 14:38:52 -050044endif
45
Brad Bishopfeb19ef2019-11-07 18:02:16 -050046systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093047systemd_system_unit_dir = systemd.get_variable(
48 pkgconfig: 'systemdsystemunitdir',
49 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050050threads = dependency('threads')
51
Patrick Williams302a61a2021-08-27 15:40:08 -050052default_deps = [
53 nlohmann_json,
Patrick Williams0c42f402021-08-27 16:05:45 -050054 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050055 sdbusplus,
56]
57
Brad Bishopfeb19ef2019-11-07 18:02:16 -050058thresholds_a = static_library(
59 'thresholds_a',
60 'src/Thresholds.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -050061 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -050062 implicit_include_directories: false,
63 include_directories: 'include',
64)
65
Patrick Williams8b8f6062021-08-27 14:53:50 -050066thresholds_dep = declare_dependency(
67 link_with: [ thresholds_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -050068 dependencies: default_deps,
Patrick Williams8b8f6062021-08-27 14:53:50 -050069)
70
Brad Bishopfeb19ef2019-11-07 18:02:16 -050071utils_a = static_library(
72 'utils_a',
Ed Tanous73030632022-01-14 10:09:47 -080073 [
74 'src/FileHandle.cpp',
75 'src/SensorPaths.cpp',
76 'src/Utils.cpp',
77 ],
Patrick Williams302a61a2021-08-27 15:40:08 -050078 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -050079 implicit_include_directories: false,
80 include_directories: 'include',
81)
82
Patrick Williams8b8f6062021-08-27 14:53:50 -050083utils_dep = declare_dependency(
84 link_with: [ utils_a ],
85 dependencies: [ sdbusplus ],
86)
87
Brad Bishopfeb19ef2019-11-07 18:02:16 -050088pwmsensor_a = static_library(
89 'pwmsensor_a',
90 'src/PwmSensor.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -050091 dependencies: [ default_deps, thresholds_dep ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -050092 implicit_include_directories: false,
93 include_directories: 'include',
94)
95
Patrick Williams8b8f6062021-08-27 14:53:50 -050096pwmsensor_dep = declare_dependency(
97 link_with: [ pwmsensor_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -050098 dependencies: [ default_deps, thresholds_dep ],
Patrick Williams8b8f6062021-08-27 14:53:50 -050099)
100
Bruce Lee1263c3d2021-06-04 15:16:33 +0800101subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500102subdir('service_files')
103subdir('src')
104
105if not build_tests.disabled()
106 subdir('tests')
107endif