Skip to content

Commit

Permalink
Release 0.38.0 (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabime authored Aug 7, 2024
1 parent 01f9558 commit 103b047
Show file tree
Hide file tree
Showing 73 changed files with 12,195 additions and 921 deletions.
80 changes: 40 additions & 40 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
---
BasedOnStyle: Microsoft
AccessModifierOffset: '-4'
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'false'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakAfterJavaFieldAnnotations: 'true'
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakAfterJavaFieldAnnotations: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
ColumnLimit: '120'
CompactNamespaces: 'true'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
ExperimentalAutoDetectBinPacking: 'false'
FixNamespaceComments: 'true'
ColumnLimit: 120
CompactNamespaces: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Regroup
KeepEmptyLinesAtTheStartOfBlocks: 'false'
MaxEmptyLinesToKeep: '2'
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PointerAlignment: Left
SortIncludes: 'false'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'true'
SortIncludes: Never
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never
IndentWidth: 4

Expand Down
236 changes: 236 additions & 0 deletions 3rdparty/libuvc-0.0.7-custom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
cmake_minimum_required(VERSION 3.1)
project(libuvc
VERSION 0.0.7
LANGUAGES C
)

# Additional search scripts path for libusb-1.0, libjpeg, OpenCV
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

# Xcode and Visual Studio do not using CMAKE_BUILD_TYPE cache variable
# so we use Release build type only with single configuration generators.
if (NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()

if(NOT CMAKE_BUILD_TARGET)
message(STATUS "No target type selected, default to both shared and static library")
set(CMAKE_BUILD_TARGET "Both" CACHE STRING "" FORCE)
endif()

option(BUILD_EXAMPLE "Build example program" OFF) # RSID_W10 - ON -> OFF
option(BUILD_TEST "Build test program" OFF)
option(ENABLE_UVC_DEBUGGING "Enable UVC debugging" OFF)

set(libuvc_DESCRIPTION "A cross-platform library for USB video devices")
set(libuvc_URL "https://github.com/libuvc/libuvc")

set(SOURCES
src/ctrl.c
src/ctrl-gen.c
src/device.c
src/diag.c
src/frame.c
src/init.c
src/stream.c
src/misc.c
)

find_package(LibUSB)

# JpegPkg name to differ from shipped with CMake

# RSID_W10: No JPEG required
#find_package(JpegPkg QUIET)
#if(JPEG_FOUND)
# message(STATUS "Building libuvc with JPEG support.")
# set(LIBUVC_HAS_JPEG TRUE)
# list(APPEND SOURCES src/frame-mjpeg.c)
#else()
# message(WARNING "JPEG not found. libuvc will not support JPEG decoding.")
#endif()

if(UNIX AND NOT APPLE)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
set(threads Threads::Threads)
endif()

# RSID_W10: Only build static
set(BUILD_UVC_SHARED FALSE)
set(BUILD_UVC_STATIC TRUE)
set(LibUVC_STATIC TRUE)
#if(${CMAKE_BUILD_TARGET} MATCHES "Shared")
# set(BUILD_UVC_SHARED TRUE)
#elseif(${CMAKE_BUILD_TARGET} MATCHES "Static")
# set(BUILD_UVC_STATIC TRUE)
#elseif(${CMAKE_BUILD_TARGET} MATCHES "Both")
# set(BUILD_UVC_SHARED TRUE)
# set(BUILD_UVC_STATIC TRUE)
#else()
# message(FATAL_ERROR "Invalid build type ${CMAKE_BUILD_TARGET}" )
#endif()

if(BUILD_UVC_SHARED)
add_library(uvc SHARED ${SOURCES})
set_target_properties(uvc PROPERTIES
VERSION ${libuvc_VERSION}
SOVERSION ${libuvc_VERSION_MAJOR}
# Exported name of target within namespace LibUVC
EXPORT_NAME UVCShared
)
list(APPEND UVC_TARGETS uvc)
if(NOT LibUVC_STATIC)
add_library(LibUVC::UVC ALIAS uvc)
endif()
# Aliases defined here available only if project included
# via addsubdirectory
add_library(LibUVC::UVCShared ALIAS uvc)
endif()

if(BUILD_UVC_STATIC)
add_library(uvc_static STATIC ${SOURCES})
set_target_properties(uvc_static PROPERTIES
OUTPUT_NAME uvc
# Exported name of target within namespace LibUVC
EXPORT_NAME UVCStatic
)
list(APPEND UVC_TARGETS uvc_static)
add_library(LibUVC::UVCStatic ALIAS uvc_static)
if(LibUVC_STATIC)
add_library(LibUVC::UVC ALIAS uvc_static)
endif()
endif()

configure_file(include/libuvc/libuvc_config.h.in
include/libuvc/libuvc_config.h
@ONLY
)

foreach(target_name IN LISTS UVC_TARGETS)
target_include_directories(${target_name}
PUBLIC
# Different paths for includes for build and install phase supported
# via INSTALL_INTERFACE and BUILD_INTERFACE generator expressions.
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(${target_name}
# libusb-1.0 used internally so we link to it privately.
PRIVATE LibUSB::LibUSB ${threads}
)
if(JPEG_FOUND)
target_link_libraries(${target_name}
PRIVATE JPEG::JPEG
)
endif()
set_target_properties(${target_name} PROPERTIES
PUBLIC_HEADER "include/libuvc/libuvc.h;${CMAKE_CURRENT_BINARY_DIR}/include/libuvc/libuvc_config.h"
)
if(ENABLE_UVC_DEBUGGING)
target_compile_definitions(${target_name}
PRIVATE
UVC_DEBUGGING
)
find_library(
log-lib
log
)
target_link_libraries(
${target_name}
PRIVATE
${log-lib}
)
endif()
endforeach()

if(BUILD_EXAMPLE)
add_executable(example src/example.c)
find_package(Threads)
target_link_libraries(example
PRIVATE
LibUVC::UVC
Threads::Threads
)
endif()

if(BUILD_TEST)
# OpenCV defines targets with transitive dependencies not with namespaces but using opencv_ prefix.
# This targets provide necessary include directories and linked flags.
find_package(OpenCVPkg REQUIRED
COMPONENTS
opencv_core
opencv_highgui
)

add_executable(uvc_test src/test.c)
target_link_libraries(uvc_test
PRIVATE
LibUVC::UVC
opencv_core
opencv_highgui
)
endif()


include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/libuvc)

install(
TARGETS ${UVC_TARGETS}
EXPORT libuvcTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libuvc
)

install(EXPORT libuvcTargets
FILE libuvcTargets.cmake
NAMESPACE LibUVC::
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)

install(FILES
cmake/FindLibUSB.cmake
cmake/FindJpegPkg.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(libuvcConfigVersion.cmake
COMPATIBILITY AnyNewerVersion
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libuvcConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)

if(JPEG_FOUND)
# If we have used JPEG library we need to
# add linker flag for it in config file for pkgconfig
set(PKGCONFIG_JPEG_LDFLAG "-ljpeg")
endif()

configure_file(libuvc.pc.in
${PROJECT_BINARY_DIR}/libuvc.pc
@ONLY
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libuvc.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

install(FILES libuvcConfig.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)


31 changes: 31 additions & 0 deletions 3rdparty/libuvc-0.0.7-custom/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Software License Agreement (BSD License)

Copyright (C) 2010-2015 Ken Tossell
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the author nor other contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 103b047

Please sign in to comment.