diff --git a/deploy/cpp/CMakeLists.txt b/deploy/cpp/CMakeLists.txt index 48bf6455e9bc5659d62e06dda946be3a8bbadb64..d5b0a45bc7e4725817d04831c9083aa856583f14 100644 --- a/deploy/cpp/CMakeLists.txt +++ b/deploy/cpp/CMakeLists.txt @@ -17,7 +17,6 @@ SET(OPENCV_DIR "" CACHE PATH "Location of libraries") SET(ENCRYPTION_DIR"" CACHE PATH "Location of libraries") SET(CUDA_LIB "" CACHE PATH "Location of libraries") - if (NOT WIN32) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -111,10 +110,17 @@ if (WIN32) find_package(OpenCV REQUIRED PATHS ${OPENCV_DIR}/build/ NO_DEFAULT_PATH) unset(OpenCV_DIR CACHE) else () - find_package(OpenCV REQUIRED PATHS ${OPENCV_DIR}/share/OpenCV NO_DEFAULT_PATH) + if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") # x86_64 aarch64 + set(OpenCV_INCLUDE_DIRS "/usr/include/opencv4") + file(GLOB OpenCV_LIBS /usr/lib/aarch64-linux-gnu/libopencv_*${CMAKE_SHARED_LIBRARY_SUFFIX}) + message("OpenCV libs: ${OpenCV_LIBS}") + else() + find_package(OpenCV REQUIRED PATHS ${OPENCV_DIR}/share/OpenCV NO_DEFAULT_PATH) + endif() include_directories("${PADDLE_DIR}/paddle/include") link_directories("${PADDLE_DIR}/paddle/lib") endif () + include_directories(${OpenCV_INCLUDE_DIRS}) if (WIN32) @@ -276,6 +282,7 @@ if (NOT WIN32) endif() set(DEPS ${DEPS} ${OpenCV_LIBS}) + add_library(paddlex_inference SHARED src/visualize src/transforms.cpp src/paddlex.cpp) ADD_DEPENDENCIES(paddlex_inference ext-yaml-cpp) target_link_libraries(paddlex_inference ${DEPS}) diff --git a/deploy/cpp/scripts/jetson_bootstrap.sh b/deploy/cpp/scripts/jetson_bootstrap.sh deleted file mode 100644 index ebd95d0f20439674bbae2628ab7f8d89b7b4beca..0000000000000000000000000000000000000000 --- a/deploy/cpp/scripts/jetson_bootstrap.sh +++ /dev/null @@ -1,10 +0,0 @@ -# download pre-compiled opencv lib -OPENCV_URL=https://bj.bcebos.com/paddlex/deploy/tools/opencv3_aarch.tgz -if [ ! -d "./deps/opencv3" ]; then - mkdir -p deps - cd deps - wget -c ${OPENCV_URL} - tar xvfz opencv3_aarch.tgz - rm -rf opencv3_aarch.tgz - cd .. -fi diff --git a/deploy/cpp/scripts/jetson_build.sh b/deploy/cpp/scripts/jetson_build.sh index 95bec3cac95be5cf686d63ec5b0f49f62e706586..cc3a5ff20bd99e6e0bae274ab4f33a79882732b4 100644 --- a/deploy/cpp/scripts/jetson_build.sh +++ b/deploy/cpp/scripts/jetson_build.sh @@ -14,15 +14,11 @@ WITH_STATIC_LIB=OFF # CUDA 的 lib 路径 CUDA_LIB=/usr/local/cuda/lib64 # CUDNN 的 lib 路径 -CUDNN_LIB=/usr/local/cuda/lib64 +CUDNN_LIB=/usr/lib/aarch64-linux-gnu -# 是否加载加密后的模型 +# 是否加载加密后的模型(jetson版本预测库暂不支持模型加密) WITH_ENCRYPTION=OFF -# OPENCV 路径, 如果使用自带预编译版本可不修改 -sh $(pwd)/scripts/jetson_bootstrap.sh # 下载预编译版本的opencv -OPENCV_DIR=$(pwd)/deps/opencv3 - # 以下无需改动 rm -rf build mkdir -p build @@ -38,5 +34,4 @@ cmake .. \ -DCUDA_LIB=${CUDA_LIB} \ -DCUDNN_LIB=${CUDNN_LIB} \ -DENCRYPTION_DIR=${ENCRYPTION_DIR} \ - -DOPENCV_DIR=${OPENCV_DIR} make