From a23ce2950643ffdd59b4b81ec9c957d879a3663a Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 20 Dec 2018 11:53:21 +0200 Subject: [PATCH] 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 Signed-off-by: Pekka Paalanen --- Makefile.am | 13 +++++-------- meson.build | 1 - shared/matrix.c | 6 +++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1493f697..24e754e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 = \ diff --git a/meson.build b/meson.build index 3eaf2c0a..dc7c1bc7 100644 --- a/meson.build +++ b/meson.build @@ -67,7 +67,6 @@ cc = meson.get_compiler('c') global_args = [] global_args_maybe = [ '-fvisibility=hidden', - '-DIN_WESTON', ] global_wnoargs_maybe = [ 'unused-parameter', diff --git a/shared/matrix.c b/shared/matrix.c index 7feea431..605db83c 100644 --- a/shared/matrix.c +++ b/shared/matrix.c @@ -31,10 +31,10 @@ #include #include -#ifdef IN_WESTON -#include -#else +#ifdef UNIT_TEST #define WL_EXPORT +#else +#include #endif #include "matrix.h"