Skip to content

Commit

Permalink
cmake : adapt native lib linking for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
amqdn committed Oct 1, 2024
1 parent fc2b435 commit 41f5a29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 41f5a29

Please sign in to comment.