From 1670aa759fc3ca6bcb337ac3f3021b943522bb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 14 Nov 2021 21:34:45 +0100 Subject: [PATCH 1/3] Remove support for vendored gtest Originally implemented only to satisfy the (somewhat dubious) claim of gtest about the necessity to provide your own copy. The original claim got removed here: https://github.com/google/googletest/commit/5437926b2213b1c45c2f34bd858734de90e5fffd --- test/tests/CMakeLists.txt | 64 ++------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 772b47ab09..b4beeae52f 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -1,68 +1,8 @@ cmake_minimum_required(VERSION 2.6) -option(SYSTEM_GTEST "Use the googletest library provided by the system.") +find_package(GTest REQUIRED) -if (SYSTEM_GTEST) - find_package(GTest REQUIRED) - - set(GTEST_LIBRARIES ${GTEST_BOTH_LIBRARIES}) - - message(WARNING "Gtest strongly advices against using a system installation, see https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#why-is-it-not-recommended-to-install-a-pre-compiled-copy-of-google-test-for-example-into-usrlocal for detailed information. If errors occur please double-check without the SYSTEM_GTEST flag.") -else (SYSTEM_GTEST) - - # Bootstrap GoogleTest - INCLUDE(ExternalProject) - - ExternalProject_Add( - googletest-distribution - URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.tar.gz # v1.11.0 release - URL_HASH SHA1=b0399e38211cc4fedd612f71bad7984ed4cbe8fe - TIMEOUT 10 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - ) - - # Specify include dir - ExternalProject_Get_Property(googletest-distribution SOURCE_DIR) - set(GOOGLETEST_DISTRIB_SOURCE_DIR "${SOURCE_DIR}") - - ExternalProject_Add( - googletest - DEPENDS googletest-distribution - DOWNLOAD_COMMAND "" - SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}" - CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M} -DBUILD_GMOCK=off" - BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" - BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}" - # Disable install step - INSTALL_COMMAND "" - # Wrap download, configure and build steps in a script to log output - LOG_DOWNLOAD ON - LOG_CONFIGURE ON - LOG_BUILD ON) - - - # Specify include dir - set(GTEST_INCLUDE_DIRS ${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest/include) - - # Library - ExternalProject_Get_Property(googletest BINARY_DIR) - set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}/lib") - set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GTEST_LIBRARY gtest) - set(GTEST_MAIN_LIBRARY gtest_main) - add_library(${GTEST_LIBRARY} STATIC IMPORTED) - add_library(${GTEST_MAIN_LIBRARY} STATIC IMPORTED) - set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}) - set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_PATH}) - add_dependencies(${GTEST_LIBRARY} googletest) - add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY}) - - set(GTEST_LIBRARIES gtest gtest_main pthread) - -endif (SYSTEM_GTEST) +set(GTEST_LIBRARIES ${GTEST_BOTH_LIBRARIES}) include_directories(SYSTEM ${GTEST_INCLUDE_DIRS}) include_directories("${ROOT_DIR}/src") From 16c4bfb416816cc40e921b344499c98abc3e770d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 7 Jan 2022 23:04:52 +0100 Subject: [PATCH 2/3] Update Bionic images in CI to ones with gtest --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2073d293f2..a8210b9ad8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -247,7 +247,7 @@ jobs: include: - platform: x86_64 distro: bionic - image: openrct2/openrct2-build:0.3.1-bionic + image: openrct2/openrct2-build:4-bionic build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz" - platform: x86_64 distro: focal @@ -259,7 +259,7 @@ jobs: build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz" - platform: i686 distro: bionic - image: openrct2/openrct2-build:0.3.1-bionic32 + image: openrct2/openrct2-build:4-bionic32 build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g -gz" steps: - name: Checkout From 500190ff25af503009f023bea7f793e568475eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 9 May 2022 23:25:30 +0200 Subject: [PATCH 3/3] Disable tests on bionic --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8210b9ad8..6b6be66b1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -248,7 +248,7 @@ jobs: - platform: x86_64 distro: bionic image: openrct2/openrct2-build:4-bionic - build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz" + build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz" -DWITH_TESTS=off - platform: x86_64 distro: focal image: openrct2/openrct2-build:5-focal @@ -260,7 +260,7 @@ jobs: - platform: i686 distro: bionic image: openrct2/openrct2-build:4-bionic32 - build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g -gz" + build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g -gz" -DWITH_TESTS=off steps: - name: Checkout uses: actions/checkout@v3