Makefile 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ARM_ABI = arm8
  2. export ARM_ABI
  3. include ../Makefile.def
  4. LITE_ROOT=../../../
  5. THIRD_PARTY_DIR=${LITE_ROOT}/third_party
  6. OPENCV_VERSION=opencv4.1.0
  7. OPENCV_LIBS = ../../../third_party/${OPENCV_VERSION}/arm64-v8a/libs/libopencv_imgcodecs.a \
  8. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/libs/libopencv_imgproc.a \
  9. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/libs/libopencv_core.a \
  10. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/libtegra_hal.a \
  11. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/liblibjpeg-turbo.a \
  12. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/liblibwebp.a \
  13. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/liblibpng.a \
  14. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/liblibjasper.a \
  15. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/liblibtiff.a \
  16. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/libIlmImf.a \
  17. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/libtbb.a \
  18. ../../../third_party/${OPENCV_VERSION}/arm64-v8a/3rdparty/libs/libcpufeatures.a
  19. OPENCV_INCLUDE = -I../../../third_party/${OPENCV_VERSION}/arm64-v8a/include
  20. CXX_INCLUDES = $(INCLUDES) ${OPENCV_INCLUDE} -I$(LITE_ROOT)/cxx/include
  21. CXX_LIBS = ${OPENCV_LIBS} -L$(LITE_ROOT)/cxx/lib/ -lpaddle_light_api_shared $(SYSTEM_LIBS)
  22. ###############################################################
  23. # How to use one of static libaray: #
  24. # `libpaddle_api_full_bundled.a` #
  25. # `libpaddle_api_light_bundled.a` #
  26. ###############################################################
  27. # Note: default use lite's shared library. #
  28. ###############################################################
  29. # 1. Comment above line using `libpaddle_light_api_shared.so`
  30. # 2. Undo comment below line using `libpaddle_api_light_bundled.a`
  31. #CXX_LIBS = $(LITE_ROOT)/cxx/lib/libpaddle_api_light_bundled.a $(SYSTEM_LIBS)
  32. ocr_db_crnn: fetch_clipper fetch_opencv ocr_db_crnn.o crnn_process.o db_post_process.o clipper.o cls_process.o
  33. $(CC) $(SYSROOT_LINK) $(CXXFLAGS_LINK) ocr_db_crnn.o crnn_process.o db_post_process.o clipper.o cls_process.o -o ocr_db_crnn $(CXX_LIBS) $(LDFLAGS)
  34. ocr_db_crnn.o: ocr_db_crnn.cc
  35. $(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o ocr_db_crnn.o -c ocr_db_crnn.cc
  36. crnn_process.o: fetch_opencv crnn_process.cc
  37. $(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o crnn_process.o -c crnn_process.cc
  38. cls_process.o: fetch_opencv cls_process.cc
  39. $(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o cls_process.o -c cls_process.cc
  40. db_post_process.o: fetch_clipper fetch_opencv db_post_process.cc
  41. $(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o db_post_process.o -c db_post_process.cc
  42. clipper.o: fetch_clipper
  43. $(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o clipper.o -c clipper.cpp
  44. fetch_clipper:
  45. @test -e clipper.hpp || \
  46. ( echo "Fetch clipper " && \
  47. wget -c https://paddle-inference-dist.cdn.bcebos.com/PaddleLite/Clipper/clipper.hpp)
  48. @ test -e clipper.cpp || \
  49. wget -c https://paddle-inference-dist.cdn.bcebos.com/PaddleLite/Clipper/clipper.cpp
  50. fetch_opencv:
  51. @ test -d ${THIRD_PARTY_DIR} || mkdir ${THIRD_PARTY_DIR}
  52. @ test -e ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz || \
  53. (echo "fetch opencv libs" && \
  54. wget -P ${THIRD_PARTY_DIR} https://paddle-inference-dist.bj.bcebos.com/${OPENCV_VERSION}.tar.gz)
  55. @ test -d ${THIRD_PARTY_DIR}/${OPENCV_VERSION} || \
  56. tar -zxvf ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz -C ${THIRD_PARTY_DIR}
  57. .PHONY: clean
  58. clean:
  59. rm -f ocr_db_crnn.o clipper.o db_post_process.o crnn_process.o cls_process.o
  60. rm -f ocr_db_crnn