From 6c0a7a30abfec32a464b6111e3aacf1a9bc6ea2f Mon Sep 17 00:00:00 2001 From: oir Date: Sat, 18 Apr 2026 16:40:41 -0400 Subject: [PATCH] migrate to catch2-v3 --- subprojects/catch2.wrap | 15 +++++++++------ subprojects/packagefiles/Catch2/LICENSE.build | 19 ------------------- subprojects/packagefiles/Catch2/meson.build | 9 --------- tests/meson.build | 19 ++++++++++++++++--- tests/test-fmtlib.cpp | 2 -- tests/test-stdfmt.cpp | 2 -- tests/test.cpp | 3 --- tests/testutil.h | 4 +++- 8 files changed, 28 insertions(+), 45 deletions(-) delete mode 100644 subprojects/packagefiles/Catch2/LICENSE.build delete mode 100644 subprojects/packagefiles/Catch2/meson.build diff --git a/subprojects/catch2.wrap b/subprojects/catch2.wrap index 3574177..de0a509 100644 --- a/subprojects/catch2.wrap +++ b/subprojects/catch2.wrap @@ -1,8 +1,11 @@ -[wrap-git] -url = https://github.com/catchorg/Catch2.git -revision = d4b0b34561a0ffe71216894caa35694e1aabdd5b -directory = Catch2 -patch_directory = Catch2 +[wrap-file] +directory = Catch2-3.14.0 +source_url = https://github.com/catchorg/Catch2/archive/v3.14.0.tar.gz +source_filename = Catch2-3.14.0.tar.gz +source_hash = ba2a939efead3c833c499cf487e185762f419a71d30158cd1b43c6079c586490 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.14.0-1/Catch2-3.14.0.tar.gz +wrapdb_version = 3.14.0-1 [provide] -catch2 = catch2_dep \ No newline at end of file +catch2 = catch2_dep +catch2-with-main = catch2_with_main_dep diff --git a/subprojects/packagefiles/Catch2/LICENSE.build b/subprojects/packagefiles/Catch2/LICENSE.build deleted file mode 100644 index b59833d..0000000 --- a/subprojects/packagefiles/Catch2/LICENSE.build +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2021 The Meson development team - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/subprojects/packagefiles/Catch2/meson.build b/subprojects/packagefiles/Catch2/meson.build deleted file mode 100644 index d9abb18..0000000 --- a/subprojects/packagefiles/Catch2/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('catch2', - 'cpp', - version : '2.13.8', - license : 'Boost' -) - -catch2_dep = declare_dependency( - include_directories : include_directories('single_include') -) diff --git a/tests/meson.build b/tests/meson.build index a57c5b0..80fdf29 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,9 +1,12 @@ -catch = subproject('catch2').get_variable('catch2_dep') +catch = dependency('catch2-with-main', default_options: ['tests=false']) -sources = [ +demos = [ 'demo.cpp', 'demo-fmtlib.cpp', 'demo-stdfmt.cpp', +] + +test_sources = [ 'test.cpp', 'test-fmtlib.cpp', 'test-stdfmt.cpp', @@ -11,7 +14,17 @@ sources = [ tests = [] -foreach src : sources +foreach src : demos + exec_name = src.replace('.cpp', '.out') + exe = executable(exec_name, + src, + include_directories : incdir, + dependencies : deps) + tests += [exe] + test(exec_name, exe) +endforeach + +foreach src : test_sources exec_name = src.replace('.cpp', '.out') exe = executable(exec_name, src, diff --git a/tests/test-fmtlib.cpp b/tests/test-fmtlib.cpp index 96c6b38..4f1600c 100644 --- a/tests/test-fmtlib.cpp +++ b/tests/test-fmtlib.cpp @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN #define FMT_HEADER_ONLY #ifndef BARKEEP_ENABLE_FMT_FORMAT #define BARKEEP_ENABLE_FMT_FORMAT @@ -8,7 +7,6 @@ #include #include #include -#include #include "testutil.h" diff --git a/tests/test-stdfmt.cpp b/tests/test-stdfmt.cpp index a009a3e..db4d08f 100644 --- a/tests/test-stdfmt.cpp +++ b/tests/test-stdfmt.cpp @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN #ifndef BARKEEP_ENABLE_STD_FORMAT #define BARKEEP_ENABLE_STD_FORMAT #endif @@ -7,7 +6,6 @@ #include #include #include -#include #include "testutil.h" diff --git a/tests/test.cpp b/tests/test.cpp index fb65043..8904eec 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1,12 +1,9 @@ -#define CATCH_CONFIG_MAIN - #include #include #include #include #include #include -#include #include "testutil.h" diff --git a/tests/testutil.h b/tests/testutil.h index e5f8733..9e0a0f2 100644 --- a/tests/testutil.h +++ b/tests/testutil.h @@ -2,7 +2,9 @@ #include #include -#include +#include +#include +#include std::vector split(const std::string& s, char delim) { std::vector elems;