Skip to content

Commit

Permalink
Use Catch2 amalgamated file
Browse files Browse the repository at this point in the history
This is to avoid the compilation of a gazillion files for Catch2
  • Loading branch information
pierre-dejoue committed Aug 11, 2023
1 parent 6819470 commit f9130f4
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 13 deletions.
16 changes: 14 additions & 2 deletions cmake/third_party/catch2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ Include(FetchContent)
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.2.0
GIT_TAG v3.4.0
)

FetchContent_MakeAvailable(catch2)
FetchContent_Populate(catch2)

add_library(Catch2WithMain STATIC
${catch2_SOURCE_DIR}/extras/catch_amalgamated.cpp
${catch2_SOURCE_DIR}/extras/catch_amalgamated.hpp
)

target_include_directories(Catch2WithMain
PUBLIC
${catch2_SOURCE_DIR}/extras
)

add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain)
3 changes: 1 addition & 2 deletions src/tests/picross/src/bench_line_alternatives.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <catch2/benchmark/catch_benchmark_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/test_helpers.h>
#include <utils/text_io.h>
Expand Down
3 changes: 1 addition & 2 deletions src/tests/picross/src/bench_solver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <catch2/benchmark/catch_benchmark_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/text_io.h>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/picross/src/test_binomial.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>

#include "binomial.h"

Expand Down
2 changes: 1 addition & 1 deletion src/tests/picross/src/test_line_alternatives.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/test_helpers.h>
#include <utils/text_io.h>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/picross/src/test_line_constraint.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/text_io.h>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/picross/src/test_solver.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/test_helpers.h>
#include <utils/text_io.h>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/picross/src/test_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <picross/picross.h>
#include <utils/text_io.h>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/stdutils/src/test_io.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>

#include <stdutils/io.h>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/stdutils/src/test_span.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch_amalgamated.hpp>
#include <stdutils/span.h>

#include <vector>
Expand Down

0 comments on commit f9130f4

Please sign in to comment.