From f5721daa0b57c8d09f15c4a6182a2bf2313e1a05 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 6 Oct 2024 13:21:49 -0400 Subject: Add clang-format test --- meson.build | 22 ++++++++++++++++++++-- 1 file 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 ################# -- cgit v1.2.1