From ede9019ede4368436ba61e2298bed8db67428c44 Mon Sep 17 00:00:00 2001 From: AJ Schmidt Date: Wed, 9 Feb 2022 14:01:33 -0500 Subject: [PATCH] Add CMake `install` rules for tests (#4551) This PR adds a CMake `install` rule for test and benchmark targets. This step is a prerequisite to being able to package tests/benchmarks in their own `conda` package, which will enable use to deprecate _Project Flash_. Authors: - AJ Schmidt (https://github.com/ajschmidt8) Approvers: - Robert Maynard (https://github.com/robertmaynard) - Dante Gama Dessavre (https://github.com/dantegd) URL: https://github.com/rapidsai/cuml/pull/4551 --- cpp/bench/CMakeLists.txt | 24 ++++++++++++++++++++++++ cpp/test/CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/cpp/bench/CMakeLists.txt b/cpp/bench/CMakeLists.txt index 6cb2b3a26c..3647f0ed8a 100644 --- a/cpp/bench/CMakeLists.txt +++ b/cpp/bench/CMakeLists.txt @@ -54,6 +54,18 @@ if(BUILD_CUML_BENCH) PRIVATE $ ) + + set_target_properties( + ${CUML_CPP_BENCH_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + + install( + TARGETS ${CUML_CPP_BENCH_TARGET} + COMPONENT testing + DESTINATION bin/benchmarks/libcuml + EXCLUDE_FROM_ALL + ) endif() ############################################################################## @@ -97,4 +109,16 @@ if(BUILD_CUML_PRIMS_BENCH) $ $ ) + + set_target_properties( + ${PRIMS_BENCH_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + + install( + TARGETS ${PRIMS_BENCH_TARGET} + COMPONENT testing + DESTINATION bin/benchmarks/libcuml_prims + EXCLUDE_FROM_ALL + ) endif() diff --git a/cpp/test/CMakeLists.txt b/cpp/test/CMakeLists.txt index 2b900e4f5d..f6bdee1ab6 100644 --- a/cpp/test/CMakeLists.txt +++ b/cpp/test/CMakeLists.txt @@ -96,6 +96,17 @@ if(BUILD_CUML_TESTS) ${COMMON_TEST_LINK_LIBRARIES} ) + set_target_properties( + ${CUML_CPP_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + + install( + TARGETS ${CUML_CPP_TARGET} + COMPONENT testing + DESTINATION bin/gtests/libcuml + EXCLUDE_FROM_ALL + ) endif() ############################################################################# @@ -133,6 +144,18 @@ if(BUILD_CUML_MG_TESTS) cumlprims_mg::cumlprims_mg ) + set_target_properties( + ${CUML_MG_TEST_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + + install( + TARGETS ${CUML_MG_TEST_TARGET} + COMPONENT testing + DESTINATION bin/gtests/libcuml_mg + EXCLUDE_FROM_ALL + ) + else(MPI_CXX_FOUND) message("OpenMPI not found. Skipping test '${CUML_MG_TEST_TARGET}'") endif() @@ -222,6 +245,17 @@ if(BUILD_PRIMS_TESTS) ${COMMON_TEST_LINK_LIBRARIES} ) + set_target_properties( + ${PRIMS_TEST_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + + install( + TARGETS ${PRIMS_TEST_TARGET} + COMPONENT testing + DESTINATION bin/gtests/libcuml_prims + EXCLUDE_FROM_ALL + ) endif() ##############################################################################