From e416629e1766a84be02858c8f825f36e955d7506 Mon Sep 17 00:00:00 2001 From: Kaartic Sivaraam Date: Wed, 22 Aug 2018 14:31:06 +0530 Subject: [PATCH 1/6] lib: make the build file of lib completely independent This would help with re-using the library in other projects easily. This adds uninstall support to the library independent of the main project. This could help with uninstalling the library separately. Further the cmake version is specified to avoid an unnecessary warning. --- lib/CMakeLists.txt | 14 ++++++++++++++ lib/cmake_uninstall.cmake.in | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 lib/cmake_uninstall.cmake.in diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 0ab5b52..8cb5048 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required (VERSION 3.0) + set (V4L2_HELPER_LIB_VERSION_MAJOR 0) set (V4L2_HELPER_LIB_VERSION_MINOR 1) set (V4L2_HELPER_LIB_VERSION_PATCH 0) @@ -22,3 +24,15 @@ set_target_properties ( ) install (TARGETS v4l2_helper LIBRARY DESTINATION ${V4L2_HELPER_LIB_INSTALL_PATH}) install (FILES ${V4L2_HELPER_LIB_INCLUDE_DIR}/v4l2_helper.h DESTINATION ${V4L2_HELPER_HEADER_INSTALL_PATH}) + +# uninstall target +# Ref: https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() diff --git a/lib/cmake_uninstall.cmake.in b/lib/cmake_uninstall.cmake.in new file mode 100644 index 0000000..26b8439 --- /dev/null +++ b/lib/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_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) + From b5bfa6df1a511e89a87842d4c6fcb12b036fd569 Mon Sep 17 00:00:00 2001 From: Kaartic Sivaraam Date: Wed, 22 Aug 2018 15:26:19 +0530 Subject: [PATCH 2/6] Add README for library --- lib/README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/README.md diff --git a/lib/README.md b/lib/README.md new file mode 100644 index 0000000..fbd160d --- /dev/null +++ b/lib/README.md @@ -0,0 +1,33 @@ + +[//]: # +[//]: # "v4l2_helper - README.md file for library" +[//]: # +[//]: # "Copyright (c) 2017-2018, e-con Systems India Pvt. Ltd. All rights reserved." +[//]: # + +## V4L2 Helper + +A light-weight V4L2 helper library which abstracts away the +process of fetching frames from a device that supports V4L2. +This library exposes some APIs which could be used to: + + * initialise the V4L2 device + * read a frame from the V4L2 device + * de-initialise the V4L2 device + +#### Building +To build and install the library + +``` +mkdir build && cd build +cmake .. +make +sudo make install +``` + +#### Disclaimer +1. The library maintains some global state across different + functions. So, it is not suitable for accessing multiple + cameras simultaneously. Pull requests are welcome! + +2. This is not a replacement to lib-v4l From 613c4138c2fe8a3f65de70f4ddfac407c6f93478 Mon Sep 17 00:00:00 2001 From: dilipkumar25 Date: Wed, 22 Aug 2018 17:16:43 +0530 Subject: [PATCH 3/6] updated disclaimer --- lib/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/README.md b/lib/README.md index fbd160d..e00260e 100644 --- a/lib/README.md +++ b/lib/README.md @@ -26,8 +26,14 @@ sudo make install ``` #### Disclaimer +1. This library is provided for the ease of use for developers. + Anyone with a github account is welcome to contribute to it. + Please check the [CONTRIBUTING.md](../CONTRIBUTING.md) file to know more. + +2. This is not a replacement to lib-v4l + +#### TODO + 1. The library maintains some global state across different functions. So, it is not suitable for accessing multiple - cameras simultaneously. Pull requests are welcome! - -2. This is not a replacement to lib-v4l + cameras simultaneously. From ab7084c6603363ca1fadb6b2f9d9da205b6d5c26 Mon Sep 17 00:00:00 2001 From: dilipkumar25 Date: Wed, 22 Aug 2018 17:52:24 +0530 Subject: [PATCH 4/6] Update README.md --- lib/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/README.md b/lib/README.md index e00260e..12e281c 100644 --- a/lib/README.md +++ b/lib/README.md @@ -16,7 +16,7 @@ This library exposes some APIs which could be used to: * de-initialise the V4L2 device #### Building -To build and install the library +To build and install the library separately ``` mkdir build && cd build From 30989cd4d4e0d8a4dc26b39d423e804bce3dca8d Mon Sep 17 00:00:00 2001 From: dilipkumar25 Date: Wed, 22 Aug 2018 18:27:24 +0530 Subject: [PATCH 5/6] Updated contributing instructions --- CONTRIBUTING.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb0a62f..7279f92 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ waiver with respect to the entirety of your contributions. ## How do I make a contribution? Never made an open source contribution before? Wondering how contributions work -in the in our project? Here's a quick rundown! +in our project? Here's a quick rundown! 1. Find an issue that you are interested in addressing or a feature that you would like to add. @@ -49,9 +49,17 @@ in the in our project? Here's a quick rundown! 13. Make changes to the pull request if the reviewing maintainer recommends them. 14. Celebrate your success after your pull request is merged! -## Where can I go for help? +## Can I contribute without coding? -If you need help, you can ask questions directly in our chat support channel available -on our website : . You can also send in your queries via email to - +Sure. You are welcome to use and test the provided applications and library on your +device. If you face any issues, you can report them in the [opencv_v4l2 issues page][1]. +Make sure to provide as much information as possible. You can use [this link][2] to create +a bug report. +Or if you think this project can be improved upon by adding a new feature, you can create +a feature request in the issues page using [this link][3]. + + +[1]:https://github.com/econsystems/opencv_v4l2/issues +[2]:https://github.com/econsystems/opencv_v4l2/issues/new?template=bug_report.md +[3]:https://github.com/econsystems/opencv_v4l2/issues/new?template=feature_request.md From 42b96d8423f0333ec684947cb6cd5ab2e524381f Mon Sep 17 00:00:00 2001 From: dilipkumar25 Date: Wed, 22 Aug 2018 18:30:12 +0530 Subject: [PATCH 6/6] Added disclaimer --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b0887cb..8788f3e 100644 --- a/README.md +++ b/README.md @@ -91,3 +91,8 @@ The above commands would generate multiple binaries with different characteristi 9. `opencv-buildinfo`: Sample application that prints the build information of the OpenCV library being used. This application can be used to verify that the options selected during compilation were really enabled. + +#### Disclaimer +1. This project is provided for the ease of use for developers. + **Anyone who uses this code and has a github account is welcome to + contribute to it.** Please check the [CONTRIBUTING.md](CONTRIBUTING.md) file to know more.