Skip to content

Commit

Permalink
add support for android (#959)
Browse files Browse the repository at this point in the history
Signed-off-by: yusheng.ma <[email protected]>
  • Loading branch information
Presburger authored Nov 19, 2024
1 parent 4a01d3d commit 985c8e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ find_package(prometheus-cpp REQUIRED)
if(NOT WITH_RAFT)
find_package(fmt REQUIRED)
endif()
find_package(opentelemetry-cpp REQUIRED)

if(NOT WITH_LIGHT)
find_package(opentelemetry-cpp REQUIRED)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OSX_DEPLOYMENT_TARGET
"10.15"
Expand Down
15 changes: 9 additions & 6 deletions cmake/libs/libfaiss.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ if(__PPC64)
target_link_libraries(knowhere_utils PUBLIC glog::glog)
endif()

find_package(LAPACK REQUIRED)

if(LINUX)
set(BLA_VENDOR OpenBLAS)
Expand All @@ -70,8 +69,12 @@ if(APPLE)
set(BLA_VENDOR Apple)
endif()

find_package(BLAS REQUIRED)

if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
find_package(OpenBLAS REQUIRED)
set(BLAS_LIBRARIES OpenBLAS::OpenBLAS)
else()
find_package(BLAS REQUIRED)
endif()
if(__X86_64)
list(REMOVE_ITEM FAISS_SRCS ${FAISS_AVX2_SRCS})

Expand Down Expand Up @@ -110,7 +113,7 @@ if(__X86_64)
-Wno-unused-function
-Wno-strict-aliasing>)
target_link_libraries(
faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}
faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES}
faiss_avx2 faiss_avx512 knowhere_utils)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()
Expand All @@ -133,7 +136,7 @@ if(__AARCH64)

add_dependencies(faiss knowhere_utils)
target_link_libraries(faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES}
${LAPACK_LIBRARIES} knowhere_utils)
knowhere_utils)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()

Expand All @@ -160,6 +163,6 @@ if(__PPC64)

add_dependencies(faiss knowhere_utils)
target_link_libraries(faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES}
${LAPACK_LIBRARIES} knowhere_utils)
knowhere_utils)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()
7 changes: 6 additions & 1 deletion cmake/utils/platform_check.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ macro(detect_target_arch)
endif()
endmacro()

detect_target_arch()

if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(__AARCH64 1)
else()
detect_target_arch()
endif()

0 comments on commit 985c8e6

Please sign in to comment.