From 9df18b08f317717920378d86d17e1d20e8d7b37a Mon Sep 17 00:00:00 2001 From: Zhaolong Xing Date: Tue, 21 Jul 2020 18:22:26 +0800 Subject: [PATCH] Disable windows static library generation (#25593) * fix windows ci test=develop * fix ci error --- cmake/inference_lib.cmake | 16 ++++++++-------- paddle/fluid/inference/CMakeLists.txt | 13 +++++++++---- paddle/fluid/inference/api/demo_ci/run.sh | 4 ++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cmake/inference_lib.cmake b/cmake/inference_lib.cmake index 6fc81f2387b..5a889dbc314 100644 --- a/cmake/inference_lib.cmake +++ b/cmake/inference_lib.cmake @@ -19,9 +19,12 @@ set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING set(FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING "A path setting fluid inference shared and static libraries") +# TODO(zhaolong) +# At present, the size of static lib in Windows exceeds the system limit, +# so the generation of static lib is temporarily turned off. if(WIN32) #todo: remove the option - option(WITH_STATIC_LIB "Compile demo with static/shared library, default use static." ON) + option(WITH_STATIC_LIB "Compile demo with static/shared library, default use static." OFF) if(NOT PYTHON_EXECUTABLE) FIND_PACKAGE(PythonInterp REQUIRED) endif() @@ -187,21 +190,18 @@ copy(inference_lib_dist SRCS ${CMAKE_BINARY_DIR}/../paddle/fluid/framework/io/crypto/cipher.h DSTS ${FLUID_INFERENCE_INSTALL_DIR}/paddle/include/crypto/) include_directories(${CMAKE_BINARY_DIR}/../paddle/fluid/framework/io) + # CAPI inference library for only inference set(FLUID_INFERENCE_C_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_c_install_dir" CACHE STRING "A path setting CAPI fluid inference shared") copy_part_of_thrid_party(inference_lib_dist ${FLUID_INFERENCE_C_INSTALL_DIR}) set(src_dir "${PADDLE_SOURCE_DIR}/paddle/fluid") -if(WIN32) - set(paddle_fluid_c_lib ${PADDLE_BINARY_DIR}/paddle/fluid/inference/capi/${CMAKE_BUILD_TYPE}/paddle_fluid_c.*) -else(WIN32) - set(paddle_fluid_c_lib ${PADDLE_BINARY_DIR}/paddle/fluid/inference/capi/libpaddle_fluid_c.*) -endif(WIN32) +set(paddle_fluid_c_lib ${PADDLE_BINARY_DIR}/paddle/fluid/inference/capi/libpaddle_fluid_c.*) copy(inference_lib_dist - SRCS ${src_dir}/inference/capi/paddle_c_api.h ${paddle_fluid_c_lib} - DSTS ${FLUID_INFERENCE_C_INSTALL_DIR}/paddle/include ${FLUID_INFERENCE_C_INSTALL_DIR}/paddle/lib) + SRCS ${src_dir}/inference/capi/paddle_c_api.h ${paddle_fluid_c_lib} + DSTS ${FLUID_INFERENCE_C_INSTALL_DIR}/paddle/include ${FLUID_INFERENCE_C_INSTALL_DIR}/paddle/lib) # fluid library for both train and inference set(fluid_lib_deps inference_lib_dist) diff --git a/paddle/fluid/inference/CMakeLists.txt b/paddle/fluid/inference/CMakeLists.txt index 37ea3e5b40a..9dc96fdfe86 100644 --- a/paddle/fluid/inference/CMakeLists.txt +++ b/paddle/fluid/inference/CMakeLists.txt @@ -41,11 +41,16 @@ add_subdirectory(api) # Create static inference library if needed # All static libs in inference/api -set(STATIC_INFERENCE_API paddle_inference_api analysis_predictor zero_copy_tensor reset_tensor_array - analysis_config paddle_pass_builder activation_functions ${mkldnn_quantizer_cfg}) -create_static_lib(paddle_fluid ${fluid_modules} ${STATIC_INFERENCE_API}) +set(STATIC_INFERENCE_API paddle_inference_api analysis_predictor + zero_copy_tensor reset_tensor_array + analysis_config paddle_pass_builder activation_functions ${mkldnn_quantizer_cfg}) +if(WIN32) + cc_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_API}) +else() + create_static_lib(paddle_fluid ${fluid_modules} ${STATIC_INFERENCE_API}) +endif() -if(NOT APPLE) +if(NOT APPLE AND NOT WIN32) # TODO(liuyiqu: Temporarily disable the link flag because it is not support on Mac. set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_fluid.sym") set_target_properties(paddle_fluid PROPERTIES LINK_FLAGS "${LINK_FLAGS}") diff --git a/paddle/fluid/inference/api/demo_ci/run.sh b/paddle/fluid/inference/api/demo_ci/run.sh index bfa273d4468..d8d9e218781 100755 --- a/paddle/fluid/inference/api/demo_ci/run.sh +++ b/paddle/fluid/inference/api/demo_ci/run.sh @@ -72,7 +72,7 @@ if [ $(echo `uname` | grep "Win") != "" ]; then -DWITH_MKL=$TURN_ON_MKL \ -DDEMO_NAME=simple_on_word2vec \ -DWITH_GPU=$TEST_GPU_CPU \ - -DWITH_STATIC_LIB=ON + -DWITH_STATIC_LIB=OFF msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln Release/simple_on_word2vec.exe \ --dirname=$DATA_DIR/word2vec/word2vec.inference.model \ @@ -88,7 +88,7 @@ if [ $(echo `uname` | grep "Win") != "" ]; then -DWITH_MKL=$TURN_ON_MKL \ -DDEMO_NAME=vis_demo \ -DWITH_GPU=$TEST_GPU_CPU \ - -DWITH_STATIC_LIB=ON + -DWITH_STATIC_LIB=OFF msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln for vis_demo_name in $vis_demo_list; do Release/vis_demo.exe \ -- GitLab