mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-03-14 18:37:23 +00:00
Merge pull request #1554 from KMSorSMS/main
[build](cmake): fix error if blis no found for amd
This commit is contained in:
@@ -337,8 +337,12 @@ if(KTRANSFORMERS_CPU_MOE_AMD)
|
||||
message(STATUS "Found BLIS include at ${BLIS_INCLUDE_DIR}")
|
||||
message(STATUS "Found BLIS library ${BLIS_LIBRARY}")
|
||||
endif()
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${BLIS_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${BLIS_LIBRARY})
|
||||
# The Python extension target (${PROJECT_NAME}) is created later by
|
||||
# pybind11_add_module(). Calling target_include_directories/target_link_libraries
|
||||
# here would fail because the target doesn't exist yet. Save the discovered
|
||||
# BLIS paths and apply them after the module target is created.
|
||||
set(_KT_BLIS_INCLUDE_DIR ${BLIS_INCLUDE_DIR})
|
||||
set(_KT_BLIS_LIBRARY ${BLIS_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -542,6 +546,18 @@ else()
|
||||
message(STATUS "LTO: disabled")
|
||||
endif()
|
||||
|
||||
# If BLIS was detected earlier, apply its include directory and library to the
|
||||
# created Python extension target. We only do this after the module target
|
||||
# (${PROJECT_NAME}) has been created by pybind11_add_module().
|
||||
if(DEFINED _KT_BLIS_INCLUDE_DIR AND DEFINED _KT_BLIS_LIBRARY)
|
||||
if(TARGET ${PROJECT_NAME})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${_KT_BLIS_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${_KT_BLIS_LIBRARY})
|
||||
else()
|
||||
message(WARNING "BLIS was detected earlier but ${PROJECT_NAME} target was not found when attempting to apply BLIS link/include settings.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ensure the module target also has correct RPATH when conda is active
|
||||
if(TARGET ${PROJECT_NAME} AND DEFINED ENV{CONDA_PREFIX} AND EXISTS "$ENV{CONDA_PREFIX}")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
|
||||
Reference in New Issue
Block a user