diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bef272f..e951beb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,10 @@ if ( NOT DEFINED WITH_BINDING_PYTHON ) SET(WITH_BINDING_PYTHON ON) ENDIF() +if ( NOT DEFINED WITH_BINDING_GO ) + SET(WITH_BINDING_GO ON) +ENDIF() + if ( NOT DEFINED WITH_UTILITIES ) SET(WITH_UTILITIES ON) ENDIF() @@ -175,6 +179,12 @@ if (WITH_BINDING_PYTHON) add_subdirectory(bindings/python) 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) 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) diff --git a/src/bindings/go/CMakeLists.txt b/src/bindings/go/CMakeLists.txt new file mode 100644 index 0000000..ae14c5c --- /dev/null +++ b/src/bindings/go/CMakeLists.txt @@ -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) diff --git a/src/bindings/go/openalpr/openalpr.go b/src/bindings/go/openalpr/openalpr.go index b737630..5adf8fb 100644 --- a/src/bindings/go/openalpr/openalpr.go +++ b/src/bindings/go/openalpr/openalpr.go @@ -1,8 +1,7 @@ package openalpr /* -#cgo CFLAGS: -I${SRCDIR}/.. -#cgo LDFLAGS: -L${SRCDIR}/.. -lopenalprgo +#cgo pkg-config: openalpr #include #include */ diff --git a/src/cmake_modules/templates/openalpr.pc.in b/src/cmake_modules/templates/openalpr.pc.in new file mode 100644 index 0000000..0c4742a --- /dev/null +++ b/src/cmake_modules/templates/openalpr.pc.in @@ -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}