Skip to content

Commit

Permalink
splitting public and private libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarbirus committed Sep 13, 2024
1 parent 1b7c82f commit 6953305
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (NOT MSVC)
endif()

unset(GGML_EXTRA_LIBS)
unset(GGML_EXTRA_LIBS_PUBLIC)

if (APPLE AND GGML_ACCELERATE)
find_library(ACCELERATE_FRAMEWORK Accelerate)
Expand Down Expand Up @@ -506,8 +507,7 @@ if (GGML_HIPBLAS)
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
endif()

# TODO: this "PUBLIC" here seems wrong
list(APPEND GGML_EXTRA_LIBS PUBLIC hip::host roc::rocblas roc::hipblas)
list(APPEND GGML_EXTRA_LIBS_PUBLIC hip::host roc::rocblas roc::hipblas)
endif()

if (GGML_SYCL)
Expand Down Expand Up @@ -1339,17 +1339,19 @@ target_include_directories(ggml PRIVATE . ${GGML_EXTRA_INCLUDES})
target_link_directories (ggml PRIVATE ${GGML_EXTRA_LIBDIRS})
target_compile_features (ggml PRIVATE c_std_11) # don't bump

list(REMOVE_DUPLICATES GGML_EXTRA_LIBS)

target_link_libraries(ggml PRIVATE Threads::Threads ${GGML_EXTRA_LIBS})
list(APPEND GGML_EXTRA_LIBS Threads::Threads)

find_library(MATH_LIBRARY m)
if (MATH_LIBRARY)
if (NOT WIN32 OR NOT GGML_SYCL)
target_link_libraries(ggml PRIVATE m)
list(APPEND GGML_EXTRA_LIBS m)
endif()
endif()

list(REMOVE_DUPLICATES GGML_EXTRA_LIBS)
list(REMOVE_DUPLICATES GGML_EXTRA_LIBS_PUBLIC)
target_link_libraries(ggml PRIVATE ${GGML_EXTRA_LIBS} PUBLIC ${GGML_EXTRA_LIBS_PUBLIC})

if (BUILD_SHARED_LIBS)
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(ggml PRIVATE GGML_SHARED GGML_BUILD)
Expand Down

0 comments on commit 6953305

Please sign in to comment.