Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'dbus-sensors', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 7 | 'cpp_std=c++20' |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | version: '0.1', |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 11 | meson_version: '>=0.57.0', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 12 | ) |
| 13 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 14 | # Note, there is currently an issue with CPUSensor when used in conjunction |
| 15 | # with io_uring. For the moment, we enable uring for all other daemons, but |
| 16 | # we'd like to enable it for all daemons. |
| 17 | # https://github.com/openbmc/dbus-sensors/issues/19 |
| 18 | uring_args = [ |
| 19 | '-DBOOST_ASIO_HAS_IO_URING', |
| 20 | '-DBOOST_ASIO_DISABLE_EPOLL', |
| 21 | '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', |
| 22 | ] |
| 23 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 24 | add_project_arguments( |
Andrew Jeffery | e3b23c0 | 2021-09-23 11:29:49 +0930 | [diff] [blame] | 25 | '-Wno-psabi', |
Ed Tanous | a771f6a | 2022-01-14 09:36:51 -0800 | [diff] [blame] | 26 | '-Wuninitialized', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 27 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 28 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 29 | '-DBOOST_NO_RTTI', |
| 30 | '-DBOOST_NO_TYPEID', |
| 31 | '-DBOOST_ALL_NO_LIB', |
| 32 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 33 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
| 34 | language: 'cpp', |
| 35 | ) |
| 36 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 37 | cpp = meson.get_compiler('cpp') |
| 38 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 39 | build_tests = get_option('tests') |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 40 | gpiodcxx = dependency('libgpiodcxx', |
Patrick Williams | 3911b82 | 2021-08-27 14:31:50 -0500 | [diff] [blame] | 41 | default_options: ['bindings=cxx'], |
| 42 | ) |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 43 | |
| 44 | # i2c-tools doesn't ship a pkg-config file for libi2c |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 45 | i2c = meson.get_compiler('cpp').find_library('i2c') |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 46 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 47 | sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') |
| 48 | if not sdbusplus.found() |
| 49 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 50 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 51 | sdbusplus = sdbusplus.as_system('system') |
| 52 | endif |
| 53 | |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 54 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 08d684a | 2021-08-27 15:15:34 -0500 | [diff] [blame] | 55 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 56 | if cpp.has_header('nlohmann/json.hpp') |
| 57 | nlohmann_json = declare_dependency() |
| 58 | else |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 59 | nlohmann_json = dependency('nlohmann_json') |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 60 | endif |
| 61 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 62 | systemd = dependency('systemd') |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 63 | systemd_system_unit_dir = systemd.get_variable( |
| 64 | pkgconfig: 'systemdsystemunitdir', |
| 65 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 66 | threads = dependency('threads') |
| 67 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 68 | boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system') |
| 69 | if not boost.found() |
| 70 | subproject('boost', required: false) |
| 71 | boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true) |
| 72 | boost = declare_dependency(include_directories : boost_inc) |
| 73 | boost = boost.as_system('system') |
| 74 | endif |
| 75 | |
| 76 | uring = dependency('liburing', required : false, include_type: 'system') |
| 77 | if not uring.found() |
| 78 | uring_proj = subproject('liburing', required: true) |
| 79 | uring = uring_proj.get_variable('uring') |
| 80 | uring = uring.as_system('system') |
| 81 | endif |
| 82 | |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 83 | default_deps = [ |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 84 | boost, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 85 | nlohmann_json, |
Patrick Williams | 0c42f40 | 2021-08-27 16:05:45 -0500 | [diff] [blame] | 86 | phosphor_logging_dep, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 87 | sdbusplus, |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 88 | uring, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 89 | ] |
| 90 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 91 | thresholds_a = static_library( |
| 92 | 'thresholds_a', |
| 93 | 'src/Thresholds.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 94 | dependencies: default_deps, |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 95 | implicit_include_directories: false, |
| 96 | include_directories: 'include', |
| 97 | ) |
| 98 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 99 | thresholds_dep = declare_dependency( |
| 100 | link_with: [ thresholds_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 101 | dependencies: default_deps, |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 102 | ) |
| 103 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 104 | utils_a = static_library( |
| 105 | 'utils_a', |
Ed Tanous | 7303063 | 2022-01-14 10:09:47 -0800 | [diff] [blame] | 106 | [ |
| 107 | 'src/FileHandle.cpp', |
| 108 | 'src/SensorPaths.cpp', |
| 109 | 'src/Utils.cpp', |
| 110 | ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 111 | dependencies: default_deps, |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 112 | implicit_include_directories: false, |
| 113 | include_directories: 'include', |
| 114 | ) |
| 115 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 116 | utils_dep = declare_dependency( |
| 117 | link_with: [ utils_a ], |
| 118 | dependencies: [ sdbusplus ], |
| 119 | ) |
| 120 | |
Zev Weiss | dabd48d | 2022-08-03 15:43:17 -0700 | [diff] [blame] | 121 | devicemgmt_a = static_library( |
| 122 | 'devicemgmt_a', |
| 123 | [ |
| 124 | 'src/DeviceMgmt.cpp', |
| 125 | ], |
| 126 | dependencies: default_deps, |
| 127 | implicit_include_directories: false, |
| 128 | include_directories: 'include', |
| 129 | ) |
| 130 | |
| 131 | devicemgmt_dep = declare_dependency( |
| 132 | link_with: [ devicemgmt_a ], |
| 133 | dependencies: default_deps, |
| 134 | ) |
| 135 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 136 | pwmsensor_a = static_library( |
| 137 | 'pwmsensor_a', |
| 138 | 'src/PwmSensor.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 139 | dependencies: [ default_deps, thresholds_dep ], |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 140 | implicit_include_directories: false, |
| 141 | include_directories: 'include', |
| 142 | ) |
| 143 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 144 | pwmsensor_dep = declare_dependency( |
| 145 | link_with: [ pwmsensor_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 146 | dependencies: [ default_deps, thresholds_dep ], |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 147 | ) |
| 148 | |
Bruce Lee | 1263c3d | 2021-06-04 15:16:33 +0800 | [diff] [blame] | 149 | subdir('include') |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 150 | subdir('service_files') |
| 151 | subdir('src') |
| 152 | |
| 153 | if not build_tests.disabled() |
| 154 | subdir('tests') |
| 155 | endif |