From 6d0f4dec9b45cbdce5a3c016de8c9425cb075a14 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 29 Feb 2024 13:29:46 -0800 Subject: [PATCH] Update gtest Makefile setup Summary: As title. This should fix the incomplete transition to a separate builddir. Reviewed By: beicy Differential Revision: D54360694 fbshipit-source-id: a87c31f8082b950b56e30857f6aa5a20a6231d6b --- test/Makefile.am | 26 +++++++++++++++----------- test/setup.sh | 18 ------------------ 2 files changed, 15 insertions(+), 29 deletions(-) delete mode 100755 test/setup.sh diff --git a/test/Makefile.am b/test/Makefile.am index d027cbfd4bc..1084a9d2830 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,25 +2,29 @@ SUBDIRS = . integ unit check_LTLIBRARIES = libgtest.la libgtest_main.la libgmock_main.la -libgtest_la_CPPFLAGS = -I$(srcdir)/googletest-release-1.10.0/googletest -I$(srcdir)/googletest-release-1.10.0/googletest/include -libgtest_la_SOURCES = googletest-release-1.10.0/googletest/src/gtest-all.cc +# Note: Use at least 1.10 as we need googlemock, too. +GOOGLETEST_MIN_VERSION = 1.10.0 -libgtest_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-1.10.0/googletest -I$(srcdir)/googletest-release-1.10.0/googletest/include -libgtest_main_la_SOURCES = googletest-release-1.10.0/googletest/src/gtest_main.cc +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_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_main_la_LIBADD = libgtest.la -libgmock_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-1.10.0/googlemock -I$(srcdir)/googletest-release-1.10.0/googlemock/include -I$(srcdir)/googletest-release-1.10.0/googletest/include -libgmock_main_la_SOURCES = googletest-release-1.10.0/googlemock/src/gmock-all.cc googletest-release-1.10.0/googlemock/src/gmock_main.cc +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 # Hack: auto-download googletest. -googletest-release-1.10.0/googletest/src/gtest-all.cc \ -googletest-release-1.10.0/googletest/src/gtest_main.cc \ -googletest-release-1.10.0/googlemock/src/gmock-all.cc \ -googletest-release-1.10.0/googlemock/src/gmock_main.cc: setup_gtest +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 setup_gtest: - ./setup.sh + curl https://codeload.github.com/google/googletest/zip/release-$(GOOGLETEST_MIN_VERSION) -o gtest-$(GOOGLETEST_MIN_VERSION).zip + unzip -o gtest-$(GOOGLETEST_MIN_VERSION).zip touch setup_gtest check_SCRIPTS = check_num_passes.sh diff --git a/test/setup.sh b/test/setup.sh deleted file mode 100755 index eee03e79712..00000000000 --- a/test/setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -x -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -set -e - -TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -pushd "$TEST_DIR" - -# Note: Use at least 1.10 as we need googlemock, too. - -test -e gtest-1.10.0.zip || { - curl https://codeload.github.com/google/googletest/zip/release-1.10.0 \ - -o gtest-1.10.0.zip - unzip -o gtest-1.10.0.zip -}