libnest2d: fix for new catch2

This commit is contained in:
Đoàn Trần Công Danh 2023-10-01 23:02:35 +07:00 committed by Đoàn Trần Công Danh
parent 9301b4c90a
commit dbbd780a36
2 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,32 @@
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-require_package(Catch2 2.9.1 REQUIRED NO_EXPORT)
+require_package(Catch2 "" REQUIRED NO_EXPORT)
add_executable(tests_clipper_nlopt
test.cpp
@@ -14,5 +14,5 @@ if (MSVC)
target_compile_options(tests_clipper_nlopt PRIVATE /bigobj)
endif ()
-target_link_libraries(tests_clipper_nlopt libnest2d Catch2::Catch2)
+target_link_libraries(tests_clipper_nlopt libnest2d Catch2::Catch2WithMain)
add_test(libnest2d_tests tests_clipper_nlopt)
--- a/tests/test.cpp
+++ b/tests/test.cpp
@@ -1,5 +1,4 @@
-#define CATCH_CONFIG_MAIN
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <fstream>
@@ -29,6 +28,7 @@ template<> struct _NumTag<LargeInt> { us
template<class T> struct _NumTag<boost::rational<T>> { using Type = RationalTag; };
using RectangleItem = libnest2d::Rectangle;
+using Approx = Catch::Approx;
namespace nfp {

View file

@ -6,7 +6,6 @@ build_style=cmake
configure_args="-DBUILD_SHARED_LIBS=ON -DLIBNEST2D_HEADER_ONLY=OFF
-DLIBNEST2D_BUILD_UNITTESTS=ON"
makedepends="clipper-devel nlopt-devel boost-devel catch2"
checkdepends="catch2"
short_desc="2D irregular bin packing and nesting library"
maintainer="Karl Nilsson <karl.robert.nilsson@gmail.com>"
license="LGPL-3.0-or-later"