未验证 提交 5f54a7fe 编写于 作者: Y YuanRisheng 提交者: GitHub

[BugFix]Fix inference static lib bugs (#54207)

* fix inference static lib bugs

* add if for copy

* fix py3 bugs
上级 cbeff5fc
...@@ -269,12 +269,13 @@ else() ...@@ -269,12 +269,13 @@ else()
SRCS ${src_dir}/inference/api/paddle_*.h ${paddle_inference_lib} SRCS ${src_dir}/inference/api/paddle_*.h ${paddle_inference_lib}
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib)
if(WITH_PHI_SHARED)
set(paddle_phi_lib ${PADDLE_BINARY_DIR}/paddle/phi/libphi.*) set(paddle_phi_lib ${PADDLE_BINARY_DIR}/paddle/phi/libphi.*)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${paddle_phi_lib} SRCS ${paddle_phi_lib}
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib)
endif()
endif() endif()
......
...@@ -32,7 +32,8 @@ endif() ...@@ -32,7 +32,8 @@ endif()
# fluid_modules exclude API-interface of inference/api and inference/capi_exp # fluid_modules exclude API-interface of inference/api and inference/capi_exp
get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES) get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
set(utils_modules pretty_log string_helper benchmark) get_property(phi_modules GLOBAL PROPERTY PHI_MODULES)
set(utils_modules pretty_log string_helper benchmark utf8proc)
add_subdirectory(api) add_subdirectory(api)
...@@ -63,8 +64,9 @@ else() ...@@ -63,8 +64,9 @@ else()
# message("${fluid_modules}") # message("${fluid_modules}")
# message("${STATIC_INFERENCE_API}") # message("${STATIC_INFERENCE_API}")
# message("${utils_modules}") # message("${utils_modules}")
create_static_lib(paddle_inference ${fluid_modules} ${STATIC_INFERENCE_API} # message("${phi_modules}")
${utils_modules}) create_static_lib(paddle_inference ${phi_modules} ${fluid_modules}
${STATIC_INFERENCE_API} ${utils_modules})
endif() endif()
if(NOT APPLE) if(NOT APPLE)
......
...@@ -45,6 +45,8 @@ set(PHI_DEPS ...@@ -45,6 +45,8 @@ set(PHI_DEPS
cblas cblas
utf8proc) utf8proc)
set(INFERENCE_DEPS phi_profiler_proto auto_parallel_proto)
if(WITH_GPU) if(WITH_GPU)
list(APPEND PHI_DEPS external_error_proto) list(APPEND PHI_DEPS external_error_proto)
endif() endif()
...@@ -79,6 +81,7 @@ endif() ...@@ -79,6 +81,7 @@ endif()
if(WITH_MKLML) if(WITH_MKLML)
list(APPEND PHI_DEPS pocketfft dynload_mklml) list(APPEND PHI_DEPS pocketfft dynload_mklml)
list(APPEND INFERENCE_DEPS dynload_mklml)
endif() endif()
if(WITH_XPU) if(WITH_XPU)
...@@ -183,6 +186,13 @@ if(WITH_FLASHATTN) ...@@ -183,6 +186,13 @@ if(WITH_FLASHATTN)
add_dependencies(phi flashattn) add_dependencies(phi flashattn)
endif() endif()
# for inference static library
if(NOT WITH_PHI_SHARED)
get_property(phi_modules GLOBAL PROPERTY PHI_MODULES)
set(phi_modules ${phi_modules} ${INFERENCE_DEPS} phi)
set_property(GLOBAL PROPERTY PHI_MODULES "${phi_modules}")
endif()
set(phi_extension_header_file set(phi_extension_header_file
${CMAKE_CURRENT_SOURCE_DIR}/extension.h ${CMAKE_CURRENT_SOURCE_DIR}/extension.h
CACHE INTERNAL "phi/extension.h file") CACHE INTERNAL "phi/extension.h file")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册