Merge pull request #55 from twelve17/master

Update build files to allow creation of a Homebrew formula.
This commit is contained in:
Matthew Hill
2014-10-20 14:40:27 -04:00
4 changed files with 67 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
[common] [common]
; Specify the path to the runtime data directory ; Specify the path to the runtime data directory
runtime_dir = /usr/share/openalpr/runtime_data runtime_dir = ${CMAKE_INSTALL_PREFIX}/share/openalpr/runtime_data
ocr_img_size_percent = 1.33333333 ocr_img_size_percent = 1.33333333

View File

@@ -15,6 +15,19 @@ add_definitions( -DOPENALPR_PATCH_VERSION=${OPENALPR_PATCH_VERSION})
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
# TODO: switch to http://www.cmake.org/cmake/help/v2.8.5/cmake.html#module:GNUInstallDirs ?
IF (NOT CMAKE_INSTALL_SYSCONFDIR)
SET(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
ENDIF()
IF ( NOT DEFINED WITH_DAEMON )
SET(WITH_DAEMON ON)
ENDIF()
IF (WIN32 AND WITH_DAEMON)
MESSAGE(WARNING "Skipping alprd daemon installation, as it is not supported in Windows.")
SET(WITH_DAEMON OFF)
ENDIF()
FIND_PACKAGE( Tesseract REQUIRED ) FIND_PACKAGE( Tesseract REQUIRED )
@@ -64,7 +77,7 @@ TARGET_LINK_LIBRARIES(alpr
) )
# Compile the alprd library on Unix-based OS # Compile the alprd library on Unix-based OS
IF (NOT WIN32) IF (WITH_DAEMON)
ADD_EXECUTABLE( alprd daemon.cpp daemon/beanstalk.c daemon/beanstalk.cc ) ADD_EXECUTABLE( alprd daemon.cpp daemon/beanstalk.c daemon/beanstalk.cc )
TARGET_LINK_LIBRARIES(alprd TARGET_LINK_LIBRARIES(alprd
@@ -89,12 +102,18 @@ add_subdirectory(openalpr)
add_subdirectory(video) add_subdirectory(video)
install (TARGETS alpr DESTINATION /usr/bin) install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install (TARGETS alprd DESTINATION /usr/bin) install (FILES ${CMAKE_SOURCE_DIR}/../doc/man/alpr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 COMPONENT doc)
install (FILES ${CMAKE_SOURCE_DIR}/../doc/man/alpr.1 DESTINATION /usr/share/man/man1 COMPONENT doc) install (DIRECTORY ${CMAKE_SOURCE_DIR}/../runtime_data DESTINATION ${CMAKE_INSTALL_PREFIX}/share/openalpr)
install (DIRECTORY ${CMAKE_SOURCE_DIR}/../runtime_data DESTINATION /usr/share/openalpr/)
install (FILES ${CMAKE_SOURCE_DIR}/../config/openalpr.conf DESTINATION /etc/openalpr/ COMPONENT config) # set runtime_data to reflect the current CMAKE_INSTALL_PREFIX
install (FILES ${CMAKE_SOURCE_DIR}/../config/alprd.conf DESTINATION /etc/openalpr/ COMPONENT config) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/../config/openalpr.conf.in ${CMAKE_CURRENT_BINARY_DIR}/config/openalpr.conf)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/config/openalpr.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/openalpr/ COMPONENT config)
IF (WITH_DAEMON)
install (TARGETS alprd DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install (FILES ${CMAKE_SOURCE_DIR}/../config/alprd.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/openalpr COMPONENT config)
ENDIF()
SET(CPACK_PACKAGE_VERSION ${OPENALPR_VERSION}) SET(CPACK_PACKAGE_VERSION ${OPENALPR_VERSION})
@@ -119,3 +138,14 @@ SET (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${C
SET (CPACK_COMPONENTS_ALL Libraries ApplicationData) SET (CPACK_COMPONENTS_ALL Libraries ApplicationData)
INCLUDE(CPack) INCLUDE(CPack)
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
# ----------------------------------------------------------------------------
CONFIGURE_FILE(
"${CMAKE_MODULE_PATH}/templates/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
ADD_CUSTOM_TARGET(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

View File

@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View File

@@ -1,7 +1,6 @@
set(lpr_source_files set(lpr_source_files
alpr.cpp alpr.cpp
alpr_impl.cpp alpr_impl.cpp
@@ -39,15 +38,15 @@ add_library(openalpr SHARED ${lpr_source_files} )
set_target_properties(openalpr PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION}) set_target_properties(openalpr PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
TARGET_LINK_LIBRARIES(openalpr TARGET_LINK_LIBRARIES(openalpr
support support
${OpenCV_LIBS} ${OpenCV_LIBS}
${Tesseract_LIBRARIES} ${Tesseract_LIBRARIES}
) )
install (FILES alpr.h DESTINATION /usr/include) install (FILES alpr.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install (TARGETS openalpr DESTINATION /usr/lib) install (TARGETS openalpr DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# Add definition for default config file # Add definition for default config file
add_definitions(-DDEFAULT_CONFIG_FILE="/etc/openalpr/openalpr.conf") add_definitions(-DDEFAULT_CONFIG_FILE="${CMAKE_INSTALL_SYSCONFDIR}/openalpr/openalpr.conf")