Skip to content

Commit

Permalink
Another gtest fix
Browse files Browse the repository at this point in the history
Differential Revision: D54391586
  • Loading branch information
agampe authored and facebook-github-bot committed Mar 1, 2024
1 parent 44aa6ee commit 13ba183
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
30 changes: 20 additions & 10 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,33 @@ check_LTLIBRARIES = libgtest.la libgtest_main.la libgmock_main.la

# Note: Use at least 1.10 as we need googlemock, too.
GOOGLETEST_MIN_VERSION = 1.10.0
GOOGLETEST_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest
GOOGLEMOCK_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock

libgtest_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include
libgtest_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest-all.cc
libgtest_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include
libgtest_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest-all.cc

libgtest_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include
libgtest_main_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest_main.cc
libgtest_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include
libgtest_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest-all.cc

libgtest_main_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include
libgtest_main_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest_main.cc
libgtest_main_la_LIBADD = libgtest.la

libgmock_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/include -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include
libgmock_main_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock-all.cc googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock_main.cc
libgmock_main_la_CPPFLAGS = -I$(GOOGLEMOCK_DIR) -I$(GOOGLEMOCK_DIR)/include -I$(GOOGLETEST_DIR)/include
libgmock_main_la_SOURCES = $(GOOGLEMOCK_DIR)/src/gmock-all.cc $(GOOGLEMOCK_DIR)/src/gmock_main.cc

# Hack: auto-download googletest.

googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest-all.cc \
googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest_main.cc \
googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock-all.cc \
googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock_main.cc: setup_gtest
GOOGLE_TEST_SOURCES = \
$(GOOGLETEST_DIR)/src/gtest-all.cc \
$(GOOGLETEST_DIR)/src/gtest_main.cc \
$(GOOGLEMOCK_DIR)/src/gmock-all.cc \
$(GOOGLEMOCK_DIR)/src/gmock_main.cc

BUILT_SOURCES = $(GOOGLE_TEST_SOURCES)

$(GOOGLE_TEST_SOURCES): setup_gtest

setup_gtest:
curl https://codeload.github.com/google/googletest/zip/release-$(GOOGLETEST_MIN_VERSION) -o gtest-$(GOOGLETEST_MIN_VERSION).zip
Expand Down
9 changes: 7 additions & 2 deletions test/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# TODO: Unify with Makefile.am (or maybe autodetect)
GOOGLETEST_MIN_VERSION = 1.10.0
GOOGLETEST_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest
GOOGLEMOCK_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock

#
# Include paths
#
COMMON_TEST_INCLUDES = \
-I$(top_srcdir)/test/common \
-I$(top_srcdir)/test/googletest-release-1.10.0/googlemock/include \
-I$(top_srcdir)/test/googletest-release-1.10.0/googletest/include
-I$(top_builddir)/test/$(GOOGLEMOCK_DIR)/include \
-I$(top_builddir)/test/$(GOOGLETEST_DIR)/include

COMMON_BASE_TEST_LIBS = \
$(top_builddir)/libredex.la \
Expand Down

0 comments on commit 13ba183

Please sign in to comment.