summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-10-06 13:21:49 -0400
committerDavid Robillard <d@drobilla.net>2024-10-06 13:21:49 -0400
commitf5721daa0b57c8d09f15c4a6182a2bf2313e1a05 (patch)
tree1fc304b45ed83da36fc936da0467897b1d725f2c
parent412e9853b9efcac095215fff6d6e2e28ffd4d3b7 (diff)
downloadsuil-f5721daa0b57c8d09f15c4a6182a2bf2313e1a05.tar.gz
suil-f5721daa0b57c8d09f15c4a6182a2bf2313e1a05.tar.bz2
suil-f5721daa0b57c8d09f15c4a6182a2bf2313e1a05.zip
Add clang-format test
-rw-r--r--meson.build22
1 files changed, 20 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 9154289..bd81079 100644
--- a/meson.build
+++ b/meson.build
@@ -146,7 +146,7 @@ endif
include_dirs = include_directories('include')
c_headers = files('include/suil/suil.h')
-sources = files(
+core_sources = files(
'src/host.c',
'src/instance.c',
)
@@ -160,7 +160,7 @@ endif
# Build shared and/or static library
libsuil = library(
versioned_name,
- sources,
+ core_sources,
c_args: c_suppressions + extra_c_args + platform_defines + ['-DSUIL_INTERNAL'],
darwin_versions: [major_version + '.0.0', meson.project_version()],
dependencies: [dl_dep, lv2_dep],
@@ -333,6 +333,17 @@ endif
########
if get_option('lint')
+ all_sources = c_headers + core_sources
+ all_sources += files(
+ 'src/cocoa_in_gtk2.mm',
+ 'src/cocoa_in_qt5.mm',
+ 'src/win_in_gtk2.cpp',
+ 'src/x11.c',
+ 'src/x11_in_gtk2.c',
+ 'src/x11_in_gtk3.c',
+ 'src/x11_in_qt.cpp',
+ 'src/x11_in_qt.cpp',
+ )
if not meson.is_subproject()
# Check release metadata
@@ -347,6 +358,13 @@ if get_option('lint')
if reuse.found()
test('REUSE', reuse, args: ['--root', suil_src_root, 'lint'], suite: 'data')
endif
+
+ # Check code formatting
+ clang_format = find_program('clang-format', required: false)
+ if clang_format.found()
+ clang_format_args = ['--Werror', '--dry-run'] + all_sources
+ test('format', clang_format, args: clang_format_args, suite: 'code')
+ endif
endif
#################