OSDN Git Service

Enable building of gtest for Windows
authorAdam Lesinski <adamlesinski@google.com>
Mon, 20 Oct 2014 23:06:44 +0000 (16:06 -0700)
committerAdam Lesinski <adamlesinski@google.com>
Mon, 20 Oct 2014 23:06:44 +0000 (16:06 -0700)
Windows does not have pthread support, and by defining the
GTEST_OS_WINDOWS flag, pthread support will not be built into
the windows version of gtest.

Change-Id: I0571fc52e77bb04175470d5750a7e2f46cdd5e86

core/host_test_internal.mk

index 426c400..691468d 100644 (file)
@@ -2,7 +2,14 @@
 ## Shared definitions for all host test compilations.
 #####################################################
 
-LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
+ifeq ($(HOST_OS),windows)
+LOCAL_CFLAGS += -DGTEST_OS_WINDOWS
+else
+LOCAL_CFLAGS += -DGTEST_OS_LINUX
+LOCAL_LDLIBS += -lpthread
+endif
+
+LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
 LOCAL_C_INCLUDES +=  external/gtest/include
 
 ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),)
@@ -12,4 +19,3 @@ LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
 LOCAL_SHARED_LIBRARIES +=
 endif
 
-LOCAL_LDLIBS += -lpthread