Skip to content

Commit

Permalink
Use cmake-format
Browse files Browse the repository at this point in the history
  • Loading branch information
achirkin committed Dec 9, 2022
1 parent c5631bf commit 2e46750
Showing 1 changed file with 84 additions and 66 deletions.
150 changes: 84 additions & 66 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# =============================================================================
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# =============================================================================

# ##################################################################################################
# * compiler function -----------------------------------------------------------------------------
# ##############################################################################
# * compiler function
# -----------------------------------------------------------------------------

function(ConfigureTest)

set(options OPTIONAL DIST NN)
set(oneValueArgs NAME)
set(multiValueArgs PATH TARGETS CONFIGURATIONS)

cmake_parse_arguments(ConfigureTest "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(ConfigureTest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})

set(TEST_NAME ${ConfigureTest_NAME})

Expand All @@ -38,8 +42,7 @@ function(ConfigureTest)
GTest::gtest_main
Threads::Threads
$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
$<TARGET_NAME_IF_EXISTS:conda_env>
)
$<TARGET_NAME_IF_EXISTS:conda_env>)

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

Expand All @@ -50,38 +53,44 @@ function(ConfigureTest)
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
)
CUDA_STANDARD_REQUIRED ON)

target_compile_options(
${TEST_NAME} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${RAFT_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${RAFT_CUDA_FLAGS}>"
)
"$<$<COMPILE_LANGUAGE:CUDA>:${RAFT_CUDA_FLAGS}>")

target_include_directories(${TEST_NAME} PUBLIC "$<BUILD_INTERFACE:${RAFT_SOURCE_DIR}/test>")
target_include_directories(
${TEST_NAME} PUBLIC "$<BUILD_INTERFACE:${RAFT_SOURCE_DIR}/test>")

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

# ##################################################################################################
# test sources ##################################################################################
# ##################################################################################################
# ##############################################################################
# test sources
# ##################################################################################
# ##############################################################################

# ##################################################################################################
# * distance tests -------------------------------------------------------------------------
# ##############################################################################
# * distance tests
# -------------------------------------------------------------------------

if(BUILD_TESTS)
ConfigureTest(
NAME CLUSTER_TEST PATH test/cluster/kmeans.cu test/cluster_solvers.cu test/cluster/linkage.cu
OPTIONAL DIST NN
)
configuretest(
NAME
CLUSTER_TEST
PATH
test/cluster/kmeans.cu
test/cluster_solvers.cu
test/cluster/linkage.cu
OPTIONAL
DIST
NN)

ConfigureTest(
configuretest(
NAME
CORE_TEST
PATH
Expand All @@ -94,10 +103,9 @@ if(BUILD_TESTS)
test/memory_type.cpp
test/span.cpp
test/span.cu
test/test.cpp
)
test/test.cpp)

ConfigureTest(
configuretest(
NAME
DISTANCE_TEST
PATH
Expand All @@ -119,12 +127,12 @@ if(BUILD_TESTS)
test/distance/fused_l2_nn.cu
test/distance/gram.cu
OPTIONAL
DIST
)
DIST)

ConfigureTest(NAME LABEL_TEST PATH test/label/label.cu test/label/merge_labels.cu)
configuretest(NAME LABEL_TEST PATH test/label/label.cu
test/label/merge_labels.cu)

ConfigureTest(
configuretest(
NAME
LINALG_TEST
PATH
Expand Down Expand Up @@ -158,10 +166,9 @@ if(BUILD_TESTS)
test/linalg/svd.cu
test/linalg/ternary_op.cu
test/linalg/transpose.cu
test/linalg/unary_op.cu
)
test/linalg/unary_op.cu)

ConfigureTest(
configuretest(
NAME
MATRIX_TEST
PATH
Expand All @@ -177,10 +184,9 @@ if(BUILD_TESTS)
test/matrix/reverse.cu
test/matrix/slice.cu
test/matrix/triangular.cu
test/spectral_matrix.cu
)
test/spectral_matrix.cu)

ConfigureTest(
configuretest(
NAME
RANDOM_TEST
PATH
Expand All @@ -192,15 +198,20 @@ if(BUILD_TESTS)
test/random/rng_discrete.cu
test/random/rng_int.cu
test/random/rmat_rectangular_generator.cu
test/random/sample_without_replacement.cu
)
test/random/sample_without_replacement.cu)

ConfigureTest(
NAME SOLVERS_TEST PATH test/cluster_solvers_deprecated.cu test/eigen_solvers.cu test/lap/lap.cu
test/mst.cu OPTIONAL DIST
)
configuretest(
NAME
SOLVERS_TEST
PATH
test/cluster_solvers_deprecated.cu
test/eigen_solvers.cu
test/lap/lap.cu
test/mst.cu
OPTIONAL
DIST)

ConfigureTest(
configuretest(
NAME
SPARSE_TEST
PATH
Expand All @@ -217,20 +228,30 @@ if(BUILD_TESTS)
test/sparse/row_op.cu
test/sparse/sort.cu
test/sparse/spgemmi.cu
test/sparse/symmetrize.cu
)
test/sparse/symmetrize.cu)

ConfigureTest(
NAME SPARSE_DIST_TEST PATH test/sparse/dist_coo_spmv.cu test/sparse/distance.cu OPTIONAL DIST
NN
)
configuretest(
NAME
SPARSE_DIST_TEST
PATH
test/sparse/dist_coo_spmv.cu
test/sparse/distance.cu
OPTIONAL
DIST
NN)

ConfigureTest(
NAME SPARSE_NEIGHBORS_TEST PATH test/sparse/neighbors/connect_components.cu
test/sparse/neighbors/brute_force.cu test/sparse/neighbors/knn_graph.cu OPTIONAL DIST NN
)
configuretest(
NAME
SPARSE_NEIGHBORS_TEST
PATH
test/sparse/neighbors/connect_components.cu
test/sparse/neighbors/brute_force.cu
test/sparse/neighbors/knn_graph.cu
OPTIONAL
DIST
NN)

ConfigureTest(
configuretest(
NAME
NEIGHBORS_TEST
PATH
Expand All @@ -250,10 +271,9 @@ if(BUILD_TESTS)
test/neighbors/selection.cu
OPTIONAL
DIST
NN
)
NN)

ConfigureTest(
configuretest(
NAME
STATS_TEST
PATH
Expand Down Expand Up @@ -284,10 +304,9 @@ if(BUILD_TESTS)
test/stats/v_measure.cu
OPTIONAL
DIST
NN
)
NN)

ConfigureTest(
configuretest(
NAME
UTILS_TEST
PATH
Expand All @@ -296,6 +315,5 @@ if(BUILD_TESTS)
test/device_atomics.cu
test/integer_utils.cpp
test/pow2_utils.cu
test/util/bitonic_sort.cu
)
test/util/bitonic_sort.cu)
endif()

0 comments on commit 2e46750

Please sign in to comment.