meson-patterns-cookbook — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited meson-patterns-cookbook (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill gives complete patterns, not just fragments.
The runnable examples in this repository are colocated under the owning skills' examples/ directories; this skill acts as the index for the reusable patterns.
project/
├── meson.build
├── meson_options.txt
├── include/
├── src/
├── tests/
├── subprojects/
└── tools/A small project may omit directories it does not need, but the layout should still be obvious to a newcomer.
A minimal example should show one concept cleanly.
A production-oriented example should add:
Do not mix both goals in the same snippet unless the user asked for a complete project.
project(
'example',
'c',
'cpp',
version: '0.1.0',
meson_version: '>=1.7.0',
license: 'MIT',
license_files: ['LICENSE'],
default_options: [
'c_std=c17',
'cpp_std=c++20',
'warning_level=3',
],
)inc = include_directories('include')
lib = library('mylib', 'src/mylib.cpp', include_directories: inc, install: true)
mylib_dep = declare_dependency(
include_directories: inc,
link_with: lib,
)
pkg = import('pkgconfig')
pkg.generate(
lib,
description: 'My reusable library',
filebase: 'mylib',
subdirs: 'mylib',
)Use this when the project is meant to be consumed by another build.
project(
'example',
'c',
'cpp',
version: '0.1.0',
meson_version: '>=1.7.0',
license: 'MIT',
license_files: ['LICENSE'],
default_options: [
'c_std=c17',
'cpp_std=c++20',
'warning_level=3',
],
)
inc = include_directories('include')
core = static_library('core', 'src/core.cpp', include_directories: inc)
app = executable('example-app', 'src/main.cpp', link_with: core, install: true)
test_exe = executable('core-test', 'tests/test_core.cpp', link_with: core)
test('core', test_exe)This keeps production code and test code separate while still reusing the same core implementation.
project(
'example',
'c',
'cpp',
version: '0.1.0',
meson_version: '>=1.7.0',
license: 'MIT',
license_files: ['LICENSE'],
default_options: [
'c_std=c17',
'cpp_std=c++20',
'warning_level=3',
],
)
inc = include_directories('include')
clib = static_library('clib', 'src/clib.c', include_directories: inc)
cppapp = executable('cppapp', 'src/main.cpp', link_with: clib, include_directories: inc, install: true)Use this pattern when a project exposes a C ABI but uses C++ internally or vice versa.
python = find_program('python3', required: true)
gen = custom_target(
'generated-config',
input: 'config.in.h',
output: 'config.h',
command: [python, 'scripts/gen-config.py', '@INPUT@', '@OUTPUT@'],
)
sources = [gen, 'src/main.cpp']Use custom_target() for one-off generation and generator() when the same tool is applied to many inputs. Keep both forms building into the build tree; do not commit generated files into source/.
plugin = shared_module(
'sample_plugin',
'src/plugin.cpp',
install: true,
install_dir: get_option('libdir') / 'myapp' / 'plugins',
)The host application should define a stable plugin interface and a documented install location. On Windows, export symbols explicitly with __declspec(dllexport) or a .def file.
zlib_dep = dependency('zlib', fallback: ['zlib', 'zlib_dep'])Prefer a single dependency object over manual include and linker flags.
foo_dep = dependency('foo', required: false)
if not foo_dep.found()
foo_proj = subproject('foo')
foo_dep = foo_proj.get_variable('foo_dep')
endifThis is useful when the project supports both system and vendored dependencies. The important part is that the parent consumes one exported dependency object, not a pile of manual include and linker flags.
run_command() for work that Meson can model directly~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.