From 6b08458761f0b5c2aa126950eed66bf83ac19409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?= Date: Sat, 13 Jul 2024 03:29:43 +0200 Subject: [PATCH] slab_trace_analyzer: Hide behind Meson option and fix for GCC 13+ Instead of using `build_by_default: false` just hide it behind a flag. Also add missing include that was previously transitively included by some other header. --- meson.build | 30 +++++++++++++++++++++--------- meson_options.txt | 1 + slab_trace_analyzer.cpp | 1 + 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index e8974b3..9f6df34 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,6 @@ # frigg is header-only, so we do not need a compiler. project('frigg') -# We already need C++ on the build system to build the analyzer. -add_languages('cpp', native: true) - incl = include_directories('include') if not get_option('frigg_no_install') @@ -58,19 +55,34 @@ endif frigg_dep = declare_dependency(include_directories: incl) + build_tests = get_option('build_tests').enabled() if get_option('build_tests').auto() build_tests = not meson.is_subproject() endif +build_slab_analyzer = get_option('build_slab_analyzer').enabled() + +if get_option('build_slab_analyzer').auto() + build_slab_analyzer = not meson.is_subproject() +endif + + +if build_tests or build_slab_analyzer + # We need C++ only for the analyzer and test suite. + add_languages('cpp') +endif + + if build_tests subdir('tests') endif -analyzer = executable( - 'slab_trace_analyzer', - 'slab_trace_analyzer.cpp', - override_options: ['cpp_std=c++20'], - build_by_default: false, - native: true) +if build_slab_analyzer + analyzer = executable( + 'slab_trace_analyzer', + 'slab_trace_analyzer.cpp', + override_options: ['cpp_std=c++20'], + native: true) +endif diff --git a/meson_options.txt b/meson_options.txt index dc63e74..8f26ef6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('frigg_no_install', type : 'boolean', value : false) option('build_tests', type : 'feature', value : 'auto') +option('build_slab_analyzer', type : 'feature', value : 'disabled') diff --git a/slab_trace_analyzer.cpp b/slab_trace_analyzer.cpp index a057b92..756d606 100644 --- a/slab_trace_analyzer.cpp +++ b/slab_trace_analyzer.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include