Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,9 @@ if(EXECUTORCH_BUILD_PYBIND)
endif()

# find pytorch lib, to allow pybind to take at::Tensor as input/output
find_package(Torch CONFIG REQUIRED)
if(NOT TARGET torch)
find_package(Torch CONFIG REQUIRED)
endif()
find_library(
TORCH_PYTHON_LIBRARY torch_python PATHS "${TORCH_INSTALL_PREFIX}/lib"
)
Expand Down
4 changes: 3 additions & 1 deletion build/Codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ function(gen_custom_ops_aot_lib)
${_out_dir}/CustomOpsNativeFunctions.h "${GEN_KERNEL_SOURCES}"
)
# Find `Torch`.
find_package(Torch REQUIRED)
if(NOT TARGET torch)
find_package(Torch REQUIRED)
endif()
# This lib uses ATen lib, so we explicitly enable rtti and exceptions.
target_compile_options(${GEN_LIB_NAME} PRIVATE -frtti -fexceptions)
target_compile_definitions(${GEN_LIB_NAME} PRIVATE USE_ATEN_LIB=1)
Expand Down
4 changes: 3 additions & 1 deletion extension/llm/custom_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ install(TARGETS custom_ops DESTINATION lib)

if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
# Add a AOT library
find_package(Torch CONFIG REQUIRED)
if(NOT TARGET torch)
find_package(Torch CONFIG REQUIRED)
endif()
add_library(
custom_ops_aot_lib SHARED
${_custom_ops__srcs}
Expand Down
Loading