From af64e606e265d078285c27081cfa2f0d90748d23 Mon Sep 17 00:00:00 2001 From: Andrew Minh Nguyen Date: Fri, 27 Sep 2024 14:57:54 -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 cbc349500728b..3ec97f571627f 100644 --- a/ggml/src/CMakeLists.txt +++ b/ggml/src/CMakeLists.txt @@ -1331,6 +1331,10 @@ if (EMSCRIPTEN) set_target_properties(ggml PROPERTIES COMPILE_FLAGS "-msimd128") endif() +if (CMAKE_SYSTEM_NAME MATCHES "Android") + list(APPEND GGML_EXTRA_LIBS_PRIVATE dl) # Must be linked explicitly +endif() + target_compile_definitions(ggml PUBLIC ${GGML_CDEF_PUBLIC}) target_include_directories(ggml PUBLIC ../include) target_include_directories(ggml PRIVATE . ${GGML_EXTRA_INCLUDES}) @@ -1341,7 +1345,7 @@ 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 OR NOT GGML_SYCL OR NOT CMAKE_SYSTEM_NAME MATCHES "Android") list(APPEND GGML_EXTRA_LIBS_PRIVATE m) endif() endif()