未验证 提交 eb102189 编写于 作者: W wanghuancoder 提交者: GitHub

refine python lib link (#47681)

* refine python lib link
上级 624ffdf2
......@@ -78,6 +78,10 @@ cc_library(
autograd_meta
hook_utils)
if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
target_link_libraries(utils ${PYTHON_LIBRARIES})
endif()
if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
cc_library(
saved_tensors_hooks
......
......@@ -9,4 +9,5 @@ if(NOT (NOT WITH_PYTHON AND ON_INFER))
SRCS nodes.cc ${eager_manual_nodes}
DEPS ${eager_deps})
add_dependencies(final_dygraph_node eager_codegen)
target_link_libraries(final_dygraph_node ${PYTHON_LIBRARIES})
endif()
......@@ -9,4 +9,5 @@ if(NOT (NOT WITH_PYTHON AND ON_INFER))
SRCS dygraph_functions.cc ${eager_manual_functions}
DEPS ${eager_deps})
add_dependencies(final_dygraph_function eager_codegen)
target_link_libraries(final_dygraph_function ${PYTHON_LIBRARIES})
endif()
......@@ -143,7 +143,8 @@ def GenerateFileStructureForIntermediateDygraph(eager_dir, split_count):
for i in range(split_count):
f.write("nodes" + str(i + 1) + ".cc ")
f.write("${fluid_manual_nodes} DEPS ${eager_deps} ${fluid_deps})\n")
f.write("add_dependencies(dygraph_node copy_dygraph_node)")
f.write("add_dependencies(dygraph_node copy_dygraph_node)\n")
f.write("target_link_libraries(dygraph_node ${PYTHON_LIBRARIES})\n")
with open(forwards_level_cmakelist_path, "w") as f:
f.write("add_custom_target(\n")
......@@ -181,8 +182,9 @@ def GenerateFileStructureForIntermediateDygraph(eager_dir, split_count):
"${fluid_manual_functions} DEPS ${eager_deps} ${fluid_deps} ${GLOB_OP_LIB} ${GLOB_OPERATOR_DEPS})\n"
)
f.write(
"add_dependencies(dygraph_function copy_dygraph_forward_functions)"
"add_dependencies(dygraph_function copy_dygraph_forward_functions)\n"
)
f.write("target_link_libraries(dygraph_function ${PYTHON_LIBRARIES})\n")
with open(generated_level_cmakelist_path, "w") as f:
f.write("add_subdirectory(forwards)\nadd_subdirectory(nodes)")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册