Skip to content

Commit

Permalink
Add CMake install rules for tests (#969)
Browse files Browse the repository at this point in the history
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 us to deprecate _Project Flash_.

Authors:
  - AJ Schmidt (https://github.com/ajschmidt8)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)

URL: #969
  • Loading branch information
ajschmidt8 authored Feb 7, 2022
1 parent 79f7e39 commit 514f4b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function(ConfigureBench BENCH_NAME)
${BENCH_NAME}
PROPERTIES POSITION_INDEPENDENT_CODE ON
RUNTIME_OUTPUT_DIRECTORY "$<BUILD_INTERFACE:${RMM_BINARY_DIR}/gbenchmarks>"
CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}")
CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}"
INSTALL_RPATH "\$ORIGIN/../../../lib")
target_link_libraries(${BENCH_NAME} benchmark::benchmark pthread rmm)
target_compile_definitions(${BENCH_NAME}
PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}")
Expand All @@ -55,6 +56,11 @@ function(ConfigureBench BENCH_NAME)
PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-declarations>)
endif()

install(
TARGETS ${BENCH_NAME}
COMPONENT testing
DESTINATION bin/benchmarks/librmm
EXCLUDE_FROM_ALL)
endfunction(ConfigureBench)

# random allocations benchmark
Expand Down
9 changes: 8 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function(ConfigureTestInternal TEST_NAME)
${TEST_NAME}
PROPERTIES POSITION_INDEPENDENT_CODE ON
RUNTIME_OUTPUT_DIRECTORY "$<BUILD_INTERFACE:${RMM_BINARY_DIR}/gtests>"
CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}")
CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}"
INSTALL_RPATH "\$ORIGIN/../../../lib")
target_compile_definitions(${TEST_NAME}
PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}")
if(DEFINED CUDA_MALLOC_ASYNC_SUPPORT AND NOT CUDA_MALLOC_ASYNC_SUPPORT)
Expand Down Expand Up @@ -71,6 +72,12 @@ function(ConfigureTestInternal TEST_NAME)
endif()

add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})

install(
TARGETS ${TEST_NAME}
COMPONENT testing
DESTINATION bin/gtests/librmm
EXCLUDE_FROM_ALL)
endfunction()

# Wrapper around `ConfigureTestInternal` that builds tests both with and without per thread default
Expand Down

0 comments on commit 514f4b4

Please sign in to comment.