From 8c6964569f6f7873357850e70ec65634ea2837ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bukovsk=C3=BD?= <burlog@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:21:29 +0100 Subject: [PATCH 1/2] Fix using from_range with std::vector<>::const_iterator --- src/catch2/generators/catch_generators_range.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catch2/generators/catch_generators_range.hpp b/src/catch2/generators/catch_generators_range.hpp index b67c1590ee..55d673c236 100644 --- a/src/catch2/generators/catch_generators_range.hpp +++ b/src/catch2/generators/catch_generators_range.hpp @@ -91,7 +91,7 @@ class IteratorGenerator final : public IGenerator<T> { template <typename InputIterator, typename InputSentinel, - typename ResultType = typename std::iterator_traits<InputIterator>::value_type> + typename ResultType = std::remove_const_t<typename std::iterator_traits<InputIterator>::value_type>> GeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) { return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to)); } From 4cd7c0ed181627b6b1b1201bec69395764f15114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bukovsk=C3=BD?= <burlog@seznam.cz> Date: Sat, 30 Nov 2024 20:17:02 +0100 Subject: [PATCH 2/2] add meson option to not install library --- meson_options.txt | 1 + src/catch2/meson.build | 37 ++++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index 7690487358..b460f2de94 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,2 @@ option('tests', type: 'boolean', value: true, description: 'Build the unit tests') +option('install', type: 'boolean', value: true, description: 'Install the library') diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 65be34378a..2eb539913b 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -16,6 +16,7 @@ configure_file( format: 'cmake@', install_dir: get_option('includedir') / 'catch2', configuration: conf_data, + install: get_option('install') ) fs = import('fs') @@ -339,7 +340,9 @@ foreach file : headers endif endforeach - install_headers(file, subdir: join_paths(include_subdir, folder)) + if get_option('install') + install_headers(file, subdir: join_paths(include_subdir, folder)) + endif endforeach catch2_dependencies = [] @@ -356,7 +359,7 @@ catch2 = static_library( sources, dependencies: catch2_dependencies, include_directories: '..', - install: true, + install: get_option('install'), ) catch2_dep = declare_dependency( @@ -364,19 +367,21 @@ catch2_dep = declare_dependency( include_directories: '..', ) -pkg.generate( - catch2, - filebase: 'catch2', - description: 'A modern, C++-native, test framework for C++14 and above', - url: 'https://github.com/catchorg/Catch2', -) +if get_option('install') + pkg.generate( + catch2, + filebase: 'catch2', + description: 'A modern, C++-native, test framework for C++14 and above', + url: 'https://github.com/catchorg/Catch2', + ) +endif catch2_with_main = static_library( 'Catch2Main', 'internal/catch_main.cpp', link_with: catch2, include_directories: '..', - install: true, + install: get_option('install'), ) catch2_with_main_dep = declare_dependency( @@ -384,9 +389,11 @@ catch2_with_main_dep = declare_dependency( include_directories: '..', ) -pkg.generate( - catch2_with_main, - filebase: 'catch2-with-main', - description: 'A modern, C++-native, test framework for C++14 and above (links in default main)', - requires: 'catch2 = ' + meson.project_version(), -) +if get_option('install') + pkg.generate( + catch2_with_main, + filebase: 'catch2-with-main', + description: 'A modern, C++-native, test framework for C++14 and above (links in default main)', + requires: 'catch2 = ' + meson.project_version(), + ) +endif