build: replace IN_WESTON with UNIT_TEST

Remove IN_WESTON in favour of the already defined UNIT_TEST which is
used to modify a compilation unit to expose more functions for unit
tests to prod at.

Originally IN_WESTON meant that compilation unit was being compiled for
use in the Weston compositor, but it probably never really did anything
more than change what WL_EXPORT means in matrix.c.

This patch not only simplifies the logic, but it fixes the Meson build
of test-matrix: IN_WESTON was defined there even when matrix.c was being
built outside of Weston, which caused it to depend on libwayland
headers, which were not included in the Meson build of test-matrix.
Test-matrix has no reason to depend in libwayland in any way, so this
patch fixes that.

Reported-by: Greg V <greg@unrelenting.technology>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
This commit is contained in:
Pekka Paalanen 2018-12-20 11:53:21 +02:00 committed by Daniel Stone
parent 0f0409835d
commit a23ce29506
3 changed files with 8 additions and 12 deletions

View File

@ -57,7 +57,7 @@ CLEANFILES = weston.ini \
install-libweston_moduleLTLIBRARIES install-moduleLTLIBRARIES: install-libLTLIBRARIES
lib_LTLIBRARIES = libweston-@LIBWESTON_MAJOR@.la
libweston_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
libweston_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS)
libweston_@LIBWESTON_MAJOR@_la_CFLAGS = $(AM_CFLAGS) \
$(COMPOSITOR_CFLAGS) $(EGL_CFLAGS) $(LIBDRM_CFLAGS)
libweston_@LIBWESTON_MAJOR@_la_LIBADD = $(COMPOSITOR_LIBS) \
@ -111,7 +111,7 @@ dist_libweston_@LIBWESTON_MAJOR@_data_DATA = \
protocol/weston-debug.xml
lib_LTLIBRARIES += libweston-desktop-@LIBWESTON_MAJOR@.la
libweston_desktop_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
libweston_desktop_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS)
libweston_desktop_@LIBWESTON_MAJOR@_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
libweston_desktop_@LIBWESTON_MAJOR@_la_LIBADD = \
libweston-@LIBWESTON_MAJOR@.la \
@ -184,8 +184,7 @@ BUILT_SOURCES += $(nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES)
bin_PROGRAMS += weston
weston_LDFLAGS = -export-dynamic
weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON \
-DMODULEDIR='"$(moduledir)"' \
weston_CPPFLAGS = $(AM_CPPFLAGS) -DMODULEDIR='"$(moduledir)"' \
-DXSERVER_PATH='"@XSERVER_PATH@"'
weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBINPUT_BACKEND_CFLAGS) \
$(PTHREAD_CFLAGS)
@ -1026,8 +1025,7 @@ desktop_shell_la_CPPFLAGS = \
-I$(top_srcdir)/libweston \
-I$(top_builddir)/desktop-shell \
-DMODULEDIR='"$(moduledir)"' \
-DLIBEXECDIR='"$(libexecdir)"' \
-DIN_WESTON
-DLIBEXECDIR='"$(libexecdir)"'
desktop_shell_la_LDFLAGS = -module -avoid-version
desktop_shell_la_LIBADD = libshared.la libweston-desktop-@LIBWESTON_MAJOR@.la $(COMPOSITOR_LIBS)
@ -1053,8 +1051,7 @@ fullscreen_shell_la_CPPFLAGS = \
-I$(top_builddir)/protocol \
-I$(top_srcdir)/shared \
-I$(top_builddir)/libweston \
-I$(top_srcdir)/libweston \
-DIN_WESTON
-I$(top_srcdir)/libweston
fullscreen_shell_la_LDFLAGS = -module -avoid-version
fullscreen_shell_la_LIBADD = \

View File

@ -67,7 +67,6 @@ cc = meson.get_compiler('c')
global_args = []
global_args_maybe = [
'-fvisibility=hidden',
'-DIN_WESTON',
]
global_wnoargs_maybe = [
'unused-parameter',

View File

@ -31,10 +31,10 @@
#include <stdlib.h>
#include <math.h>
#ifdef IN_WESTON
#include <wayland-server.h>
#else
#ifdef UNIT_TEST
#define WL_EXPORT
#else
#include <wayland-server.h>
#endif
#include "matrix.h"