|
|
|
@ -17,32 +17,21 @@ if(APPLE)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pessimizing-move")
|
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
|
|
function(inference_api_test TARGET_NAME TEST_SRC)
|
|
|
|
|
function(inference_api_test TARGET_NAME)
|
|
|
|
|
set(options "")
|
|
|
|
|
set(oneValueArgs "")
|
|
|
|
|
set(multiValueArgs ARGS)
|
|
|
|
|
cmake_parse_arguments(inference_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
|
|
|
|
|
|
set(PYTHON_TESTS_DIR ${PADDLE_BINARY_DIR}/python/paddle/fluid/tests)
|
|
|
|
|
set(arg_list "")
|
|
|
|
|
cc_test(test_paddle_inference_${TARGET_NAME}
|
|
|
|
|
SRCS test_paddle_inference_${TARGET_NAME}.cc
|
|
|
|
|
DEPS paddle_fluid_api paddle_inference_api
|
|
|
|
|
ARGS --dirname=${PYTHON_TESTS_DIR}/book/)
|
|
|
|
|
if(inference_test_ARGS)
|
|
|
|
|
foreach(arg ${inference_test_ARGS})
|
|
|
|
|
list(APPEND arg_list "_${arg}")
|
|
|
|
|
endforeach()
|
|
|
|
|
else()
|
|
|
|
|
list(APPEND arg_list "_")
|
|
|
|
|
set_tests_properties(test_paddle_inference_${TARGET_NAME}
|
|
|
|
|
PROPERTIES DEPENDS "${inference_test_ARGS}")
|
|
|
|
|
endif()
|
|
|
|
|
foreach(arg ${arg_list})
|
|
|
|
|
string(REGEX REPLACE "^_$" "" arg "${arg}")
|
|
|
|
|
cc_test(${TARGET_NAME}
|
|
|
|
|
SRCS ${TEST_SRC}
|
|
|
|
|
DEPS paddle_fluid_api paddle_inference_api
|
|
|
|
|
ARGS --dirname=${PYTHON_TESTS_DIR}/book/)
|
|
|
|
|
# TODO(panyx0178): Figure out how to add word2vec and image_classification
|
|
|
|
|
# as deps.
|
|
|
|
|
# set_tests_properties(${TARGET_NAME}
|
|
|
|
|
# PROPERTIES DEPENDS ${DEP_TEST})
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction(inference_api_test)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,9 +39,11 @@ cc_library(paddle_inference_api
|
|
|
|
|
SRCS paddle_inference_api.cc paddle_inference_api_impl.cc
|
|
|
|
|
DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB})
|
|
|
|
|
|
|
|
|
|
cc_test(test_paddle_inference_api
|
|
|
|
|
SRCS test_paddle_inference_api.cc
|
|
|
|
|
DEPS paddle_inference_api)
|
|
|
|
|
if(WITH_TESTING)
|
|
|
|
|
cc_test(test_paddle_inference_api
|
|
|
|
|
SRCS test_paddle_inference_api.cc
|
|
|
|
|
DEPS paddle_inference_api)
|
|
|
|
|
|
|
|
|
|
inference_api_test(test_paddle_inference_api_impl
|
|
|
|
|
test_paddle_inference_api_impl.cc)
|
|
|
|
|
inference_api_test(api_impl
|
|
|
|
|
ARGS test_word2vec test_image_classification)
|
|
|
|
|
endif()
|
|
|
|
|