1LOCAL_DIR := $(GET_LOCAL_DIR) 2 3MODULE := $(LOCAL_DIR) 4 5GTEST_DIR := external/googletest/googletest 6 7MODULE_LICENSES += $(GTEST_DIR)/LICENSE 8 9# Export gtest headers. 10MODULE_EXPORT_INCLUDES += $(GTEST_DIR)/include 11 12# gtest has internal includes relative to its root directory. 13MODULE_INCLUDES += $(GTEST_DIR) 14 15# Disable optional features. 16MODULE_COMPILEFLAGS += \ 17 -DGTEST_HAS_CLONE=0 \ 18 -DGTEST_HAS_EXCEPTIONS=0 \ 19 -DGTEST_HAS_POSIX_RE=0 \ 20 -DGTEST_HAS_PTHREAD=0 \ 21 -DGTEST_HAS_RTTI=0 \ 22 -DGTEST_HAS_STD_WSTRING=0 \ 23 -DGTEST_HAS_SEH=0 \ 24 -DGTEST_HAS_STREAM_REDIRECTION=0 \ 25 -DGTEST_LINKED_AS_SHARED_LIBRARY=0 \ 26 -DGTEST_CREATE_SHARED_LIBRARY=0 \ 27 28# After disabling a bunch of features, there are dead constants. 29MODULE_COMPILEFLAGS += -Wno-unused-const-variable 30 31# Disable the C unittest macros 32MODULE_EXPORT_COMPILEFLAGS += -DDISABLE_TRUSTY_UNITTEST_MACROS=1 33 34# Explicitly list the files instead of using gtest-all.cc so the build can be 35# parallelized. Note we need to build all the files because of how command line 36# flags are handled. For example, we don't support death tests, but still need 37# to compile gtest-death-test.cc because gtest.cc references 38# GTEST_FLAG(death_test_style). 39MODULE_SRCS := \ 40 $(GTEST_DIR)/src/gtest.cc \ 41 $(GTEST_DIR)/src/gtest-death-test.cc \ 42 $(GTEST_DIR)/src/gtest-filepath.cc \ 43 $(GTEST_DIR)/src/gtest-matchers.cc \ 44 $(GTEST_DIR)/src/gtest-port.cc \ 45 $(GTEST_DIR)/src/gtest-printers.cc \ 46 $(GTEST_DIR)/src/gtest-test-part.cc \ 47 $(GTEST_DIR)/src/gtest-typed-test.cc \ 48 49# aosp/2765314 updated googletest to a more recent version. 50# The update brought two significant changes: 51# * A new file called gtest-assertion-result.cc, and 52# * Changes to GTEST_HAS_DEATH_TEST where it's checked using #ifdef; 53# This means that instead of defining it to 0, 54# we now need to not define it at all. 55ifneq ($(wildcard $(GTEST_DIR)/src/gtest-assertion-result.cc),) 56 MODULE_SRCS += $(GTEST_DIR)/src/gtest-assertion-result.cc 57else 58 # Define the macro the old way to get past presubmit 59 MODULE_COMPILEFLAGS += -DGTEST_HAS_DEATH_TEST=0 60endif 61 62MODULE_EXPORT_INCLUDES += \ 63 $(LOCAL_DIR)/include \ 64 65MODULE_LIBRARY_DEPS += \ 66 trusty/user/base/lib/libstdc++-trusty \ 67 trusty/user/base/lib/libcxxabi-trusty \ 68 trusty/user/base/lib/unittest \ 69 70include make/library.mk 71