From 2e13a73652468b35cdab2b12ba5592c2974bc90a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 2 Mar 2021 09:48:37 -0800 Subject: [PATCH 1/3] benchmarks must directly link to benchmark_main --- cpp/benchmarks/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index aba83152171..b4445d66210 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -29,7 +29,6 @@ target_link_libraries(cudf_datagen GTest::gmock_main GTest::gtest_main benchmark::benchmark - benchmark::benchmark_main Threads::Threads cudf) @@ -52,7 +51,8 @@ function(ConfigureBench CMAKE_BENCH_NAME) add_executable(${CMAKE_BENCH_NAME} ${ARGN}) set_target_properties(${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE cudf_benchmark_common cudf_datagen) + target_link_libraries(${CMAKE_BENCH_NAME} + PRIVATE cudf_benchmark_common cudf_datagen benchmark::benchmark_main) endfunction() ################################################################################################### From 1d44afde5b4ae47cfa37c11b9b642310ff570730 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 2 Mar 2021 10:21:48 -0800 Subject: [PATCH 2/3] Preserve BUILD_BENCHMARKS / TESTS when passed via `cmake -D` CPM will force these variables to OFF and add them to the CMakeCache. This causes problems when you re-execute cmake in the same build directory as now they are set to OFF, and CUDF will not enable benchmarks/tests. --- cpp/cmake/thirdparty/CUDF_GetRMM.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/CUDF_GetRMM.cmake b/cpp/cmake/thirdparty/CUDF_GetRMM.cmake index 66ef3e9b6a3..b4a6a67c24d 100644 --- a/cpp/cmake/thirdparty/CUDF_GetRMM.cmake +++ b/cpp/cmake/thirdparty/CUDF_GetRMM.cmake @@ -14,12 +14,26 @@ # limitations under the License. #============================================================================= -function(find_and_configure_rmm VERSION) +function(cudf_save_if_enabled var) + if(CUDF_${var}) + unset(${var} PARENT_SCOPE) + unset(${var} CACHE) + endif() +endfunction() +function(cudf_restore_if_enabled var) + if(CUDF_${var}) + set(${var} ON CACHE INTERNAL "" FORCE) + endif() +endfunction() + +function(find_and_configure_rmm VERSION) # Consumers have two options for local source builds: # 1. Pass `-D CPM_rmm_SOURCE=/path/to/rmm` to build a local RMM source tree # 2. Pass `-D CMAKE_PREFIX_PATH=/path/to/rmm/build` to use an existing local # RMM build directory as the install location for find_package(rmm) + cudf_save_if_enabled(BUILD_TESTS) + cudf_save_if_enabled(BUILD_BENCHMARKS) CPMFindPackage(NAME rmm VERSION ${VERSION} @@ -32,6 +46,8 @@ function(find_and_configure_rmm VERSION) "CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}" "DISABLE_DEPRECATION_WARNING ${DISABLE_DEPRECATION_WARNING}" ) + cudf_restore_if_enabled(BUILD_TESTS) + cudf_restore_if_enabled(BUILD_BENCHMARKS) if(NOT rmm_BINARY_DIR IN_LIST CMAKE_PREFIX_PATH) list(APPEND CMAKE_PREFIX_PATH "${rmm_BINARY_DIR}") From c42d2e2931d908399cd858f2ba6099dd0b409191 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 2 Mar 2021 11:37:23 -0800 Subject: [PATCH 3/3] tests updated to directly link to gmock_main and gtest_main --- cpp/tests/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index ea3dd8560fd..6a49ea0046b 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -35,8 +35,6 @@ target_compile_features(cudftestutil PUBLIC cxx_std_14 cuda_std_14) target_link_libraries(cudftestutil PUBLIC GTest::gmock GTest::gtest - GTest::gmock_main - GTest::gtest_main Threads::Threads cudf) @@ -55,7 +53,7 @@ function(ConfigureTest CMAKE_TEST_NAME ) add_executable(${CMAKE_TEST_NAME} ${ARGN}) set_target_properties(${CMAKE_TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") - target_link_libraries(${CMAKE_TEST_NAME} PRIVATE cudftestutil) + target_link_libraries(${CMAKE_TEST_NAME} PRIVATE cudftestutil GTest::gmock_main GTest::gtest_main) add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) endfunction()