cmake : fix KleidiAI install target failure with EXCLUDE_FROM_ALL (#19581)
* cmake: fix KleidiAI install target failure with EXCLUDE_FROM_ALL Fix for the bug #19501 by adding EXCLUDE_FROM_ALL to FetchContent_Declare. This properly excludes KleidiAI from both build and install targets, preventing install failures when GGML_CPU_KLEIDIAI=ON is used. The KleidiAI source files are still compiled into libggml-cpu.so, preserving all functionality. * addressed code review comments
This commit is contained in:
@@ -569,12 +569,14 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
|||||||
cmake_policy(SET CMP0135 NEW)
|
cmake_policy(SET CMP0135 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# TODO: Use FetchContent_MakeAvailable with EXCLUDE_FROM_ALL after bumping minimum CMake version to 3.28+
|
||||||
|
# Using FetchContent_Populate instead to avoid EXCLUDE_FROM_ALL which requires CMake 3.28
|
||||||
FetchContent_Declare(KleidiAI_Download
|
FetchContent_Declare(KleidiAI_Download
|
||||||
URL ${KLEIDIAI_DOWNLOAD_URL}
|
URL ${KLEIDIAI_DOWNLOAD_URL}
|
||||||
DOWNLOAD_EXTRACT_TIMESTAMP NEW
|
DOWNLOAD_EXTRACT_TIMESTAMP NEW
|
||||||
URL_HASH MD5=${KLEIDIAI_ARCHIVE_MD5})
|
URL_HASH MD5=${KLEIDIAI_ARCHIVE_MD5})
|
||||||
|
|
||||||
FetchContent_MakeAvailable(KleidiAI_Download)
|
FetchContent_Populate(KleidiAI_Download)
|
||||||
FetchContent_GetProperties(KleidiAI_Download
|
FetchContent_GetProperties(KleidiAI_Download
|
||||||
SOURCE_DIR KLEIDIAI_SRC
|
SOURCE_DIR KLEIDIAI_SRC
|
||||||
POPULATED KLEIDIAI_POPULATED)
|
POPULATED KLEIDIAI_POPULATED)
|
||||||
@@ -585,11 +587,6 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
|||||||
|
|
||||||
add_compile_definitions(GGML_USE_CPU_KLEIDIAI)
|
add_compile_definitions(GGML_USE_CPU_KLEIDIAI)
|
||||||
|
|
||||||
# Remove kleidiai target after fetching it
|
|
||||||
if (TARGET kleidiai)
|
|
||||||
set_target_properties(kleidiai PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND GGML_CPU_SOURCES
|
list(APPEND GGML_CPU_SOURCES
|
||||||
ggml-cpu/kleidiai/kleidiai.cpp
|
ggml-cpu/kleidiai/kleidiai.cpp
|
||||||
ggml-cpu/kleidiai/kernels.cpp
|
ggml-cpu/kleidiai/kernels.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user