From efb3732f6a95ac695a4e8bd8bf8243d0fddcd805 Mon Sep 17 00:00:00 2001 From: Sergio Prado Date: Sat, 10 Apr 2021 14:43:03 -0300 Subject: [PATCH] Build unit tests only when --enable-unittests is passed Building unit tests by default requires all dependencies to be installed (jpeg, tiff, etc) and users may not want that. So let's disable the build of unit tests by default and introduce --enable-unittests configure option to enable it. Signed-off-by: Sergio Prado --- .azure-pipelines.yml | 4 ++-- Makefile.am | 8 ++++++-- configure.ac | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 64c1c1711..398b1608d 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -23,7 +23,7 @@ stages: - bash: | export CFLAGS="-ggdb3 -O2" - ./autogen.sh --prefix=/usr --enable-warnaserror + ./autogen.sh --prefix=/usr --enable-warnaserror --enable-unittests make -j4 sudo make install displayName: 'Build and Install libgdiplus' @@ -87,7 +87,7 @@ stages: - bash: | export CFLAGS="-m64 -arch x86_64 -mmacosx-version-min=10.9" export LDFLAGS="-m64 -arch x86_64" - ./autogen.sh --prefix=/tmp/libgdiplus-dev --enable-warnaserror --without-x11 --host=x86_64-apple-darwin13.0.0 --build=x86_64-apple-darwin13.0.0 + ./autogen.sh --prefix=/tmp/libgdiplus-dev --enable-warnaserror --enable-unittests --without-x11 --host=x86_64-apple-darwin13.0.0 --build=x86_64-apple-darwin13.0.0 make -j4 make install displayName: 'Build and Install libgdiplus' diff --git a/Makefile.am b/Makefile.am index 9ac01e109..d581805c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,11 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src tests -DIST_SUBDIRS = src tests +if BUILD_UNIT_TESTS +SUBDIRS_TESTS = tests +endif + +SUBDIRS = src $(SUBDIRS_TESTS) +DIST_SUBDIRS = src $(SUBDIRS_TESTS) pkgconfigdir = $(libdir)/pkgconfig diff --git a/configure.ac b/configure.ac index 68f1852b2..eec847ca6 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,10 @@ AC_ARG_WITH(pango, [ --with-pango use Pango to measure and draw text GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -std=gnu11" +AC_ARG_ENABLE(unittests, AS_HELP_STRING([--enable-unittests],[Enable building unit tests.]),[unittests=yes],[unittests=no]) + +AM_CONDITIONAL([BUILD_UNIT_TESTS], [test x$unittests = xyes]) + AC_ARG_ENABLE(warnaserror, AS_HELP_STRING([--enable-warnaserror],[Enable treating warnings as errors.]),[warnaserror=yes],[warnaserror=no]) if test $warnaserror = "yes"; then