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', |
Patrick Williams | e46b444 | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 11 | meson_version: '>=0.58.0', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 12 | ) |
| 13 | |
Zhikui Ren | a0c6b5b | 2023-06-06 12:14:19 -0700 | [diff] [blame] | 14 | # Enable io_uring for all daemons with below flags. |
| 15 | # '-DBOOST_ASIO_HAS_IO_URING', |
| 16 | # '-DBOOST_ASIO_DISABLE_EPOLL', |
| 17 | # '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', |
| 18 | # Note, there is currently an issue with CPUSensor when used in |
| 19 | # conjunction with io_uring. So it has not been changed to use |
| 20 | # random file access. But we'd like to enable it for all daemons. |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 21 | # https://github.com/openbmc/dbus-sensors/issues/19 |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 22 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 23 | add_project_arguments( |
Andrew Jeffery | e3b23c0 | 2021-09-23 11:29:49 +0930 | [diff] [blame] | 24 | '-Wno-psabi', |
Ed Tanous | a771f6a | 2022-01-14 09:36:51 -0800 | [diff] [blame] | 25 | '-Wuninitialized', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 26 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
Ed Tanous | 83db50c | 2023-03-01 10:20:24 -0800 | [diff] [blame] | 27 | '-DBOOST_ASIO_NO_DEPRECATED', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 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', |
Zhikui Ren | a0c6b5b | 2023-06-06 12:14:19 -0700 | [diff] [blame] | 34 | '-DBOOST_ASIO_HAS_IO_URING', |
| 35 | '-DBOOST_ASIO_DISABLE_EPOLL', |
| 36 | '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 37 | language: 'cpp', |
| 38 | ) |
| 39 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 40 | cpp = meson.get_compiler('cpp') |
| 41 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 42 | build_tests = get_option('tests') |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 43 | gpiodcxx = dependency('libgpiodcxx', |
Patrick Williams | 3911b82 | 2021-08-27 14:31:50 -0500 | [diff] [blame] | 44 | default_options: ['bindings=cxx'], |
| 45 | ) |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 46 | |
| 47 | # i2c-tools doesn't ship a pkg-config file for libi2c |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 48 | i2c = meson.get_compiler('cpp').find_library('i2c') |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 49 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 50 | sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') |
| 51 | if not sdbusplus.found() |
| 52 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 53 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 54 | sdbusplus = sdbusplus.as_system('system') |
| 55 | endif |
| 56 | |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 57 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 08d684a | 2021-08-27 15:15:34 -0500 | [diff] [blame] | 58 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 59 | if cpp.has_header('nlohmann/json.hpp') |
| 60 | nlohmann_json = declare_dependency() |
| 61 | else |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 62 | nlohmann_json = dependency('nlohmann_json') |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 63 | endif |
| 64 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 65 | systemd = dependency('systemd') |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 66 | systemd_system_unit_dir = systemd.get_variable( |
Patrick Williams | e46b444 | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 67 | 'systemdsystemunitdir', |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 68 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 69 | threads = dependency('threads') |
| 70 | |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 71 | boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system') |
| 72 | if not boost.found() |
| 73 | subproject('boost', required: false) |
| 74 | boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true) |
| 75 | boost = declare_dependency(include_directories : boost_inc) |
| 76 | boost = boost.as_system('system') |
| 77 | endif |
| 78 | |
| 79 | uring = dependency('liburing', required : false, include_type: 'system') |
| 80 | if not uring.found() |
| 81 | uring_proj = subproject('liburing', required: true) |
| 82 | uring = uring_proj.get_variable('uring') |
| 83 | uring = uring.as_system('system') |
| 84 | endif |
| 85 | |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 86 | default_deps = [ |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 87 | boost, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 88 | nlohmann_json, |
Patrick Williams | 0c42f40 | 2021-08-27 16:05:45 -0500 | [diff] [blame] | 89 | phosphor_logging_dep, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 90 | sdbusplus, |
Ed Tanous | 16966b5 | 2021-09-15 15:06:59 -0700 | [diff] [blame] | 91 | uring, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 92 | ] |
| 93 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 94 | subdir('service_files') |
| 95 | subdir('src') |
| 96 | |
| 97 | if not build_tests.disabled() |
| 98 | subdir('tests') |
| 99 | endif |