OSDN Git Service

Get libgtest from libart-gtest.
authorDan Albert <danalbert@google.com>
Fri, 9 Sep 2016 22:32:19 +0000 (15:32 -0700)
committerDan Albert <danalbert@google.com>
Fri, 9 Sep 2016 22:37:54 +0000 (15:37 -0700)
We can't link libgtest into both the tests and libart-gtest because
gtest has global data that causes ODR issues. Instead, link libgtest
*whole* into libart-gtest to be sure that we actually have enough to
gtest. Headers from LOCAL_WHOLE_STATIC_LIBRARIES are re-exported
automatically, which solves the initial problem I was here for.

Test: mma test-art-host-gtest
Bug: None
Change-Id: Icb985e070d8afb3e614b4e94714c61bc95e4e7fc

build/Android.gtest.mk

index 0340e10..43f917c 100644 (file)
@@ -422,7 +422,7 @@ LOCAL_CPP_EXTENSION := cc
 LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
 LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/cmdline art/compiler
 LOCAL_SHARED_LIBRARIES := libartd libartd-compiler libdl
-LOCAL_STATIC_LIBRARIES += libgtest
+LOCAL_WHOLE_STATIC_LIBRARIES += libgtest
 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
 $(eval LOCAL_CLANG := $(ART_TARGET_CLANG))
@@ -439,7 +439,7 @@ LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
 LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
 LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/cmdline art/compiler
 LOCAL_SHARED_LIBRARIES := libartd libartd-compiler
-LOCAL_STATIC_LIBRARIES := libgtest_host
+LOCAL_WHOLE_STATIC_LIBRARIES := libgtest
 LOCAL_LDLIBS += -ldl -lpthread
 LOCAL_MULTILIB := both
 LOCAL_CLANG := $(ART_HOST_CLANG)
@@ -634,7 +634,6 @@ define define-art-gtest
   LOCAL_SRC_FILES := $$(art_gtest_filename)
   LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime art/cmdline $$(art_gtest_extra_c_includes)
   LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest libartd-disassembler
-  LOCAL_STATIC_LIBRARIES += libgtest
   LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain
 
   LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk