Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adjusted gtest-port.h to work when ANDROID is defined.

Removed from the makefile the explicit OS setting (was linux)
Added a new OS: Android.
When -DANDROID is specified during preprocessing, the right
includes should happen.
  • Loading branch information...
commit f6071db8c6f4192253a3c544379ad35dcb64dab0 1 parent 1be2c9d
Nicolas Catania authored
View
8 include/gtest/internal/gtest-port.h
@@ -65,6 +65,7 @@
//
// Macros indicating the current platform (defined to 1 if compiled on
// the given platform; otherwise undefined):
+// GTEST_OS_ANDROID - Android
// GTEST_OS_CYGWIN - Cygwin
// GTEST_OS_LINUX - Linux
// GTEST_OS_MAC - Mac OS X
@@ -177,6 +178,8 @@
#define GTEST_OS_WINDOWS 1
#elif defined __APPLE__
#define GTEST_OS_MAC 1
+#elif defined ANDROID
+#define GTEST_OS_ANDROID 1
#elif defined __linux__
#define GTEST_OS_LINUX 1
#elif defined __MVS__
@@ -250,10 +253,11 @@
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
// is available.
-#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
+#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || GTEST_OS_ANDROID
// Cygwin 1.5 and below doesn't support ::std::wstring.
// Cygwin 1.7 might add wstring support; this should be updated when clear.
// Solaris' libc++ doesn't support it either.
+// Android does not support wstring and never will.
#define GTEST_HAS_STD_WSTRING 0
#else
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
@@ -379,7 +383,7 @@
#if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \
GTEST_OS_MAC || \
GTEST_OS_CYGWIN || \
- (GTEST_OS_WINDOWS && _MSC_VER >= 1400))
+ (GTEST_OS_WINDOWS && _MSC_VER >= 1400)) && !GTEST_OS_ANDROID
#define GTEST_HAS_DEATH_TEST 1
#include <vector>
#endif
View
4 src/Android.mk
@@ -41,7 +41,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../include
-LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0
+LOCAL_CFLAGS += -O0
LOCAL_MODULE := libgtest
LOCAL_MODULE_TAGS := tests
@@ -63,7 +63,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../include
-LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0
+LOCAL_CFLAGS += -O0
LOCAL_STATIC_LIBRARIES := libgtest
View
2  test/Android.mk
@@ -38,7 +38,7 @@ $(foreach file,$(1), \
endef
define host-test
-$(call _define-test,$(1),HOST_,-DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0)
+$(call _define-test,$(1),HOST_,-O0)
endef
# TODO: Figure out the right CFLAGS combination needed for bionic/astl.
Please sign in to comment.
Something went wrong with that request. Please try again.