diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | meson.build | 33 | ||||
-rw-r--r-- | meson_options.txt | 23 |
3 files changed, 40 insertions, 17 deletions
diff --git a/.clang-tidy b/.clang-tidy index 5efef8a..192f326 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,6 +10,7 @@ Checks: > -*-vararg, -altera-*, -bugprone-easily-swappable-parameters, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-suspicious-string-compare, -cert-err33-c, -clang-analyzer-core.CallAndMessage, diff --git a/meson.build b/meson.build index 29c8467..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], @@ -328,13 +328,25 @@ if qt6_dep.found() ) endif -######### -# Tests # -######### +######## +# Lint # +######## + +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 get_option('warning_level') == 'everything' - # Check release metadata if not meson.is_subproject() + # Check release metadata autoship = find_program('autoship', required: false) if autoship.found() test('autoship', autoship, args: ['test', suil_src_root], suite: 'data') @@ -346,6 +358,13 @@ if get_option('warning_level') == 'everything' 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 ################# diff --git a/meson_options.txt b/meson_options.txt index 44e2ce7..82059bf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,35 +1,38 @@ # Copyright 2021-2023 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC -option('cocoa', type: 'feature', value: 'auto', yield: true, +option('cocoa', type: 'feature', yield: true, description : 'Build Cocoa wrappers') -option('docs', type: 'feature', value: 'auto', yield: true, +option('docs', type: 'feature', yield: true, description: 'Build documentation') -option('gtk2', type: 'feature', value: 'auto', yield: true, +option('gtk2', type: 'feature', yield: true, description : 'Build Gtk2 wrappers') -option('gtk3', type: 'feature', value: 'auto', yield: true, +option('gtk3', type: 'feature', yield: true, description : 'Build Gtk3 wrappers') -option('html', type: 'feature', value: 'auto', yield: true, +option('html', type: 'feature', yield: true, description: 'Build paginated HTML documentation') -option('qt5', type: 'feature', value: 'auto', yield: true, +option('lint', type: 'boolean', value: false, yield: true, + description: 'Run code quality checks') + +option('qt5', type: 'feature', yield: true, description : 'Build Qt5 wrappers') -option('qt6', type: 'feature', value: 'auto', yield: true, +option('qt6', type: 'feature', yield: true, description : 'Build Qt6 wrappers') -option('singlehtml', type: 'feature', value: 'auto', yield: true, +option('singlehtml', type: 'feature', yield: true, description: 'Build single-page HTML documentation') -option('tests', type: 'feature', value: 'auto', yield: true, +option('tests', type: 'feature', yield: true, description: 'Build tests') option('title', type: 'string', value: 'Suil', description: 'Project title') -option('x11', type: 'feature', value: 'auto', yield: true, +option('x11', type: 'feature', yield: true, description : 'Build X11 wrappers') |