Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,57 @@ function(resolve_zstd_dependency)
endif()
endfunction()

# ----------------------------------------------------------------------
# GoogleTest (tests only)
#
# GTest is only consumed by the unit tests; it is neither installed nor exported
# as a system dependency, so it does not touch ICEBERG_SYSTEM_DEPENDENCIES.

function(resolve_gtest_dependency)
prepare_fetchcontent()

set(INSTALL_GTEST
OFF
CACHE BOOL "" FORCE)

fetchcontent_declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59 # release-1.15.2
FIND_PACKAGE_ARGS
NAMES
GTest)
fetchcontent_makeavailable(googletest)
endfunction()

# ----------------------------------------------------------------------
# Google Benchmark (benchmarks only)
#
# Like GTest, benchmark is only consumed by the benchmark targets and is neither
# installed nor exported as a system dependency.

function(resolve_benchmark_dependency)
prepare_fetchcontent()

set(BENCHMARK_ENABLE_GTEST_TESTS
OFF
CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_INSTALL
OFF
CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING
OFF
CACHE BOOL "" FORCE)

fetchcontent_declare(google_benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG a4cf155615c63e019ae549e31703bf367df5b471 # v1.8.4
FIND_PACKAGE_ARGS
NAMES
benchmark
CONFIG)
fetchcontent_makeavailable(google_benchmark)
endfunction()

resolve_zlib_dependency()
resolve_nanoarrow_dependency()
resolve_croaring_dependency()
Expand Down Expand Up @@ -864,3 +915,17 @@ endfunction()
if(ICEBERG_BUILD_HIVE)
resolve_thrift_dependency()
endif()

# ----------------------------------------------------------------------
# Test and benchmark dependencies
#
# These are build-only tools, pulled in after the library dependencies and only
# when the corresponding build option is enabled.

if(ICEBERG_BUILD_TESTS)
resolve_gtest_dependency()
endif()

if(ICEBERG_BUILD_BENCHMARKS)
resolve_benchmark_dependency()
endif()
19 changes: 1 addition & 18 deletions src/iceberg/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@
# specific language governing permissions and limitations
# under the License.

set(BENCHMARK_ENABLE_GTEST_TESTS
OFF
CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_INSTALL
OFF
CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING
OFF
CACHE BOOL "" FORCE)

fetchcontent_declare(google_benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG a4cf155615c63e019ae549e31703bf367df5b471 # v1.8.4
FIND_PACKAGE_ARGS
NAMES
benchmark
CONFIG)
fetchcontent_makeavailable(google_benchmark)
# Google Benchmark is resolved in cmake_modules/IcebergThirdpartyToolchain.cmake.

add_executable(benchmark_smoke benchmark_smoke.cc)
target_link_libraries(benchmark_smoke
Expand Down
13 changes: 1 addition & 12 deletions src/iceberg/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@
# specific language governing permissions and limitations
# under the License.

set(INSTALL_GTEST
OFF
CACHE BOOL "" FORCE)

fetchcontent_declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59 # release-1.15.2
FIND_PACKAGE_ARGS
NAMES
GTest)

fetchcontent_makeavailable(googletest)
# GoogleTest is resolved in cmake_modules/IcebergThirdpartyToolchain.cmake.

set(ICEBERG_TEST_RESOURCES "${CMAKE_SOURCE_DIR}/src/iceberg/test/resources")

Expand Down
Loading