summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-10-25 20:02:28 +0300
committerAndrei Karas <akaras@inbox.ru>2017-10-25 20:02:28 +0300
commit7bbd39e0da04cee932f4afe6a4c85ebb78f39a81 (patch)
tree220a6f44ff80ed1d5242ab469d91ce4a28e03f72
parent880fa28099e828821378a9c83a7218ae5bfa3110 (diff)
downloadplus-7bbd39e0da04cee932f4afe6a4c85ebb78f39a81.tar.gz
plus-7bbd39e0da04cee932f4afe6a4c85ebb78f39a81.tar.bz2
plus-7bbd39e0da04cee932f4afe6a4c85ebb78f39a81.tar.xz
plus-7bbd39e0da04cee932f4afe6a4c85ebb78f39a81.zip
Add configure options for build with system catch and doctest.
-rwxr-xr-xconfigure.ac20
-rw-r--r--src/Makefile.am3
-rw-r--r--src/maingui.cpp8
-rw-r--r--src/unittests/unittests.h8
4 files changed, 38 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index a9ed26981..6ac21107e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -619,18 +619,35 @@ AC_ARG_ENABLE(unittests,
unittests_enabled=true
unittests_catch=true
unittests_doctest=false
+ unittests_embed=true
;;
catch)
unittests_enabled=true
unittests_catch=true
unittests_doctest=false
+ unittests_embed=true
;;
doctest)
unittests_enabled=true
unittests_catch=false
unittests_doctest=true
+ unittests_embed=true
;;
- no) unittests_enabled=false
+ systemcatch)
+ unittests_enabled=true
+ unittests_catch=true
+ unittests_doctest=false
+ unittests_embed=false
+ ;;
+ systemdoctest)
+ unittests_enabled=true
+ unittests_catch=false
+ unittests_doctest=true
+ unittests_embed=false
+ ;;
+ no)
+ unittests_enabled=false
+ unittests_embed=true
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-unittests) ;;
esac],[unittests_enabled=false])
@@ -638,6 +655,7 @@ esac],[unittests_enabled=false])
AM_CONDITIONAL(ENABLE_UNITTESTS, test x$unittests_enabled = xtrue)
AM_CONDITIONAL(ENABLE_UNITTESTS_CATCH, test x$unittests_catch = xtrue)
AM_CONDITIONAL(ENABLE_UNITTESTS_DOCTEST, test x$unittests_doctest = xtrue)
+AM_CONDITIONAL(ENABLE_UNITTESTS_EMBED, test x$unittests_embed = xtrue)
# Enable unit tests binaries only
AC_ARG_ENABLE(unittestsbin,
diff --git a/src/Makefile.am b/src/Makefile.am
index 7f22f0507..1b7ccd77f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,6 +37,9 @@ endif
if ENABLE_UNITTESTSBIN_DOCTEST
manaplustests_CXXFLAGS += -DUNITTESTS_DOCTEST
endif
+if ENABLE_UNITTESTS_EMBED
+manaplustests_CXXFLAGS += -DUNITTESTS_EMBED
+endif
dyecmd_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\" \
diff --git a/src/maingui.cpp b/src/maingui.cpp
index fc3df1b98..64fef6fbc 100644
--- a/src/maingui.cpp
+++ b/src/maingui.cpp
@@ -59,11 +59,19 @@ PRAGMA48(GCC diagnostic pop)
#include "resources/dye/dyepalette.h"
#ifdef UNITTESTS_CATCH
#define CATCH_CONFIG_RUNNER
+#ifdef UNITTESTS_EMBED
#include "unittests/catch.hpp"
+#else // UNITTESTS_EMBED
+#include <catch.hpp>
+#endif // UNITTESTS_EMBED
#endif // UNITTESTS_CATCH
#ifdef UNITTESTS_DOCTEST
#define DOCTEST_CONFIG_IMPLEMENT
+#ifdef UNITTESTS_EMBED
#include "unittests/doctest.h"
+#else // UNITTESTS_EMBED
+#include <doctest/doctest.h>
+#endif // UNITTESTS_EMBED
#endif // UNITTESTS_DOCTEST
#else // UNITTESTS
#include "utils/xml.h"
diff --git a/src/unittests/unittests.h b/src/unittests/unittests.h
index 672b2ca54..b0077cd70 100644
--- a/src/unittests/unittests.h
+++ b/src/unittests/unittests.h
@@ -24,7 +24,11 @@
#include "localconsts.h"
#ifdef UNITTESTS_CATCH
+#ifdef UNITTESTS_EMBED
#include "unittests/catch.hpp"
+#else // UNITTESTS_EMBED
+#include <catch.hpp>
+#endif // UNITTESTS_EMBED
#endif // UNITTESTS_CATCH
#ifdef UNITTESTS_DOCTEST
@@ -41,7 +45,11 @@
PRAGMA5(GCC diagnostic push)
PRAGMA5(GCC diagnostic ignored "-Wsuggest-override")
+#ifdef UNITTESTS_EMBED
#include "unittests/doctest.h"
+#else // UNITTESTS_EMBED
+#include <doctest/doctest.h>
+#endif // UNITTESTS_EMBED
PRAGMA5(GCC diagnostic pop)
#undef TEST_CASE