meson: Format build files according to meson style guide
muon[1], an meson-compatible build system, provides a `fmt` subcommand
to format meson build files in accordance with the meson style guide[2].
[1]: https://muon.build/
[2]: https://mesonbuild.com/Style-guide.html
Apply `muon fmt` using the following to provide consistent formatting:
```
for f in $(git ls-files | grep meson.build)
do
muon fmt $f | sponge $f
done
```
Change-Id: I7ef7693ddf964e9540b2e3e256cdf584fb8ac9cd
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index 927f532..606d987 100644
--- a/meson.build
+++ b/meson.build
@@ -1,11 +1,7 @@
project(
'dbus-sensors',
'cpp',
- default_options: [
- 'warning_level=3',
- 'werror=true',
- 'cpp_std=c++20'
- ],
+ default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++20'],
license: 'Apache-2.0',
version: '0.1',
meson_version: '>=0.58.0',
@@ -40,18 +36,19 @@
cpp = meson.get_compiler('cpp')
build_tests = get_option('tests')
-gpiodcxx = dependency('libgpiodcxx',
+gpiodcxx = dependency(
+ 'libgpiodcxx',
default_options: ['bindings=cxx'],
)
# i2c-tools doesn't ship a pkg-config file for libi2c
i2c = meson.get_compiler('cpp').find_library('i2c')
-sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
+sdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
if not sdbusplus.found()
- sdbusplus_proj = subproject('sdbusplus', required: true)
- sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
- sdbusplus = sdbusplus.as_system('system')
+ sdbusplus_proj = subproject('sdbusplus', required: true)
+ sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
+ sdbusplus = sdbusplus.as_system('system')
endif
phosphor_logging_dep = dependency('phosphor-logging')
@@ -60,22 +57,31 @@
systemd = dependency('systemd')
systemd_system_unit_dir = systemd.get_variable(
'systemdsystemunitdir',
- pkgconfig_define: ['prefix', get_option('prefix')])
+ pkgconfig_define: ['prefix', get_option('prefix')],
+)
threads = dependency('threads')
-boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
+boost = dependency(
+ 'boost',
+ version: '>=1.79.0',
+ required: false,
+ include_type: 'system',
+)
if not boost.found()
- subproject('boost', required: false)
- boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
- boost = declare_dependency(include_directories : boost_inc)
- boost = boost.as_system('system')
+ subproject('boost', required: false)
+ boost_inc = include_directories(
+ 'subprojects/boost_1_79_0/',
+ is_system: true,
+ )
+ boost = declare_dependency(include_directories: boost_inc)
+ boost = boost.as_system('system')
endif
-uring = dependency('liburing', required : false, include_type: 'system')
+uring = dependency('liburing', required: false, include_type: 'system')
if not uring.found()
- uring_proj = subproject('liburing', required: true)
- uring = uring_proj.get_variable('uring')
- uring = uring.as_system('system')
+ uring_proj = subproject('liburing', required: true)
+ uring = uring_proj.get_variable('uring')
+ uring = uring.as_system('system')
endif
default_deps = [
diff --git a/src/meson.build b/src/meson.build
index f0403ab..429f7c5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,9 +1,17 @@
conf_data = configuration_data()
-conf_data.set10('VALIDATION_UNSECURE_FEATURE', get_option('validate-unsecure-feature').allowed())
-conf_data.set10('INSECURE_UNRESTRICTED_SENSOR_OVERRIDE', get_option('insecure-sensor-override').allowed())
-configure_file(input: 'dbus-sensor_config.h.in',
- output: 'dbus-sensor_config.h',
- configuration: conf_data)
+conf_data.set10(
+ 'VALIDATION_UNSECURE_FEATURE',
+ get_option('validate-unsecure-feature').allowed(),
+)
+conf_data.set10(
+ 'INSECURE_UNRESTRICTED_SENSOR_OVERRIDE',
+ get_option('insecure-sensor-override').allowed(),
+)
+configure_file(
+ input: 'dbus-sensor_config.h.in',
+ output: 'dbus-sensor_config.h',
+ configuration: conf_data,
+)
thresholds_a = static_library(
'thresholds_a',
@@ -12,7 +20,7 @@
)
thresholds_dep = declare_dependency(
- link_with: [ thresholds_a ],
+ link_with: [thresholds_a],
dependencies: default_deps,
)
@@ -27,8 +35,8 @@
)
utils_dep = declare_dependency(
- link_with: [ utils_a ],
- dependencies: [ sdbusplus ],
+ link_with: [utils_a],
+ dependencies: [sdbusplus],
)
devicemgmt_a = static_library(
@@ -40,19 +48,19 @@
)
devicemgmt_dep = declare_dependency(
- link_with: [ devicemgmt_a ],
+ link_with: [devicemgmt_a],
dependencies: default_deps,
)
pwmsensor_a = static_library(
'pwmsensor_a',
'PwmSensor.cpp',
- dependencies: [ default_deps, thresholds_dep ],
+ dependencies: [default_deps, thresholds_dep],
)
pwmsensor_dep = declare_dependency(
- link_with: [ pwmsensor_a ],
- dependencies: [ default_deps, thresholds_dep ],
+ link_with: [pwmsensor_a],
+ dependencies: [default_deps, thresholds_dep],
)
peci_incdirs = []
@@ -61,7 +69,7 @@
endif
if get_option('intel-cpu').allowed()
- peci_dep = dependency('libpeci', required : true)
+ peci_dep = dependency('libpeci', required: true)
endif
if get_option('adc').allowed()
@@ -184,10 +192,10 @@
endif
if get_option('nvme').allowed()
- nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
+ nvme_srcs = files('NVMeSensor.cpp', 'NVMeSensorMain.cpp')
nvme_srcs += files('NVMeBasicContext.cpp')
- nvme_deps = [ default_deps, i2c, thresholds_dep, utils_dep, threads ]
+ nvme_deps = [default_deps, i2c, thresholds_dep, utils_dep, threads]
executable(
'nvmesensor',
diff --git a/tests/meson.build b/tests/meson.build
index 3582c07..e5ad2ea 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,13 +8,13 @@
dependency('threads'),
gtest_proj.dependency('gtest'),
gtest_proj.dependency('gtest_main'),
- ]
+ ],
)
gmock_dep = gtest_proj.dependency('gmock')
else
assert(
not get_option('tests').allowed(),
- 'Googletest is required if tests are enabled'
+ 'Googletest is required if tests are enabled',
)
endif
endif
@@ -34,5 +34,5 @@
dependencies: ut_deps_list,
implicit_include_directories: false,
include_directories: '../src',
- )
+ ),
)