From d1ba53c0eabdc706a19d83f5845a48012a6eb566 Mon Sep 17 00:00:00 2001
From: NeKit <nekit1000@gmail.com>
Date: Sat, 1 Dec 2018 00:02:52 +0100
Subject: [PATCH] test_hwcomposer: hack to build version for Android 7 CAF
 devices

Android headers from LineageOS 14.1 include needed changes in structs,
which are conditionally activated by QTI_BSP define. By enabling that
define we can build a separate binary of test_hwcomposer which will
work on Android 7 CAF devices with Halium.
---
 hybris/tests/Makefile.am | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/hybris/tests/Makefile.am b/hybris/tests/Makefile.am
index 242436b..2255694 100644
--- a/hybris/tests/Makefile.am
+++ b/hybris/tests/Makefile.am
@@ -105,6 +105,33 @@ test_hwcomposer_LDADD = \
 	$(top_builddir)/libsync/libsync.la \
 	$(top_builddir)/hardware/libhardware.la
 
+if HAS_ANDROID_7_0_0
+bin_PROGRAMS += test_hwcomposer_7_caf
+endif
+
+test_hwcomposer_7_caf_SOURCES = test_hwcomposer.cpp
+test_hwcomposer_7_caf_CXXFLAGS = \
+	-I$(top_srcdir)/include \
+	$(ANDROID_HEADERS_CFLAGS) \
+	-DQCOM_BSP=1 -DQTI_BSP=1 \
+	-I$(top_srcdir)/common \
+	-I$(top_srcdir)/egl/platforms/common \
+	-I$(top_srcdir)/egl/platforms/hwcomposer \
+	-I$(top_srcdir)/libsync
+
+if WANT_MESA
+test_hwcomposer_7_caf_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+test_hwcomposer_7_caf_LDADD = \
+	-lm \
+	$(top_builddir)/common/libhybris-common.la \
+	$(top_builddir)/egl/platforms/hwcomposer/libhybris-hwcomposerwindow.la \
+	$(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+	$(top_builddir)/egl/libEGL.la \
+	$(top_builddir)/glesv2/libGLESv2.la \
+	$(top_builddir)/libsync/libsync.la \
+	$(top_builddir)/hardware/libhardware.la
+
 test_sensors_SOURCES = test_sensors.c
 test_sensors_CFLAGS = \
 	-I$(top_srcdir)/include \
-- 
2.19.1

