Skip to content

Commit

Permalink
Don't call paddle module if it's not found (#26286)
Browse files Browse the repository at this point in the history
### Details:
 - To avoid cmake warnings when PDPD is not installed
  • Loading branch information
ilya-lavrenov authored Aug 28, 2024
1 parent 94173d8 commit 44caa93
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/frontends/paddle/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,31 @@ ov_add_test_target(
set(TEST_PADDLE_MODELS_DIRNAME ${TEST_MODEL_ZOO}/paddle_test_models)
target_compile_definitions(${TARGET_NAME} PRIVATE -D TEST_PADDLE_MODELS_DIRNAME=\"${TEST_PADDLE_MODELS_DIRNAME}/\")

execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import paddle; print(paddle.__version__)"
OUTPUT_VARIABLE PADDLE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "PaddlePaddle version: ${PADDLE_VERSION}")

if(PADDLE_VERSION VERSION_GREATER_EQUAL "2.6.0" OR PADDLE_VERSION VERSION_EQUAL "0.0.0")
set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/ppdet/modeling/ops.py")
set(PADDLEDET_OPS_SHA256 "e3da816421698ee97bb272c4410a03c300ab92045b7c87cccb9e52a8c18bc088")
set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release25/ppdet/modeling/)
else()
set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.1/ppdet/modeling/ops.py")
set(PADDLEDET_OPS_SHA256 "5cc079eda295ed78b58fba8223c51d85a931a7069ecad51c6af5c2fd26b7a8cb")
set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release21/ppdet/modeling/)
if(paddlepaddle_FOUND)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import paddle; print(paddle.__version__)"
OUTPUT_VARIABLE PADDLE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "PaddlePaddle version: ${PADDLE_VERSION}")

if(PADDLE_VERSION VERSION_GREATER_EQUAL "2.6.0" OR PADDLE_VERSION VERSION_EQUAL "0.0.0")
set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/ppdet/modeling/ops.py")
set(PADDLEDET_OPS_SHA256 "e3da816421698ee97bb272c4410a03c300ab92045b7c87cccb9e52a8c18bc088")
set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release25/ppdet/modeling/)
else()
set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.1/ppdet/modeling/ops.py")
set(PADDLEDET_OPS_SHA256 "5cc079eda295ed78b58fba8223c51d85a931a7069ecad51c6af5c2fd26b7a8cb")
set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release21/ppdet/modeling/)
endif()

DownloadAndCheck(${PADDLEDET_OPS_URL} ${PADDLEDET_DIRNAME}/ops.py PADDLEDET_FATAL PADDLEDET_RESULT ${PADDLEDET_OPS_SHA256})
endif()

DownloadAndCheck(${PADDLEDET_OPS_URL} ${PADDLEDET_DIRNAME}/ops.py PADDLEDET_FATAL PADDLEDET_RESULT ${PADDLEDET_OPS_SHA256})

# If 'paddlepaddle' is not found, code will still be compiled
# but models will not be generated and tests will fail
# If 'paddlepaddle' is not found, code will still be compiled, but models will not be generated and tests will fail
# This is done this way for 'code style' and check cases - cmake shall pass, but CI machine doesn't need to have
# 'paddlepaddle' installed to check code style
if(paddlepaddle_FOUND AND PADDLEDET_RESULT)
if(PADDLEDET_RESULT)
set(TEST_PADDLE_MODELS ${TEST_MODEL_ZOO_OUTPUT_DIR}/paddle_test_models/)

file(GLOB_RECURSE PADDLE_ALL_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/*.py)
Expand Down

0 comments on commit 44caa93

Please sign in to comment.