diff options
author | Luca Di Sera <luca.disera@qt.io> | 2023-05-04 12:34:30 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2023-05-11 09:17:18 +0000 |
commit | d927a87b765681dc7fb1bf2ba81a113000141d7b (patch) | |
tree | b4589f4017f16aa22b473d81afc287a6bae86675 | |
parent | ef4b78f0d32aa537ac57c957061691e335a9f110 (diff) | |
download | qttools-d927a87b765681dc7fb1bf2ba81a113000141d7b.tar.gz |
QDoc: Move the catch dependency under src
QDoc uses the Catch2 testing-framework for some of its tests.
The dependency is included as a header-only library that lived under
"tests/auto/qdoc/".
Due to a certain restructuring that is happening in QDoc, with one of the
goals, among others, being to increase the locality of QDoc-related code
under "src/qdoc", the Catch2 dependency is now moved under "src/qdoc".
To allow tests that depend on it to keep their usages without requiring
relative paths from the "tests" directory to the "src" directory, a
library target, "Qt::QDocCatchPrivate" was created for the dependency.
The target can be linked to to have access to the Catch2 dependency and
the Catch2 header can be included with "catch/catch.hpp".
To allow for this specific include path to work, the internal directory
structure of the Catch2 dependency was slightly modified, adding some
additional intermediate directories in between its root and the library
header.
Tests under "tests/auto/qdoc" that used the dependency now link to it
instead. Hence, their "CMakeLists.txt" files were modified to avoid
using the dependency as an include directory and instead use
"Qt::QDocCatchPrivate" as a library.
The relevant inclusion of the Catch2 header in those sources was
modified to respect the new "catch/catch.hpp" path.
Change-Id: Ifd462f582d197f78a8ffbbbe7b2cf9ae25dbc991
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
27 files changed, 34 insertions, 21 deletions
diff --git a/src/qdoc/CMakeLists.txt b/src/qdoc/CMakeLists.txt index c25c4a8ee..bcd7c46bb 100644 --- a/src/qdoc/CMakeLists.txt +++ b/src/qdoc/CMakeLists.txt @@ -1,6 +1,8 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause +add_subdirectory(catch) + if(QT_FEATURE_qdoc AND QT_FEATURE_clangcpp) add_subdirectory(qdoc) endif() diff --git a/tests/auto/qdoc/catch/CATCH_LICENSE.txt b/src/qdoc/catch/CATCH_LICENSE.txt index 36b7cd93c..36b7cd93c 100644 --- a/tests/auto/qdoc/catch/CATCH_LICENSE.txt +++ b/src/qdoc/catch/CATCH_LICENSE.txt diff --git a/src/qdoc/catch/CMakeLists.txt b/src/qdoc/catch/CMakeLists.txt new file mode 100644 index 000000000..3f933a1dd --- /dev/null +++ b/src/qdoc/catch/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_3rdparty_header_module(QDocCatchPrivate + EXTERNAL_HEADERS_DIR include +) + +qt_internal_extend_target(QDocCatchPrivate + PUBLIC_INCLUDE_DIRECTORIES + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/QtQDocCatch> +) diff --git a/tests/auto/qdoc/catch/catch.hpp b/src/qdoc/catch/include/catch/catch.hpp index 9b309bddc..9b309bddc 100644 --- a/tests/auto/qdoc/catch/catch.hpp +++ b/src/qdoc/catch/include/catch/catch.hpp diff --git a/tests/auto/qdoc/catch/qt_attribution.json b/src/qdoc/catch/qt_attribution.json index 9380a83e8..9380a83e8 100644 --- a/tests/auto/qdoc/catch/qt_attribution.json +++ b/src/qdoc/catch/qt_attribution.json diff --git a/tests/auto/qdoc/catch/CMakeLists.txt b/tests/auto/qdoc/catch/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/auto/qdoc/catch/CMakeLists.txt +++ /dev/null diff --git a/tests/auto/qdoc/catch_generators/src/generators/combinators/cycle_generator.h b/tests/auto/qdoc/catch_generators/src/generators/combinators/cycle_generator.h index 5ad875d76..b60600747 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/combinators/cycle_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/combinators/cycle_generator.h @@ -6,7 +6,7 @@ #include "../../namespaces.h" #include "../../utilities/semantics/generator_handler.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <vector> diff --git a/tests/auto/qdoc/catch_generators/src/generators/combinators/oneof_generator.h b/tests/auto/qdoc/catch_generators/src/generators/combinators/oneof_generator.h index 8a635cdc6..5de9dcb6c 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/combinators/oneof_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/combinators/oneof_generator.h @@ -7,7 +7,7 @@ #include "../../utilities/statistics/percentages.h" #include "../../utilities/semantics/generator_handler.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <vector> #include <random> diff --git a/tests/auto/qdoc/catch_generators/src/generators/k_partition_of_r_generator.h b/tests/auto/qdoc/catch_generators/src/generators/k_partition_of_r_generator.h index d1fa29c31..832ee2838 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/k_partition_of_r_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/k_partition_of_r_generator.h @@ -5,7 +5,7 @@ #include "../namespaces.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <random> #include <numeric> diff --git a/tests/auto/qdoc/catch_generators/src/generators/path_generator.h b/tests/auto/qdoc/catch_generators/src/generators/path_generator.h index 0aa56b348..875502e49 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/path_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/path_generator.h @@ -17,7 +17,7 @@ #endif -#include <catch.hpp> +#include <catch/catch.hpp> #include <random> diff --git a/tests/auto/qdoc/catch_generators/src/generators/qchar_generator.h b/tests/auto/qdoc/catch_generators/src/generators/qchar_generator.h index 6147fd0fb..33efc5ea4 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/qchar_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/qchar_generator.h @@ -7,7 +7,7 @@ #include "../utilities/semantics/move_into_vector.h" #include "combinators/oneof_generator.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <random> diff --git a/tests/auto/qdoc/catch_generators/src/generators/qstring_generator.h b/tests/auto/qdoc/catch_generators/src/generators/qstring_generator.h index 4c21fc3f3..fe854d22f 100644 --- a/tests/auto/qdoc/catch_generators/src/generators/qstring_generator.h +++ b/tests/auto/qdoc/catch_generators/src/generators/qstring_generator.h @@ -7,7 +7,7 @@ #include "qchar_generator.h" #include "../utilities/semantics/generator_handler.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <random> diff --git a/tests/auto/qdoc/catch_generators/src/utilities/semantics/generator_handler.h b/tests/auto/qdoc/catch_generators/src/utilities/semantics/generator_handler.h index 98a413bd3..328627512 100644 --- a/tests/auto/qdoc/catch_generators/src/utilities/semantics/generator_handler.h +++ b/tests/auto/qdoc/catch_generators/src/utilities/semantics/generator_handler.h @@ -5,7 +5,7 @@ #include "../../namespaces.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <optional> #include <cassert> diff --git a/tests/auto/qdoc/catch_generators/tests/CMakeLists.txt b/tests/auto/qdoc/catch_generators/tests/CMakeLists.txt index a53d5f44f..240f5ac63 100644 --- a/tests/auto/qdoc/catch_generators/tests/CMakeLists.txt +++ b/tests/auto/qdoc/catch_generators/tests/CMakeLists.txt @@ -15,6 +15,7 @@ qt_internal_add_test(tst_QDoc_Catch_Generators utilities/semantics/catch_generator_handler.cpp INCLUDE_DIRECTORIES ../src - ../../catch ../../catch_conversions + LIBRARIES + Qt::QDocCatchPrivate ) diff --git a/tests/auto/qdoc/catch_generators/tests/generators/catch_k_partition_of_r_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/catch_k_partition_of_r_generator.cpp index 6b3bbd85a..9055c5411 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/catch_k_partition_of_r_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/catch_k_partition_of_r_generator.cpp @@ -4,7 +4,7 @@ #include "namespaces.h" #include "generators/k_partition_of_r_generator.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <numeric> diff --git a/tests/auto/qdoc/catch_generators/tests/generators/catch_path_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/catch_path_generator.cpp index 8635ed940..71e9e50b4 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/catch_path_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/catch_path_generator.cpp @@ -12,7 +12,7 @@ #include <qt_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> #include <QString> #include <QStringList> diff --git a/tests/auto/qdoc/catch_generators/tests/generators/catch_qchar_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/catch_qchar_generator.cpp index 881ac730c..a072aff88 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/catch_qchar_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/catch_qchar_generator.cpp @@ -6,7 +6,7 @@ #include <qt_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> #include <QChar> diff --git a/tests/auto/qdoc/catch_generators/tests/generators/catch_qstring_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/catch_qstring_generator.cpp index 5f5999532..e99335dd0 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/catch_qstring_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/catch_qstring_generator.cpp @@ -7,7 +7,7 @@ #include <qt_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> using namespace QDOC_CATCH_GENERATORS_ROOT_NAMESPACE; diff --git a/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_cycle_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_cycle_generator.cpp index e2e441b71..43bae006b 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_cycle_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_cycle_generator.cpp @@ -4,7 +4,7 @@ #include "namespaces.h" #include "generators/combinators/cycle_generator.h" -#include <catch.hpp> +#include <catch/catch.hpp> using namespace QDOC_CATCH_GENERATORS_ROOT_NAMESPACE; diff --git a/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_oneof_generator.cpp b/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_oneof_generator.cpp index cc178a239..191ac9dfe 100644 --- a/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_oneof_generator.cpp +++ b/tests/auto/qdoc/catch_generators/tests/generators/combinators/catch_oneof_generator.cpp @@ -11,7 +11,7 @@ #include "utilities/statistics/distribution.h" #include "utilities/semantics/copy_value.h" -#include <catch.hpp> +#include <catch/catch.hpp> #include <cmath> #include <iterator> diff --git a/tests/auto/qdoc/catch_generators/tests/main.cpp b/tests/auto/qdoc/catch_generators/tests/main.cpp index 70473bc7b..cec18afba 100644 --- a/tests/auto/qdoc/catch_generators/tests/main.cpp +++ b/tests/auto/qdoc/catch_generators/tests/main.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_RUNNER -#include <catch.hpp> +#include <catch/catch.hpp> // A custom main was provided to avoid linking errors when using minGW // that were appearing in CI. diff --git a/tests/auto/qdoc/catch_generators/tests/utilities/semantics/catch_generator_handler.cpp b/tests/auto/qdoc/catch_generators/tests/utilities/semantics/catch_generator_handler.cpp index 4f95ca9df..913646be5 100644 --- a/tests/auto/qdoc/catch_generators/tests/utilities/semantics/catch_generator_handler.cpp +++ b/tests/auto/qdoc/catch_generators/tests/utilities/semantics/catch_generator_handler.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include <catch.hpp> +#include <catch/catch.hpp> #include "namespaces.h" #include "utilities/semantics/generator_handler.h" diff --git a/tests/auto/qdoc/qdoc/CMakeLists.txt b/tests/auto/qdoc/qdoc/CMakeLists.txt index fdebe3541..616139712 100644 --- a/tests/auto/qdoc/qdoc/CMakeLists.txt +++ b/tests/auto/qdoc/qdoc/CMakeLists.txt @@ -15,7 +15,8 @@ qt_internal_add_test(tst_QDoc ${QDOC_SOURCE_DIRECTORY}/filesystem/fileresolver.cpp INCLUDE_DIRECTORIES ${QDOC_INCLUDE_DIRECTORY} - ../catch/ ../catch_generators/ ../catch_conversions/ + LIBRARIES + Qt::QDocCatchPrivate ) diff --git a/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_directorypath.cpp b/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_directorypath.cpp index f5f594d64..ed31a50ec 100644 --- a/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_directorypath.cpp +++ b/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_directorypath.cpp @@ -3,7 +3,7 @@ #include <qdoc_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> #include <boundaries/filesystem/directorypath.h> diff --git a/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_filepath.cpp b/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_filepath.cpp index 0c2877a17..167aafc85 100644 --- a/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_filepath.cpp +++ b/tests/auto/qdoc/qdoc/boundaries/filesystem/catch_filepath.cpp @@ -3,7 +3,7 @@ #include <qdoc_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> #include <boundaries/filesystem/filepath.h> diff --git a/tests/auto/qdoc/qdoc/filesystem/catch_fileresolver.cpp b/tests/auto/qdoc/qdoc/filesystem/catch_fileresolver.cpp index 89f76f87c..440de7bee 100644 --- a/tests/auto/qdoc/qdoc/filesystem/catch_fileresolver.cpp +++ b/tests/auto/qdoc/qdoc/filesystem/catch_fileresolver.cpp @@ -3,7 +3,7 @@ #include <qdoc_catch_conversions.h> -#include <catch.hpp> +#include <catch/catch.hpp> #include <filesystem/fileresolver.h> diff --git a/tests/auto/qdoc/qdoc/main.cpp b/tests/auto/qdoc/qdoc/main.cpp index 70473bc7b..cec18afba 100644 --- a/tests/auto/qdoc/qdoc/main.cpp +++ b/tests/auto/qdoc/qdoc/main.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_RUNNER -#include <catch.hpp> +#include <catch/catch.hpp> // A custom main was provided to avoid linking errors when using minGW // that were appearing in CI. |