diff --git a/configure b/configure index 0eeb9c2ba1bf..b4b3036114cb 100755 --- a/configure +++ b/configure @@ -627,6 +627,8 @@ enable_option_checking=fatal ac_subst_vars='subdirs_extra LTLIBOBJS LIBOBJS +CATCH2_LIBS +CATCH2_CFLAGS RESCOMP DLLTOOL GCC @@ -1091,6 +1093,7 @@ enable_nanox with_libpng with_libjpeg with_libtiff +with_catch2 with_libjbig with_libxpm with_libiconv @@ -1443,7 +1446,9 @@ WEBKIT_LIBS CAIRO_CFLAGS CAIRO_LIBS GST_CFLAGS -GST_LIBS' +GST_LIBS +CATCH2_CFLAGS +CATCH2_LIBS' ac_subdirs_all='src/expat/expat' # Initialize some variables set by options. @@ -2352,6 +2357,7 @@ Optional Packages: --with-libpng use libpng (PNG image format) --with-libjpeg use libjpeg (JPEG file format) --with-libtiff use libtiff (TIFF file format) + --with-catch2 use catch2 (testing framework) --without-libjbig don't use libjbig in libtiff even if available --with-libxpm use libxpm (XPM file format) --with-libiconv use libiconv (character conversion) @@ -2485,6 +2491,9 @@ Some influential environment variables: CAIRO_LIBS linker flags for CAIRO, overriding pkg-config GST_CFLAGS C compiler flags for GST, overriding pkg-config GST_LIBS linker flags for GST, overriding pkg-config + CATCH2_CFLAGS + C compiler flags for CATCH2, overriding pkg-config + CATCH2_LIBS linker flags for CATCH2, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4723,6 +4732,42 @@ fi eval "$wx_cv_use_libtiff" + +# Check whether --with-catch2 was given. +if test "${with_catch2+set}" = set; then : + withval=$with_catch2; + if test "$withval" = yes; then + wx_cv_use_catch2='wxUSE_CATCH2=yes' + elif test "$withval" = no; then + wx_cv_use_catch2='wxUSE_CATCH2=no' + elif test "$withval" = sys; then + wx_cv_use_catch2='wxUSE_CATCH2=sys' + elif test "$withval" = builtin; then + wx_cv_use_catch2='wxUSE_CATCH2=builtin' + else + as_fn_error $? "Invalid value for --with-catch2: should be yes, no, sys, or builtin" "$LINENO" 5 + fi + +else + + if test "DEFAULT_wxUSE_CATCH2" = no; then + value=no + elif test "$wxUSE_ALL_FEATURES" = no; then + value=no + elif test "$wxUSE_SYS_LIBS" = no; then + value=builtin + else + value=yes + fi + + wx_cv_use_catch2="wxUSE_CATCH2=$value" + +fi + + + eval "$wx_cv_use_catch2" + + if test "$wxUSE_LIBTIFF" = "builtin" ; then wxUSE_LIBJBIG=no else @@ -44078,13 +44123,113 @@ fi if test "$wxUSE_TESTS_SUBDIR" != "no"; then SUBDIRS="$SUBDIRS tests" + if test "$wxUSE_CATCH2" != "builtin"; then + if test -n "$PKG_CONFIG"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for catch2 < 3" >&5 +$as_echo_n "checking for catch2 < 3... " >&6; } + +if test -n "$CATCH2_CFLAGS"; then + pkg_cv_CATCH2_CFLAGS="$CATCH2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"catch2 < 3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "catch2 < 3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CATCH2_CFLAGS=`$PKG_CONFIG --cflags "catch2 < 3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CATCH2_LIBS"; then + pkg_cv_CATCH2_LIBS="$CATCH2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"catch2 < 3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "catch2 < 3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CATCH2_LIBS=`$PKG_CONFIG --libs "catch2 < 3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CATCH2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "catch2 < 3" 2>&1` + else + CATCH2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "catch2 < 3" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CATCH2_PKG_ERRORS" >&5 + + + if test "$wxUSE_CATCH2" = "sys"; then + as_fn_error $? "system catch2 library not found! \ +Use --with-catch2=builtin to use built-in version" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: system catch2 library not found, \ +will use built-in instead" >&5 +$as_echo "$as_me: WARNING: system catch2 library not found, \ +will use built-in instead" >&2;} + wxUSE_CATCH2=builtin + fi +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + if test "$wxUSE_CATCH2" = "sys"; then + as_fn_error $? "system catch2 library not found! \ +Use --with-catch2=builtin to use built-in version" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: system catch2 library not found, \ +will use built-in instead" >&5 +$as_echo "$as_me: WARNING: system catch2 library not found, \ +will use built-in instead" >&2;} + wxUSE_CATCH2=builtin + fi +else + CATCH2_CFLAGS=$pkg_cv_CATCH2_CFLAGS + CATCH2_LIBS=$pkg_cv_CATCH2_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: system catch2 library not found, will use built-in instead" >&5 +$as_echo "$as_me: WARNING: system catch2 library not found, will use built-in instead" >&2;} + wxUSE_CATCH2=builtin + fi + fi + if test "$wxUSE_CATCH2" = "builtin"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether catch2/catch.hpp exists" >&5 $as_echo_n "checking whether catch2/catch.hpp exists... " >&6; } - if ! test -f "$srcdir/3rdparty/catch/single_include/catch2/catch.hpp" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + if ! test -f "$srcdir/3rdparty/catch/single_include/catch2/catch.hpp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? " - CATCH (C++ Automated Test Cases in Headers) is required, the required file + as_fn_error $? " + CATCH2 (C++ Automated Test Cases in Headers) is required, the required file $srcdir/3rdparty/catch/single_include/catch2/catch.hpp couldn't be found. You might need to run @@ -44092,9 +44237,10 @@ $as_echo "no" >&6; } git submodule update --init 3rdparty/catch to fix this." "$LINENO" 5 - else + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CXXFLAGS="-I$wx_top_builddir/3rdparty/catch/single_include $CXXFLAGS" fi fi diff --git a/configure.in b/configure.in index 52b913aaaf18..e449e06b74d8 100644 --- a/configure.in +++ b/configure.in @@ -513,6 +513,7 @@ dnl --------------------------------------------------------------------------- WX_ARG_SYS_WITH(libpng, [ --with-libpng use libpng (PNG image format)], wxUSE_LIBPNG) WX_ARG_SYS_WITH(libjpeg, [ --with-libjpeg use libjpeg (JPEG file format)], wxUSE_LIBJPEG) WX_ARG_SYS_WITH(libtiff, [ --with-libtiff use libtiff (TIFF file format)], wxUSE_LIBTIFF) +WX_ARG_SYS_WITH(catch2, [ --with-catch2 use catch2 (testing framework)], wxUSE_CATCH2) dnl We don't provide built-in version of this library, so if the use of system dnl libraries is explicitly disabled, we can't use it at all. @@ -2043,6 +2044,7 @@ else fi dnl Find pkg-config outside of any conditional. Done before any PKG_* call. +dnl This sets the PKG_CONFIG variable. PKG_PROG_PKG_CONFIG dnl When cross-compiling for another system from Linux, don't use .pc files on @@ -7892,12 +7894,31 @@ if test "$wxUSE_TESTS_SUBDIR" != "no"; then dnl Configure tests directory SUBDIRS="$SUBDIRS tests" - dnl Check for catch (C++ Automated Test Cases in Headers) availability. - AC_MSG_CHECKING([whether catch2/catch.hpp exists]) - if ! test -f "$srcdir/3rdparty/catch/single_include/catch2/catch.hpp" ; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([ - CATCH (C++ Automated Test Cases in Headers) is required, the required file + dnl Check for catch (C++ Automated Test Cases in Headers) availability. + if test "$wxUSE_CATCH2" != "builtin"; then + if test -n "$PKG_CONFIG"; then + dnl TODO: Support catch2 version 3, which does not + dnl ship a catch2/catch.hpp header anymore. + PKG_CHECK_MODULES([CATCH2], [catch2 < 3],, [ + if test "$wxUSE_CATCH2" = "sys"; then + AC_MSG_ERROR([system catch2 library not found! \ +Use --with-catch2=builtin to use built-in version]) + else + AC_MSG_WARN([system catch2 library not found, \ +will use built-in instead]) + wxUSE_CATCH2=builtin + fi]) + else + AC_MSG_WARN([system catch2 library not found, will use built-in instead]) + wxUSE_CATCH2=builtin + fi + fi + if test "$wxUSE_CATCH2" = "builtin"; then + AC_MSG_CHECKING([whether catch2/catch.hpp exists]) + if ! test -f "$srcdir/3rdparty/catch/single_include/catch2/catch.hpp"; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([ + CATCH2 (C++ Automated Test Cases in Headers) is required, the required file $srcdir/3rdparty/catch/single_include/catch2/catch.hpp couldn't be found. You might need to run @@ -7905,8 +7926,9 @@ if test "$wxUSE_TESTS_SUBDIR" != "no"; then git submodule update --init 3rdparty/catch to fix this.]) - else + fi AC_MSG_RESULT([yes]) + CXXFLAGS="-I$wx_top_builddir/3rdparty/catch/single_include $CXXFLAGS" fi fi diff --git a/tests/Makefile.in b/tests/Makefile.in index 1adca31cda4b..694ae418eb0d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -57,8 +57,7 @@ LIBDIRNAME = $(wx_top_builddir)/lib TEST_CXXFLAGS = $(__test_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \ - -DwxUSE_GUI=0 -I$(top_srcdir)/3rdparty/catch/single_include $(WX_CXXFLAGS) \ - $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -DwxUSE_GUI=0 $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) TEST_OBJECTS = \ test_test.o \ test_anytest.o \ @@ -150,9 +149,8 @@ TEST_ODEP = $(_____pch_testprec_test_testprec_h_gch___depname) TEST_DRAWING_CXXFLAGS = $(__test_drawing_PCH_INC) $(WX_CPPFLAGS) \ -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ - -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 \ - -I$(top_srcdir)/3rdparty/catch/single_include $(WX_CXXFLAGS) \ - $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) \ + $(CPPFLAGS) $(CXXFLAGS) TEST_DRAWING_OBJECTS = \ test_drawing_test.o \ test_drawing_drawing.o \ @@ -170,8 +168,8 @@ TEST_DRAWINGPLUGIN_OBJECTS = \ TEST_GUI_CXXFLAGS = $(__test_gui_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \ - -I$(srcdir)/../samples -I$(top_srcdir)/3rdparty/catch/single_include \ - $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -I$(srcdir)/../samples $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) TEST_GUI_OBJECTS = \ $(__test_gui___win32rc) \ test_gui_asserthelper.o \ @@ -283,8 +281,7 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname) TEST_ALLHEADERS_CXXFLAGS = $(__test_allheaders_PCH_INC) $(WX_CPPFLAGS) \ -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ - -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../samples \ - -I$(top_srcdir)/3rdparty/catch/single_include $(WX_CXXFLAGS) \ + -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../samples $(WX_CXXFLAGS) \ $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) TEST_ALLHEADERS_OBJECTS = \ $(__test_allheaders___win32rc) \ @@ -326,6 +323,7 @@ TEST_ALLHEADERS_ODEP = \ @COND_SHARED_1_USE_GUI_1@ = \ @COND_SHARED_1_USE_GUI_1@ $(DLLPREFIX_MODULE)test_drawingplugin.$(SO_SUFFIX_MODULE) @COND_USE_GUI_1@__test_gui___depname = test_gui$(EXEEXT) +@COND_PLATFORM_WIN32_1@__test_gui___win32rc = test_gui_sample_rc.o @COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_gui_app_Contents_PkgInfo___depname \ @COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_gui.app/Contents/PkgInfo @COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_gui_bundle___depname \ @@ -340,7 +338,6 @@ TEST_ALLHEADERS_ODEP = \ @COND_TOOLKIT_OSX_COCOA@ = $(__test_gui_app_Contents_PkgInfo___depname) @COND_TOOLKIT_OSX_IPHONE@____test_gui_BUNDLE_TGT_REF_DEP \ @COND_TOOLKIT_OSX_IPHONE@ = $(__test_gui_app_Contents_PkgInfo___depname) -@COND_PLATFORM_WIN32_1@__test_gui___win32rc = test_gui_sample_rc.o @COND_GCC_PCH_1@__test_gui_PCH_INC = -I./.pch/testprec_test_gui @COND_ICC_PCH_1@__test_gui_PCH_INC = $(ICC_PCH_USE_SWITCH) \ @COND_ICC_PCH_1@ ./.pch/testprec_test_gui/testprec.h.gch @@ -365,6 +362,8 @@ COND_MONOLITHIC_0___WXLIB_PROPGRID_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_PROPGRID_p = $(COND_MONOLITHIC_0___WXLIB_PROPGRID_p) @COND_USE_GUI_1@__test_allheaders___depname = test_allheaders$(EXEEXT) +@COND_PLATFORM_WIN32_1@__test_allheaders___win32rc = \ +@COND_PLATFORM_WIN32_1@ test_allheaders_sample_rc.o @COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_allheaders_app_Contents_PkgInfo___depname \ @COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_allheaders.app/Contents/PkgInfo @COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_allheaders_bundle___depname \ @@ -382,8 +381,6 @@ COND_MONOLITHIC_0___WXLIB_PROPGRID_p = \ @COND_TOOLKIT_OSX_IPHONE@____test_allheaders_BUNDLE_TGT_REF_DEP \ @COND_TOOLKIT_OSX_IPHONE@ = \ @COND_TOOLKIT_OSX_IPHONE@ $(__test_allheaders_app_Contents_PkgInfo___depname) -@COND_PLATFORM_WIN32_1@__test_allheaders___win32rc = \ -@COND_PLATFORM_WIN32_1@ test_allheaders_sample_rc.o @COND_GCC_PCH_1@__test_allheaders_PCH_INC = \ @COND_GCC_PCH_1@ -I./.pch/testprec_test_allheaders @COND_ICC_PCH_1@__test_allheaders_PCH_INC = \ @@ -893,7 +890,7 @@ test_drawingplugin_pluginsample.o: $(srcdir)/drawing/pluginsample.cpp $(CXXC) -c -o $@ $(TEST_DRAWINGPLUGIN_CXXFLAGS) $(srcdir)/drawing/pluginsample.cpp test_gui_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_GUI_ODEP) - $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/single_include + $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include test_gui_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/asserthelper.cpp @@ -1211,7 +1208,7 @@ test_gui_xrctest.o: $(srcdir)/xml/xrctest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/xml/xrctest.cpp test_allheaders_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_ALLHEADERS_ODEP) - $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/single_include + $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include test_allheaders_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_ALLHEADERS_ODEP) $(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/asserthelper.cpp diff --git a/tests/test.bkl b/tests/test.bkl index 0b8e22233395..98659b8c0264 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -10,8 +10,6 @@