Skip to content

Commit 3ed78f2

Browse files
committed
Link Torch separately after the main dependency closure
1 parent ed394f1 commit 3ed78f2

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()
@@ -663,6 +662,11 @@ endif()
663662
# External closure: feature consumers precede numerical providers and runtimes.
664663
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE abacus::link_libs)
665664

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

0 commit comments

Comments
 (0)