1project( 2 'dbus-sensors', 3 'cpp', 4 default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++20'], 5 license: 'Apache-2.0', 6 version: '0.1', 7 meson_version: '>=1.1', 8) 9 10# Enable io_uring for all daemons with below flags. 11# '-DBOOST_ASIO_HAS_IO_URING', 12# '-DBOOST_ASIO_DISABLE_EPOLL', 13# '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', 14# Note, there is currently an issue with CPUSensor when used in 15# conjunction with io_uring. So it has not been changed to use 16# random file access. But we'd like to enable it for all daemons. 17# https://github.com/openbmc/dbus-sensors/issues/19 18 19add_project_arguments( 20 '-Wno-psabi', 21 '-Wuninitialized', 22 '-DBOOST_SYSTEM_NO_DEPRECATED', 23 '-DBOOST_ASIO_NO_DEPRECATED', 24 '-DBOOST_ERROR_CODE_HEADER_ONLY', 25 '-DBOOST_NO_RTTI', 26 '-DBOOST_NO_TYPEID', 27 '-DBOOST_ALL_NO_LIB', 28 '-DBOOST_ASIO_DISABLE_THREADS', 29 '-DBOOST_ALLOW_DEPRECATED_HEADERS', 30 '-DBOOST_ASIO_HAS_IO_URING', 31 '-DBOOST_ASIO_DISABLE_EPOLL', 32 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', 33 language: 'cpp', 34) 35 36build_tests = get_option('tests') 37gpiodcxx = dependency( 38 'libgpiodcxx', 39 default_options: ['bindings=cxx'], 40) 41 42# i2c-tools doesn't ship a pkg-config file for libi2c 43i2c = meson.get_compiler('cpp').find_library('i2c') 44 45sdbusplus = dependency('sdbusplus', required: false, include_type: 'system') 46if not sdbusplus.found() 47 sdbusplus_proj = subproject('sdbusplus', required: true) 48 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 49 sdbusplus = sdbusplus.as_system('system') 50endif 51 52phosphor_logging_dep = dependency('phosphor-logging') 53nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 54 55systemd = dependency('systemd') 56systemd_system_unit_dir = systemd.get_variable( 57 'systemdsystemunitdir', 58 pkgconfig_define: ['prefix', get_option('prefix')], 59) 60threads = dependency('threads') 61 62boost = dependency( 63 'boost', 64 version: '>=1.79.0', 65 required: false, 66 include_type: 'system', 67) 68if not boost.found() 69 subproject('boost', required: false) 70 boost_inc = include_directories( 71 'subprojects/boost_1_79_0/', 72 is_system: true, 73 ) 74 boost = declare_dependency(include_directories: boost_inc) 75 boost = boost.as_system('system') 76endif 77 78uring = dependency('liburing', required: false, include_type: 'system') 79if not uring.found() 80 uring_proj = subproject('liburing', required: true) 81 uring = uring_proj.get_variable('uring') 82 uring = uring.as_system('system') 83endif 84 85default_deps = [ 86 boost, 87 nlohmann_json_dep, 88 phosphor_logging_dep, 89 sdbusplus, 90 uring, 91] 92 93subdir('service_files') 94subdir('src') 95 96if not build_tests.disabled() 97 subdir('tests') 98endif 99