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# 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. 21# https://github.com/openbmc/dbus-sensors/issues/19 22 23add_project_arguments( 24 '-Wno-psabi', 25 '-Wuninitialized', 26 '-DBOOST_SYSTEM_NO_DEPRECATED', 27 '-DBOOST_ASIO_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 '-DBOOST_ASIO_HAS_IO_URING', 35 '-DBOOST_ASIO_DISABLE_EPOLL', 36 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', 37 language: 'cpp', 38) 39 40cpp = meson.get_compiler('cpp') 41 42build_tests = get_option('tests') 43gpiodcxx = dependency('libgpiodcxx', 44 default_options: ['bindings=cxx'], 45) 46 47# i2c-tools doesn't ship a pkg-config file for libi2c 48i2c = meson.get_compiler('cpp').find_library('i2c') 49 50sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') 51if not sdbusplus.found() 52 sdbusplus_proj = subproject('sdbusplus', required: true) 53 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 54 sdbusplus = sdbusplus.as_system('system') 55endif 56 57phosphor_logging_dep = dependency('phosphor-logging') 58 59if cpp.has_header('nlohmann/json.hpp') 60 nlohmann_json = declare_dependency() 61else 62 nlohmann_json = dependency('nlohmann_json') 63endif 64 65systemd = dependency('systemd') 66systemd_system_unit_dir = systemd.get_variable( 67 'systemdsystemunitdir', 68 pkgconfig_define: ['prefix', get_option('prefix')]) 69threads = dependency('threads') 70 71boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system') 72if 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') 77endif 78 79uring = dependency('liburing', required : false, include_type: 'system') 80if not uring.found() 81 uring_proj = subproject('liburing', required: true) 82 uring = uring_proj.get_variable('uring') 83 uring = uring.as_system('system') 84endif 85 86default_deps = [ 87 boost, 88 nlohmann_json, 89 phosphor_logging_dep, 90 sdbusplus, 91 uring, 92] 93 94subdir('service_files') 95subdir('src') 96 97if not build_tests.disabled() 98 subdir('tests') 99endif 100