set(PADDLE_ROOT $ENV{PADDLE_ROOT} CACHE PATH "Paddle Path")
find_path(PADDLE_INC NAMES capi.h PATHS ${PADDLE_ROOT}/include/paddle)
find_library(PADDLE_LIB NAMES paddle_capi_shared PATHS ${PADDLE_ROOT}/lib/${ANDROID_ABI})
if(PADDLE_INC AND PADDLE_LIB)
  message(STATUS "Found PaddlePaddle (include: ${PADDLE_INC}; library: ${PADDLE_LIB})")
else()
  message(FATAL_ERROR "Cannot find PaddlePaddle on ${PADDLE_ROOT}")
endif()
include_directories(${PADDLE_ROOT}/include)

set(THIRD_PARTY_LIBRARYS)
list(APPEND THIRD_PARTY_LIBRARYS -lglog -lgflags -lprotobuf -lz)
link_directories(${PADDLE_ROOT}/lib/${ANDROID_ABI})
link_directories(${PADDLE_ROOT}/third_party/gflags/lib/${ANDROID_ABI})
link_directories(${PADDLE_ROOT}/third_party/glog/lib/${ANDROID_ABI})
link_directories(${PADDLE_ROOT}/third_party/protobuf/lib/${ANDROID_ABI})
link_directories(${PADDLE_ROOT}/third_party/zip/lib/${ANDROID_ABI})

find_library(OPENBLAS NAMES openblas PATHS ${PADDLE_ROOT}/third_party/openblas/lib/${ANDROID_ABI})
if(OPENBLAS)
  list(APPEND THIRD_PARTY_LIBRARYS -lopenblas)
  link_directories(${PADDLE_ROOT}/third_party/openblas/lib/${ANDROID_ABI})
endif()