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', |
Ed Tanous | 83db50c | 2023-03-01 10:20:24 -0800 | [diff] [blame] | 28 | '-DBOOST_ASIO_NO_DEPRECATED', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 29 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 30 | '-DBOOST_NO_RTTI', |
| 31 | '-DBOOST_NO_TYPEID', |
| 32 | '-DBOOST_ALL_NO_LIB', |
| 33 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 34 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
| 35 | language: 'cpp', |
| 36 | ) |
| 37 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 38 | cpp = meson.get_compiler('cpp') |
| 39 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 40 | build_tests = get_option('tests') |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 41 | gpiodcxx = dependency('libgpiodcxx', |
Patrick Williams | 3911b82 | 2021-08-27 14:31:50 -0500 | [diff] [blame] | 42 | default_options: ['bindings=cxx'], |
| 43 | ) |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 44 | |
| 45 | # i2c-tools doesn't ship a pkg-config file for libi2c |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 46 | i2c = meson.get_compiler('cpp').find_library('i2c') |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 47 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 48 | sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') |
| 49 | if not sdbusplus.found() |
| 50 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 51 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 52 | sdbusplus = sdbusplus.as_system('system') |
| 53 | endif |
| 54 | |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 55 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 08d684a | 2021-08-27 15:15:34 -0500 | [diff] [blame] | 56 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 57 | if cpp.has_header('nlohmann/json.hpp') |
| 58 | nlohmann_json = declare_dependency() |
| 59 | else |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 60 | nlohmann_json = dependency('nlohmann_json') |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 61 | endif |
| 62 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 63 | systemd = dependency('systemd') |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 64 | systemd_system_unit_dir = systemd.get_variable( |
| 65 | pkgconfig: 'systemdsystemunitdir', |
| 66 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 67 | threads = dependency('threads') |
| 68 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 69 | boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system') |
| 70 | if not boost.found() |
| 71 | subproject('boost', required: false) |
| 72 | boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true) |
| 73 | boost = declare_dependency(include_directories : boost_inc) |
| 74 | boost = boost.as_system('system') |
| 75 | endif |
| 76 | |
| 77 | uring = dependency('liburing', required : false, include_type: 'system') |
| 78 | if not uring.found() |
| 79 | uring_proj = subproject('liburing', required: true) |
| 80 | uring = uring_proj.get_variable('uring') |
| 81 | uring = uring.as_system('system') |
| 82 | endif |
| 83 | |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 84 | default_deps = [ |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 85 | boost, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 86 | nlohmann_json, |
Patrick Williams | 0c42f40 | 2021-08-27 16:05:45 -0500 | [diff] [blame] | 87 | phosphor_logging_dep, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 88 | sdbusplus, |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 89 | uring, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 90 | ] |
| 91 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 92 | subdir('service_files') |
| 93 | subdir('src') |
| 94 | |
| 95 | if not build_tests.disabled() |
| 96 | subdir('tests') |
| 97 | endif |