1project( 2 'dbus-sensors', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++20' 8 ], 9 license: 'Apache-2.0', 10 version: '0.1', 11 meson_version: '>=0.58.0', 12) 13 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 18uring_args = [ 19 '-DBOOST_ASIO_HAS_IO_URING', 20 '-DBOOST_ASIO_DISABLE_EPOLL', 21 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', 22] 23 24add_project_arguments( 25 '-Wno-psabi', 26 '-Wuninitialized', 27 '-DBOOST_SYSTEM_NO_DEPRECATED', 28 '-DBOOST_ASIO_NO_DEPRECATED', 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 38cpp = meson.get_compiler('cpp') 39 40build_tests = get_option('tests') 41gpiodcxx = dependency('libgpiodcxx', 42 default_options: ['bindings=cxx'], 43) 44 45# i2c-tools doesn't ship a pkg-config file for libi2c 46i2c = meson.get_compiler('cpp').find_library('i2c') 47 48sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') 49if not sdbusplus.found() 50 sdbusplus_proj = subproject('sdbusplus', required: true) 51 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 52 sdbusplus = sdbusplus.as_system('system') 53endif 54 55phosphor_logging_dep = dependency('phosphor-logging') 56 57if cpp.has_header('nlohmann/json.hpp') 58 nlohmann_json = declare_dependency() 59else 60 nlohmann_json = dependency('nlohmann_json') 61endif 62 63systemd = dependency('systemd') 64systemd_system_unit_dir = systemd.get_variable( 65 'systemdsystemunitdir', 66 pkgconfig_define: ['prefix', get_option('prefix')]) 67threads = dependency('threads') 68 69boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system') 70if 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') 75endif 76 77uring = dependency('liburing', required : false, include_type: 'system') 78if not uring.found() 79 uring_proj = subproject('liburing', required: true) 80 uring = uring_proj.get_variable('uring') 81 uring = uring.as_system('system') 82endif 83 84default_deps = [ 85 boost, 86 nlohmann_json, 87 phosphor_logging_dep, 88 sdbusplus, 89 uring, 90] 91 92subdir('service_files') 93subdir('src') 94 95if not build_tests.disabled() 96 subdir('tests') 97endif 98