]> granicus.if.org Git - libvpx/commitdiff
test_libvpx: disable pthreads in gtest for win targets
authorJames Zern <jzern@google.com>
Thu, 27 Jun 2013 01:35:11 +0000 (18:35 -0700)
committerJames Zern <jzern@google.com>
Thu, 27 Jun 2013 01:35:11 +0000 (18:35 -0700)
currently threading is internal to libvpx so thread safety is unneeded
in libgtest -- visual studio builds already operate in this way as they
do not have pthread.h available by default.

this removes an unconditional link to libpthread using $(extralibs)
should libvpx require it.

Change-Id: I2f278b711f533d0f4d8a6c896833e3e2237d1f45

configure
libs.mk

index 28676fbc6c3a6e99134969b7ddd6e2052a6f08e5..36fc08f222ab527963fe3e4d280ae1c98451f997 100755 (executable)
--- a/configure
+++ b/configure
@@ -682,6 +682,14 @@ process_toolchain() {
             # iOS/ARM builds do not work with gtest. This does not match
             # x86 targets.
         ;;
+        *-win*)
+            # Some mingw toolchains don't have pthread available by default.
+            # Treat these more like visual studio where threading in gtest
+            # would be disabled for the same reason.
+            check_cxx "$@" <<EOF && soft_enable unit_tests
+int z;
+EOF
+        ;;
         *)
             enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
 int z;
diff --git a/libs.mk b/libs.mk
index f7d839567ad5eb76285e8a49b708d420f19a77e4..4aa7dc48a0551b457931a9cb3593c8d17fe3e2c4 100644 (file)
--- a/libs.mk
+++ b/libs.mk
@@ -448,6 +448,10 @@ else
 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
+ifeq ($(filter win%,$(TGT_OS)),$(TGT_OS))
+# Disabling pthreads globally will cause issues on darwin and possibly elsewhere
+$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -DGTEST_HAS_PTHREAD=0
+endif
 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
@@ -472,7 +476,7 @@ $(foreach bin,$(LIBVPX_TEST_BINS),\
         lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
     $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
         $(LIBVPX_TEST_OBJS) \
-        -L. -lvpx -lgtest -lpthread -lm)\
+        -L. -lvpx -lgtest $(extralibs) -lm)\
         )))\
     $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\