Skip to content

Commit

Permalink
REVERT cmake-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
viclafargue committed Mar 5, 2024
1 parent 493165e commit 33ffa18
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 30 deletions.
61 changes: 34 additions & 27 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,16 @@ target_include_directories(

if(NOT BUILD_CPU_ONLY)
# Keep cuVS as lightweight as possible. Only CUDA libs and rmm should be used in global target.
target_link_libraries(
cuvs
PUBLIC rmm::rmm $<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::compiled>
PRIVATE $<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::compiled_static> nvidia::cutlass::cutlass
)
target_link_libraries(cuvs
PUBLIC
rmm::rmm
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::compiled>
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::compiled_static>
nvidia::cutlass::cutlass
)
endif()

# Endian detection
Expand Down Expand Up @@ -300,14 +303,14 @@ endif()

set_target_properties(
cuvs
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
INTERFACE_POSITION_INDEPENDENT_CODE ON
POSITION_INDEPENDENT_CODE ON
POSITION_INDEPENDENT_CODE ON
)

target_compile_options(
Expand All @@ -321,21 +324,24 @@ target_link_options(cuvs PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/fatbin.ld")
# * cuvs_c -------------------------------------------------------------------------------
if(BUILD_C_LIBRARY)
add_library(
cuvs_c SHARED src/core/c_api.cpp src/neighbors/brute_force_c.cpp src/neighbors/ivf_flat_c.cpp
src/neighbors/ivf_pq_c.cpp src/neighbors/cagra_c.cpp
cuvs_c SHARED src/core/c_api.cpp
src/neighbors/brute_force_c.cpp
src/neighbors/ivf_flat_c.cpp
src/neighbors/ivf_pq_c.cpp
src/neighbors/cagra_c.cpp
)

add_library(cuvs::c_api ALIAS cuvs_c)

set_target_properties(
cuvs_c
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INTERFACE_POSITION_INDEPENDENT_CODE ON
EXPORT_NAME c_api
EXPORT_NAME c_api
)

target_compile_options(cuvs_c PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUVS_CXX_FLAGS}>")
Expand All @@ -346,11 +352,12 @@ if(BUILD_C_LIBRARY)
INTERFACE "$<INSTALL_INTERFACE:include>"
)

target_link_libraries(
cuvs_c
PUBLIC cuvs::cuvs
PRIVATE $<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
)
target_link_libraries(cuvs_c
PUBLIC
cuvs::cuvs
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
)

# ensure CUDA symbols aren't relocated to the middle of the debug build binaries
target_link_options(cuvs_c PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/fatbin.ld")
Expand Down
18 changes: 15 additions & 3 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,29 @@ if(BUILD_C_TESTS)
ConfigureTest(NAME INTEROP_TEST PATH test/core/interop.cu C_LIB)

ConfigureTest(
NAME BRUTEFORCE_C_TEST PATH test/neighbors/run_brute_force_c.c test/neighbors/brute_force_c.cu
NAME
BRUTEFORCE_C_TEST
PATH
test/neighbors/run_brute_force_c.c
test/neighbors/brute_force_c.cu
C_LIB
)

ConfigureTest(
NAME IVF_FLAT_C_TEST PATH test/neighbors/run_ivf_flat_c.c test/neighbors/ann_ivf_flat_c.cu
NAME
IVF_FLAT_C_TEST
PATH
test/neighbors/run_ivf_flat_c.c
test/neighbors/ann_ivf_flat_c.cu
C_LIB
)

ConfigureTest(
NAME IVF_PQ_C_TEST PATH test/neighbors/run_ivf_pq_c.c test/neighbors/ann_ivf_pq_c.cu C_LIB
NAME
IVF_PQ_C_TEST
PATH
test/neighbors/run_ivf_pq_c.c
test/neighbors/ann_ivf_pq_c.cu C_LIB
)

ConfigureTest(NAME CAGRA_C_TEST PATH test/neighbors/ann_cagra_c.cu C_LIB)
Expand Down

0 comments on commit 33ffa18

Please sign in to comment.