diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0093143..34468ce1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required (VERSION 3.0.2) project (CCExtractor) option(WITH_FFMPEG "Build using FFmpeg demuxer and decoder" OFF) +option(WITH_OCR "Build with OCR (Optical Character Recognition) feature" OFF) #Version number set (CCEXTRACTOR_VERSION_MAJOR 0) set (CCEXTRACTOR_VERSION_MINOR 75) @@ -48,6 +49,20 @@ set (EXTRA_LIBS ${EXTRA_LIBS} ${AVCODEC_STATIC_LIBRARIES} ) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_FFMPEG") endif (WITH_FFMPEG) +######################################################## +# Build with OCR using leptonica and tesseract libraries +# +if (WITH_OCR) + +find_package(PkgConfig) +pkg_check_modules(TESSERACT REQUIRED tesseract) +pkg_check_modules(LEPTONICA REQUIRED lept) +set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_STATIC_LIBRARIES} ) +set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_STATIC_LIBRARIES} ) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR ${TESSERACT_CFLAGS} ${LEPTONICA_CFLAGS}") + +endif (WITH_OCR) + add_executable(ccextractor ${SOURCEFILE}) target_link_libraries (ccextractor ${EXTRA_LIBS}) diff --git a/src/lib_ccx/CMakeLists.txt b/src/lib_ccx/CMakeLists.txt index 3a36f53f..463e810e 100644 --- a/src/lib_ccx/CMakeLists.txt +++ b/src/lib_ccx/CMakeLists.txt @@ -6,6 +6,15 @@ if (WITH_FFMPEG) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_FFMPEG") endif (WITH_FFMPEG) +if (WITH_OCR) +find_package(PkgConfig) +pkg_check_modules(TESSERACT REQUIRED tesseract) +pkg_check_modules(LEPTONICA REQUIRED lept) +set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_STATIC_LIBRARIES} ) +set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_STATIC_LIBRARIES} ) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR ${TESSERACT_CFLAGS} ${LEPTONICA_CFLAGS}") +endif (WITH_OCR) + AUX_SOURCE_DIRECTORY("${PROJECT_SOURCE_DIR}/lib_ccx/" SOURCEFILE) AUX_SOURCE_DIRECTORY("${PROJECT_SOURCE_DIR}/gpacmp4/" SOURCEFILE) #AUX_SOURCE_DIRECTORY("${PROJECT_SOURCE_DIR}/libpng/" SOURCEFILE)