Build SwiftShader with BOARD_VNDK_VERSION=current
This is using cutils/log.h which is deprecated in O (in favor of
log/log.h) and this is causing build error when building with
BOARD_VNDK_VERSION=current set. However, since SwiftShader should be
able to be built with older versions Android some of which don't have
log/log.h, we can't simply change cutils/log.h to log/log.h.
Instead, liblog_headers is added to the header lib dependency (only for
O and beyond) so that log/log.h can be correctly included via
cutils/log.h
Bug b/63135587
Change-Id: I763250e7410025b1dcd7ae210693e3d6bffdb6f1
Reviewed-on: https://swiftshader-review.googlesource.com/17629
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/Android.mk b/src/OpenGL/compiler/Android.mk
index 867f70a..ba23f1d 100644
--- a/src/OpenGL/compiler/Android.mk
+++ b/src/OpenGL/compiler/Android.mk
@@ -72,6 +72,13 @@
ValidateLimitations.cpp \
ValidateSwitch.cpp \
+# liblog_headers is introduced from O
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26 && echo O),O)
+COMMON_HEADER_LIBRARIES := liblog_headers
+else
+COMMON_HEADER_LIBRARIES :=
+endif
+
include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := swiftshader_compiler_release
@@ -85,6 +92,7 @@
-DANGLE_DISABLE_TRACE
LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@@ -102,4 +110,5 @@
LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
include $(BUILD_STATIC_LIBRARY)