From 41f5a29f032fccfb10bb12032b4b6577bd8c6c84 Mon Sep 17 00:00:00 2001 From: Andrew Minh Nguyen Date: Tue, 1 Oct 2024 13:10:40 -0500 Subject: [PATCH] cmake : adapt native lib linking for Android --- ggml/src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ggml/src/CMakeLists.txt b/ggml/src/CMakeLists.txt index cbc349500728b4..d289ed1f8a66d8 100644 --- a/ggml/src/CMakeLists.txt +++ b/ggml/src/CMakeLists.txt @@ -1341,11 +1341,15 @@ list(APPEND GGML_EXTRA_LIBS_PRIVATE Threads::Threads) find_library(MATH_LIBRARY m) if (MATH_LIBRARY) - if (NOT WIN32 OR NOT GGML_SYCL) + if (NOT WIN32 AND (NOT GGML_SYCL OR CMAKE_SYSTEM_NAME MATCHES "Android")) list(APPEND GGML_EXTRA_LIBS_PRIVATE m) endif() endif() +if (CMAKE_SYSTEM_NAME MATCHES "Android") + list(APPEND GGML_EXTRA_LIBS_PRIVATE dl) # Must be linked explicitly +endif() + list(REMOVE_DUPLICATES GGML_EXTRA_LIBS_PRIVATE) list(REMOVE_DUPLICATES GGML_EXTRA_LIBS_PUBLIC) target_link_libraries(ggml PRIVATE ${GGML_EXTRA_LIBS_PRIVATE} PUBLIC ${GGML_EXTRA_LIBS_PUBLIC})