mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 01:27:03 +08:00
add pkg-config and use it in cgo - WitzHsiao
This commit is contained in:
@@ -43,6 +43,10 @@ if ( NOT DEFINED WITH_BINDING_PYTHON )
|
|||||||
SET(WITH_BINDING_PYTHON ON)
|
SET(WITH_BINDING_PYTHON ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
if ( NOT DEFINED WITH_BINDING_GO )
|
||||||
|
SET(WITH_BINDING_GO ON)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
if ( NOT DEFINED WITH_UTILITIES )
|
if ( NOT DEFINED WITH_UTILITIES )
|
||||||
SET(WITH_UTILITIES ON)
|
SET(WITH_UTILITIES ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -175,6 +179,12 @@ if (WITH_BINDING_PYTHON)
|
|||||||
add_subdirectory(bindings/python)
|
add_subdirectory(bindings/python)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
if (WITH_BINDING_GO)
|
||||||
|
set(OPENALPR_LIB_GO openalprgo)
|
||||||
|
set(TAG_OPENALPR_LIB_GO "-l${OPENALPR_LIB_GO}")
|
||||||
|
add_subdirectory(bindings/go)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
if (NOT IOS)
|
if (NOT IOS)
|
||||||
install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/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 ${CMAKE_INSTALL_PREFIX}/share/man/man1 COMPONENT doc)
|
||||||
|
28
src/bindings/go/CMakeLists.txt
Normal file
28
src/bindings/go/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
|
||||||
|
set(go_source_files
|
||||||
|
openalprgo.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(openalprgo SHARED ${go_source_files})
|
||||||
|
|
||||||
|
set_target_properties(openalprgo PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(openalprgo openalpr)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
#generate the .pc file
|
||||||
|
SET(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
SET(exec_prefix "\${prefix}")
|
||||||
|
SET(libdir "\${exec_prefix}/lib")
|
||||||
|
SET(includedir "\${exec_prefix}/include")
|
||||||
|
SET(VERSION "${OPENALPR_VERSION}")
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
"${CMAKE_MODULE_PATH}/templates/openalpr.pc.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/openalpr.pc"
|
||||||
|
@ONLY)
|
||||||
|
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/openalpr.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
install (TARGETS openalprgo DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
install (FILES openalprgo.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
@@ -1,8 +1,7 @@
|
|||||||
package openalpr
|
package openalpr
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -I${SRCDIR}/..
|
#cgo pkg-config: openalpr
|
||||||
#cgo LDFLAGS: -L${SRCDIR}/.. -lopenalprgo
|
|
||||||
#include <openalprgo.h>
|
#include <openalprgo.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
*/
|
*/
|
||||||
|
10
src/cmake_modules/templates/openalpr.pc.in
Normal file
10
src/cmake_modules/templates/openalpr.pc.in
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: OpenALPR
|
||||||
|
Description: Open source Automatic License Plate Recognition library
|
||||||
|
Version: @VERSION@
|
||||||
|
Libs: -L${libdir} -lopenalpr @TAG_OPENALPR_LIB_GO@
|
||||||
|
Cflags: -I${includedir}
|
Reference in New Issue
Block a user