blob: 6ab695e909654ec2fa66879b6ae0f25f03fb471e [file] [log] [blame]
From 283085496e06b5543771abe5cc746ff0b77cdd23 Mon Sep 17 00:00:00 2001
From: James Hilliard <james.hilliard1@gmail.com>
Date: Tue, 3 Mar 2020 15:27:51 -0700
Subject: [PATCH] build: add option to disable tests
When building for a product, tests are not needed.
Besides, one test requires a C++ compiler, which is not always
available.
So, add an option to configure to disable building tests altogether.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Upstream status:
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/66]
---
Makefile.am | 2 ++
configure.ac | 9 +++++++++
meson.build | 4 +++-
meson_options.txt | 4 ++++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index cc87392..d5d43e3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -162,6 +162,7 @@ pkgconfig_DATA += egl/wayland-egl.pc
include_HEADERS += egl/wayland-egl-backend.h
pkgconfig_DATA += egl/wayland-egl-backend.pc
+if ENABLE_TESTS
built_test_programs = \
array-test \
client-test \
@@ -295,6 +296,7 @@ os_wrappers_test_LDADD = libtest-runner.la
exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
exec_fd_leak_checker_LDADD = libtest-helpers.la
+endif
EXTRA_DIST += tests/scanner-test.sh \
protocol/tests.xml \
diff --git a/configure.ac b/configure.ac
index dda5e48..99b7c96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,13 @@ AC_ARG_ENABLE([libraries],
[],
[enable_libraries=yes])
+AC_ARG_ENABLE([tests],
+ [AC_HELP_STRING([--disable-tests],
+ [Disable compilation of test programs])],
+ [],
+ [enable_tests=yes])
+
+
AC_ARG_WITH([host-scanner],
[AC_HELP_STRING([--with-host-scanner],
[Use installed wayland-scanner from host PATH during build])],
@@ -99,6 +106,8 @@ AM_CONDITIONAL(USE_HOST_SCANNER, test "x$with_host_scanner" = xyes)
AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
+AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = xyes)
+
AC_ARG_WITH(icondir, [ --with-icondir=<dir> Look for cursor icons here],
[ ICONDIR=$withval],
[ ICONDIR=${datadir}/icons])
diff --git a/meson.build b/meson.build
index 5632f4e..b37bb7a 100644
--- a/meson.build
+++ b/meson.build
@@ -83,7 +83,9 @@ subdir('src')
if get_option('libraries')
subdir('cursor')
subdir('egl')
- subdir('tests')
+ if get_option('tests')
+ subdir('tests')
+ endif
endif
if get_option('documentation')
diff --git a/meson_options.txt b/meson_options.txt
index 76314f7..ab4be92 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,6 +2,10 @@ option('libraries',
description: 'Compile Wayland libraries',
type: 'boolean',
value: 'true')
+option('tests',
+ description: 'Compile Wayland tests',
+ type: 'boolean',
+ value: 'true')
option('documentation',
description: 'Build the documentation (requires Doxygen, dot, xmlto, xsltproc)',
type: 'boolean',
--
2.20.1