Created
January 6, 2015 18:35
-
-
Save masroore/4935908dc914d7b38e1f to your computer and use it in GitHub Desktop.
OpenALPR-net cmake files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - Try to find Tesseract-OCR | |
# Once done, this will define | |
# | |
# Tesseract_FOUND - system has Tesseract | |
# Tesseract_INCLUDE_DIRS - the Tesseract include directories | |
# Tesseract_LIBRARIES - link these to use Tesseract | |
include(LibFindMacros) | |
# Use pkg-config to get hints about paths | |
#libfind_pkg_check_modules(Tesseract_PKGCONF Tesseract) | |
# Include dir | |
find_path(Tesseract_INCLUDE_BASEAPI_DIR | |
NAMES tesseract/baseapi.h | |
HINTS "/usr/include" | |
"/usr/include/tesseract" | |
"/usr/local/include" | |
"/usr/local/include/tesseract" | |
${Tesseract_PKGCONF_INCLUDE_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/api/ | |
) | |
find_path(Tesseract_INCLUDE_CCSTRUCT_DIR | |
NAMES publictypes.h | |
HINTS "/usr/include" | |
"/usr/include/tesseract" | |
"/usr/local/include" | |
"/usr/local/include/tesseract" | |
${Tesseract_PKGCONF_INCLUDE_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/ccstruct/ | |
) | |
find_path(Tesseract_INCLUDE_CCMAIN_DIR | |
NAMES thresholder.h | |
HINTS "/usr/include" | |
"/usr/include/tesseract" | |
"/usr/local/include" | |
"/usr/local/include/tesseract" | |
${Tesseract_PKGCONF_INCLUDE_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/ccmain/ | |
) | |
find_path(Tesseract_INCLUDE_CCUTIL_DIR | |
NAMES platform.h | |
HINTS "/usr/include" | |
"/usr/include/tesseract" | |
"/usr/local/include" | |
"/usr/local/include/tesseract" | |
${Tesseract_PKGCONF_INCLUDE_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/ccutil/ | |
) | |
# Finally the library itself | |
find_library(Tesseract_LIB | |
NAMES tesseract tesseract-static libtesseract303-static | |
HINTS "/usr/lib" | |
"/usr/local/lib" | |
${Tesseract_PKGCONF_LIBRARY_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/api/.libs | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/vs2010/LIB_Release | |
) | |
find_library(Leptonica_LIB | |
NAMES liblept170 liblept lept | |
HINTS "/usr/lib" | |
"/usr/local/lib" | |
${Tesseract_PKGCONF_LIBRARY_DIRS} | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/api/.libs | |
${CMAKE_SOURCE_DIR}/../../../libraries/tesseract-ocr/vs2010/LIB_Release | |
) | |
# Set the include dir variables and the libraries and let libfind_process do the rest. | |
# NOTE: Singular variables for this library, plural for libraries this this lib depends on. | |
set(Tesseract_PROCESS_INCLUDES | |
Tesseract_INCLUDE_BASEAPI_DIR | |
Tesseract_INCLUDE_CCSTRUCT_DIR | |
Tesseract_INCLUDE_CCMAIN_DIR | |
Tesseract_INCLUDE_CCUTIL_DIR | |
Tesseract_INCLUDE_DIRS) | |
set(Tesseract_PROCESS_LIBS Tesseract_LIB Leptonica_LIB Tesseract_LIBRARIES) | |
libfind_process(Tesseract) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT(openalpr-net) | |
SET(PROJECT_NAME "openalpr-net") | |
#set(CMAKE_BUILD_TYPE Debug) | |
CMAKE_MINIMUM_REQUIRED (VERSION 2.8) | |
# Set the OpenALPR version in cmake, and also add it as a DEFINE for the code to access | |
SET(OPENALPR_MAJOR_VERSION "2") | |
SET(OPENALPR_MINOR_VERSION "0") | |
SET(OPENALPR_PATCH_VERSION "0") | |
SET(OPENALPR_VERSION ${OPENALPR_MAJOR_VERSION}.${OPENALPR_MINOR_VERSION}.${OPENALPR_PATCH_VERSION}) | |
ADD_DEFINITIONS( -DOPENALPR_MAJOR_VERSION=${OPENALPR_MAJOR_VERSION}) | |
ADD_DEFINITIONS( -DOPENALPR_MINOR_VERSION=${OPENALPR_MINOR_VERSION}) | |
ADD_DEFINITIONS( -DOPENALPR_PATCH_VERSION=${OPENALPR_PATCH_VERSION}) | |
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") | |
FIND_PACKAGE( Tesseract REQUIRED ) | |
INCLUDE_DIRECTORIES(${Tesseract_INCLUDE_DIRS}) | |
INCLUDE_DIRECTORIES(../../../src/openalpr) | |
# Discover OpenALPR directory automatically | |
FIND_PATH(OpenALPR_DIR | |
NAMES CPackConfig.cmake | |
HINTS ${CMAKE_SOURCE_DIR}/../../../src/) | |
#FIND_LIBRARY(OPENALPR_STATIC NAMES openalpr-static PATHS "${OpenALPR_DIR}openalpr/${CMAKE_BUILD_TYPE}" ) | |
FIND_LIBRARY(OPENALPR_STATIC | |
openalpr-static.lib | |
PATHS ../../../src/openalpr/${CMAKE_CONFIGURATION_TYPES} ) | |
# Discover OpenCV directory automatically | |
FIND_PATH(OpenCV_DIR | |
NAMES OpenCVConfig.cmake | |
HINTS ${CMAKE_SOURCE_DIR}/../../../libraries/opencv/) | |
# Opencv Package | |
FIND_PACKAGE( OpenCV REQUIRED ) | |
IF (${OpenCV_VERSION} VERSION_LESS 2.4.7) | |
MESSAGE(FATAL_ERROR "OpenCV version is not compatible : ${OpenCV_VERSION}") | |
ENDIF() | |
IF (WIN32) | |
add_definitions( -DWINDOWS) | |
add_definitions( -DNOMINMAX) | |
# Extra linker dependencies for Windows | |
SET (Tesseract_LIBRARIES | |
${Tesseract_LIBRARIES} | |
ws2_32.lib | |
) | |
ELSE() | |
SET (Extra_LIBS | |
pthread | |
) | |
ENDIF() | |
SET(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ") | |
SET(alpr_net_source_files | |
openalpr-net.cpp | |
AssemblyInfo.cpp | |
Stdafx.cpp | |
) | |
SET(alpr_net_header_files | |
openalpr-net.h | |
Stdafx.h | |
resource.h | |
) | |
ADD_LIBRARY(openalpr-net SHARED ${alpr_net_source_files} ${alpr_net_header_files} ) | |
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VS_DOTNET_REFERENCES "System;System.Core;System.Drawing") | |
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr /EHa") | |
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d") | |
if(CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1") | |
string(REPLACE "/RTC1" " " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") | |
endif() | |
if(CMAKE_CXX_FLAGS MATCHES "/EHsc") | |
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
endif() | |
TARGET_LINK_LIBRARIES(openalpr-net | |
#openalpr-static | |
${OPENALPR_STATIC} | |
#support | |
#video | |
${OpenCV_LIBS} | |
${Tesseract_LIBRARIES} | |
${Extra_LIBS} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment