diff --git a/backends/aoti/CMakeLists.txt b/backends/aoti/CMakeLists.txt index 8d49bcf1f96..dc205f453e6 100644 --- a/backends/aoti/CMakeLists.txt +++ b/backends/aoti/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT EXECUTORCH_ROOT) set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) endif() -# Use ExecuTorch's standard way to find PyTorch libraries for AOTI +# Use ExecuTorch's standard way to find PyTorch headers for AOTI include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) find_package_torch() @@ -40,13 +40,8 @@ target_compile_options(aoti_common PUBLIC -fexceptions -frtti -fPIC) # Ensure symbols are exported properly target_link_options(aoti_common PUBLIC -Wl,--export-dynamic) -# Link against PyTorch libraries and standard libraries -target_link_libraries( - aoti_common - PUBLIC extension_tensor ${CMAKE_DL_LIBS} - # Link PyTorch libraries for AOTI functions - ${TORCH_LIBRARIES} -) +# Link against standard libraries +target_link_libraries(aoti_common PUBLIC extension_tensor ${CMAKE_DL_LIBS}) executorch_target_link_options_shared_lib(aoti_common) install( diff --git a/backends/cuda/CMakeLists.txt b/backends/cuda/CMakeLists.txt index 7a9cdbd0b39..eaebc93acf7 100644 --- a/backends/cuda/CMakeLists.txt +++ b/backends/cuda/CMakeLists.txt @@ -30,7 +30,7 @@ endif() find_package(CUDAToolkit REQUIRED) -# Use ExecutorTorch's standard way to find PyTorch libraries for AOTI +# Use ExecutorTorch's standard way to find PyTorch headers for AOTI include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) find_package_torch() @@ -51,12 +51,9 @@ target_compile_options(aoti_cuda PUBLIC -fexceptions -frtti -fPIC) # Ensure symbols are exported properly target_link_options(aoti_cuda PUBLIC -Wl,--export-dynamic) -# Link against CUDA::cudart, common AOTI library, and PyTorch CUDA libraries +# Link against CUDA::cudart, common AOTI library and standard libraries target_link_libraries( - aoti_cuda - PUBLIC aoti_common CUDA::cudart ${CMAKE_DL_LIBS} - # Link PyTorch libraries for AOTI CUDA functions - ${TORCH_LIBRARIES} + aoti_cuda PUBLIC aoti_common CUDA::cudart ${CMAKE_DL_LIBS} ) # If you need other CUDA libraries, link them similarly: # target_link_libraries(aoti_cuda PUBLIC CUDA::cublas CUDA::cufft ...)