From c8f6a2d098c046ac3ffb96eb867778ffb6c70b81 Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Tue, 31 Aug 2021 07:01:27 +0000 Subject: [PATCH] fix cpp autolog --- deploy/cpp_infer/CMakeLists.txt | 6 +++--- .../cpp_infer/external-cmake/auto-log.cmake | 19 +++++++++---------- deploy/cpp_infer/src/main.cpp | 1 + 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/deploy/cpp_infer/CMakeLists.txt b/deploy/cpp_infer/CMakeLists.txt index 29a50684..6d3ecb6a 100644 --- a/deploy/cpp_infer/CMakeLists.txt +++ b/deploy/cpp_infer/CMakeLists.txt @@ -1,4 +1,5 @@ project(ppocr CXX C) +cmake_minimum_required(VERSION 3.14) option(WITH_MKL "Compile demo with MKL/OpenBlas support, default use MKL." ON) option(WITH_GPU "Compile demo with GPU/CPU, default use CPU." OFF) @@ -206,13 +207,12 @@ endif() set(DEPS ${DEPS} ${OpenCV_LIBS}) -include(ExternalProject) +include(FetchContent) include(external-cmake/auto-log.cmake) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/autolog/src/extern_Autolog/auto_log) +include_directories(${FETCHCONTENT_BASE_DIR}/extern_autolog-src) AUX_SOURCE_DIRECTORY(./src SRCS) add_executable(${DEMO_NAME} ${SRCS}) - target_link_libraries(${DEMO_NAME} ${DEPS}) if (WIN32 AND WITH_MKL) diff --git a/deploy/cpp_infer/external-cmake/auto-log.cmake b/deploy/cpp_infer/external-cmake/auto-log.cmake index dfa56188..becbff0f 100644 --- a/deploy/cpp_infer/external-cmake/auto-log.cmake +++ b/deploy/cpp_infer/external-cmake/auto-log.cmake @@ -1,14 +1,13 @@ find_package(Git REQUIRED) -message("${CMAKE_BUILD_TYPE}") +include(FetchContent) -set(AUTOLOG_REPOSITORY https://github.com/LDOUBLEV/AutoLog.git) -SET(AUTOLOG_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install/Autolog) +set(FETCHCONTENT_BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}/third-party") -ExternalProject_Add( - extern_Autolog - PREFIX autolog - GIT_REPOSITORY ${AUTOLOG_REPOSITORY} - GIT_TAG main - DOWNLOAD_NO_EXTRACT True - INSTALL_COMMAND cmake -E echo "Skipping install step." +FetchContent_Declare( + extern_Autolog + PREFIX autolog + GIT_REPOSITORY https://github.com/LDOUBLEV/AutoLog.git + GIT_TAG main ) +FetchContent_MakeAvailable(extern_Autolog) + diff --git a/deploy/cpp_infer/src/main.cpp b/deploy/cpp_infer/src/main.cpp index 382be797..6e8ded7f 100644 --- a/deploy/cpp_infer/src/main.cpp +++ b/deploy/cpp_infer/src/main.cpp @@ -35,6 +35,7 @@ #include #include +#include "auto_log/autolog.h" DEFINE_bool(use_gpu, false, "Infering with GPU or CPU."); DEFINE_int32(gpu_id, 0, "Device id of GPU to execute."); -- GitLab