From d1cc772bb4df39680b8bd80df1b11945bf5602ce Mon Sep 17 00:00:00 2001 From: iducn <45056973+iducn@users.noreply.github.com> Date: Fri, 7 Aug 2020 09:51:07 +0800 Subject: [PATCH] [Inference] [unittest] Inference unit tests rely on dynamic libraries (2) (#24859) (#26010) Co-authored-by: Wilber --- paddle/fluid/inference/analysis/CMakeLists.txt | 15 +++++++++++---- paddle/fluid/train/CMakeLists.txt | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/inference/analysis/CMakeLists.txt b/paddle/fluid/inference/analysis/CMakeLists.txt index a2e2ab7f30f..133d7177d96 100644 --- a/paddle/fluid/inference/analysis/CMakeLists.txt +++ b/paddle/fluid/inference/analysis/CMakeLists.txt @@ -60,7 +60,14 @@ function(inference_analysis_test TARGET) endif() endfunction(inference_analysis_test) -inference_analysis_test(test_analyzer - SRCS analyzer_tester.cc - EXTRA_DEPS reset_tensor_array paddle_inference_api - ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR}) +if (NOT APPLE AND NOT WIN32) + inference_analysis_test(test_analyzer + SRCS analyzer_tester.cc + EXTRA_DEPS reset_tensor_array paddle_fluid_shared + ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR}) +else() + inference_analysis_test(test_analyzer + SRCS analyzer_tester.cc + EXTRA_DEPS reset_tensor_array paddle_inference_api + ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR}) +endif() diff --git a/paddle/fluid/train/CMakeLists.txt b/paddle/fluid/train/CMakeLists.txt index c8246f76d9d..04870f87c40 100644 --- a/paddle/fluid/train/CMakeLists.txt +++ b/paddle/fluid/train/CMakeLists.txt @@ -14,10 +14,17 @@ function(train_test TARGET_NAME) endif() foreach(arg ${arg_list}) string(REGEX REPLACE "^_$" "" arg "${arg}") - cc_test(test_train_${TARGET_NAME}${arg} - SRCS test_train_${TARGET_NAME}.cc - DEPS paddle_fluid_api - ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}${arg}.train.model/) + if (NOT APPLE AND NOT WIN32) + cc_test(test_train_${TARGET_NAME}${arg} + SRCS test_train_${TARGET_NAME}.cc + DEPS paddle_fluid_shared + ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}${arg}.train.model/) + else() + cc_test(test_train_${TARGET_NAME}${arg} + SRCS test_train_${TARGET_NAME}.cc + DEPS paddle_fluid_api + ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}${arg}.train.model/) + endif() set_tests_properties(test_train_${TARGET_NAME}${arg} PROPERTIES DEPENDS test_${TARGET_NAME}) set_tests_properties(test_train_${TARGET_NAME}${arg} -- GitLab