Skip to content

Commit

Permalink
[INFRA] Accept any Google {Test,Benchmark} version
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Aug 9, 2023
1 parent 165a495 commit f5db294
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/cron_latest_libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ jobs:
- name: Update googletest
run: |
grep 'gtest_git_tag ".*"' seqan3/test/cmake/seqan3_require_test.cmake
sed -i 's/gtest_git_tag ".*"/gtest_git_tag "main"/' seqan3/test/cmake/seqan3_require_test.cmake
grep 'gtest_git_tag ".*"' seqan3/test/cmake/seqan3_require_test.cmake
grep 'SEQAN3_GTEST_TAG ".*"' seqan3/test/cmake/seqan3_require_test.cmake
sed -i 's/SEQAN3_GTEST_TAG ".*"/SEQAN3_GTEST_TAG "main"/' seqan3/test/cmake/seqan3_require_test.cmake
grep 'SEQAN3_GTEST_TAG ".*"' seqan3/test/cmake/seqan3_require_test.cmake
- name: Update googlebenchmark
run: |
grep 'gbenchmark_git_tag ".*"' seqan3/test/cmake/seqan3_require_benchmark.cmake
sed -i 's/gbenchmark_git_tag ".*"/gbenchmark_git_tag "main"/' seqan3/test/cmake/seqan3_require_benchmark.cmake
grep 'gbenchmark_git_tag ".*"' seqan3/test/cmake/seqan3_require_benchmark.cmake
grep 'SEQAN3_BENCHMARK_TAG ".*"' seqan3/test/cmake/seqan3_require_benchmark.cmake
sed -i 's/SEQAN3_BENCHMARK_TAG ".*"/SEQAN3_BENCHMARK_TAG "main"/' seqan3/test/cmake/seqan3_require_benchmark.cmake
grep 'SEQAN3_BENCHMARK_TAG ".*"' seqan3/test/cmake/seqan3_require_benchmark.cmake
- name: Checkout SeqAn2
uses: actions/checkout@v3
Expand Down
14 changes: 7 additions & 7 deletions test/cmake/seqan3_require_benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ cmake_minimum_required (VERSION 3.16)
macro (seqan3_require_benchmark)
enable_testing ()

set (benchmark_version "1.8.2")
set (gbenchmark_git_tag "v${benchmark_version}")
set (SEQAN3_BENCHMARK_TAG "v1.8.2")

find_package (benchmark ${benchmark_version} EXACT QUIET)
find_package (benchmark QUIET)

if (NOT benchmark_FOUND)
message (STATUS "Fetching Google Benchmark ${benchmark_version}")
# Also ensure that Google Benchmark if fetched for the latest library cron, which sets the tag to "main".
if (NOT benchmark_FOUND OR "${SEQAN3_BENCHMARK_TAG}" STREQUAL "main")
message (STATUS "Fetching Google Benchmark ${SEQAN3_BENCHMARK_TAG}")

include (FetchContent)
FetchContent_Declare (
gbenchmark_fetch_content
GIT_REPOSITORY "https://github.com/google/benchmark.git"
GIT_TAG "${gbenchmark_git_tag}")
GIT_TAG "${SEQAN3_BENCHMARK_TAG}")
option (BENCHMARK_ENABLE_TESTING "" OFF)
option (BENCHMARK_ENABLE_WERROR "" OFF) # Does not apply to Debug builds.
option (BENCHMARK_ENABLE_INSTALL "" OFF)
FetchContent_MakeAvailable (gbenchmark_fetch_content)
else ()
message (STATUS "Found Google Benchmark ${benchmark_version}")
message (STATUS " Test dependency: Google Benchmark ${benchmark_VERSION} found.")
endif ()

# NOTE: google benchmark's CMakeLists.txt already defines Shlwapi
Expand Down
14 changes: 7 additions & 7 deletions test/cmake/seqan3_require_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ cmake_minimum_required (VERSION 3.16)
macro (seqan3_require_test)
enable_testing ()

set (gtest_version "1.13.0")
set (gtest_git_tag "v${gtest_version}")
set (SEQAN3_GTEST_TAG "v1.13.0")

find_package (GTest ${gtest_version} EXACT QUIET)
find_package (GTest QUIET)

if (NOT GTest_FOUND)
message (STATUS "Fetching Google Test ${gtest_version}")
# Also ensure that Google Test if fetched for the latest library cron, which sets the tag to "main".
if (NOT GTest_FOUND OR "${SEQAN3_GTEST_TAG}" STREQUAL "main")
message (STATUS "Fetching Google Test ${SEQAN3_GTEST_TAG}")

include (FetchContent)
FetchContent_Declare (
gtest_fetch_content
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "${gtest_git_tag}")
GIT_TAG "${SEQAN3_GTEST_TAG}")
option (BUILD_GMOCK "" OFF)
option (INSTALL_GTEST "" OFF)
FetchContent_MakeAvailable (gtest_fetch_content)
else ()
message (STATUS "Found Google Test ${gtest_version}")
message (STATUS " Test dependency: Google Test ${GTest_VERSION} found.")
endif ()

if (NOT TARGET gtest_build)
Expand Down

0 comments on commit f5db294

Please sign in to comment.