From 22a8e3dc1eca791155234d0c6ed5027ad066c1dd Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 8 May 2014 09:58:01 -0500 Subject: [PATCH 1/2] Updated Linux compilation to link to OpenCV dynamically --- src/CMakeLists.txt | 2 +- src/openalpr/CMakeLists.txt | 4 ++-- src/openalpr/support/CMakeLists.txt | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c50a72f..39ccb77 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,7 @@ ADD_EXECUTABLE( alpr main.cpp ) TARGET_LINK_LIBRARIES(alpr - openalpr-static + openalpr support ${OpenCV_LIBS} ${Tesseract_LIBS} diff --git a/src/openalpr/CMakeLists.txt b/src/openalpr/CMakeLists.txt index 2b5f0c7..f76741a 100644 --- a/src/openalpr/CMakeLists.txt +++ b/src/openalpr/CMakeLists.txt @@ -35,12 +35,12 @@ add_subdirectory(support) add_library(openalpr-static STATIC ${lpr_source_files} ) add_library(openalpr SHARED ${lpr_source_files} ) -IF (WIN32) + TARGET_LINK_LIBRARIES(openalpr support ${OpenCV_LIBS} ${Tesseract_LIBS} ) -ENDIF() + # Add definition for default runtime dir add_definitions(-DDEFAULT_RUNTIME_DIR="${CMAKE_SOURCE_DIR}/../runtime_data/") \ No newline at end of file diff --git a/src/openalpr/support/CMakeLists.txt b/src/openalpr/support/CMakeLists.txt index 4cfbd6f..5516c67 100644 --- a/src/openalpr/support/CMakeLists.txt +++ b/src/openalpr/support/CMakeLists.txt @@ -5,5 +5,6 @@ set(support_source_files timing.cpp ) +add_library(support STATIC ${support_source_files}) -add_library(support ${support_source_files}) +SET_TARGET_PROPERTIES( support PROPERTIES COMPILE_FLAGS -fPIC) \ No newline at end of file From 8585797eceee2f4cc2262af4c42887ccb0edade0 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 8 May 2014 18:06:31 -0500 Subject: [PATCH 2/2] Moved version num to cmake, so it is available both at build and runtime --- src/CMakeLists.txt | 11 +++++++++++ src/openalpr/constants.h | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39ccb77..29d7760 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,17 @@ project(src) cmake_minimum_required (VERSION 2.6) +# Set the OpenALPR version in cmake, and also add it as a DEFINE for the code to access +SET(OPENALPR_MAJOR_VERSION "1") +SET(OPENALPR_MINOR_VERSION "1") +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(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../libraries/opencv/") SET(Tesseract_DIR "${CMAKE_SOURCE_DIR}/../libraries/tesseract-ocr") diff --git a/src/openalpr/constants.h b/src/openalpr/constants.h index 497dbd8..0cf137f 100644 --- a/src/openalpr/constants.h +++ b/src/openalpr/constants.h @@ -20,9 +20,6 @@ #define OPENALPR_CONSTANTS_H -#define OPENALPR_MAJOR_VERSION 1 -#define OPENALPR_MINOR_VERSION 1 -#define OPENALPR_PATCH_VERSION 0 #define CONFIG_FILE "/openalpr.conf" #define KEYPOINTS_DIR "/keypoints"