Skip to content

Commit 5721bbb

Browse files
committed
Link Torch separately after the main dependency closure
1 parent 7419be6 commit 5721bbb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

source/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ if(ENABLE_MLALGO)
221221
endif()
222222

223223
if(ENABLE_MLALGO OR DEFINED Torch_DIR)
224-
list(APPEND _abacus_feature_libs ${TORCH_LIBRARIES})
225224
list(APPEND _abacus_feature_include_dirs ${TORCH_INCLUDE_DIRS})
226225
list(APPEND _abacus_feature_compile_options ${ABACUS_TORCH_CXX_FLAGS})
227226
endif()
@@ -664,6 +663,11 @@ endif()
664663
# External closure: feature consumers precede numerical providers and runtimes.
665664
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE abacus::link_libs)
666665

666+
# Torch includes some LAPACK routines, but with floating-point exceptions.
667+
if(ENABLE_MLALGO OR DEFINED Torch_DIR)
668+
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE ${TORCH_LIBRARIES})
669+
endif()
670+
667671
# Apply feature definitions and common compile usage requirements only after all
668672
# source targets have been created.
669673
abacus_apply_build_options_to_dir("${CMAKE_CURRENT_SOURCE_DIR}")

0 commit comments

Comments
 (0)