Skip to content

Commit

Permalink
Merge pull request #19 from IntelRealSense/master
Browse files Browse the repository at this point in the history
Merge master from librealsense to abernste
  • Loading branch information
abernste authored Aug 15, 2018
2 parents 5cc39f1 + 4fff4ea commit 793b89e
Show file tree
Hide file tree
Showing 27 changed files with 6,309 additions and 1,011 deletions.
183 changes: 148 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ endmacro()
option(BUILD_WITH_CUDA "Enable CUDA" OFF)

if(BUILD_WITH_CUDA)
info("Building with CUDA requires CMake v3.8+")
cmake_minimum_required(VERSION 3.8.0)
info("Building with CUDA requires CMake v3.8+")
cmake_minimum_required(VERSION 3.8.0)
project(librealsense2 LANGUAGES CXX C CUDA)
else()
project(librealsense2 LANGUAGES CXX C)
Expand Down Expand Up @@ -180,11 +180,6 @@ set(REALSENSE_CPP
src/ds5/ds5-color.cpp
src/ds5/ds5-active.cpp
src/ds5/ds5-factory.cpp
src/win/win-helpers.cpp
src/win/win-uvc.cpp
src/win/win-usb.cpp
src/win/win-hid.cpp
src/win/win-backend.cpp

src/l500/l500.cpp
src/l500/l500-private.cpp
Expand All @@ -204,6 +199,42 @@ set(REALSENSE_CPP
src/media/playback/playback_sensor.cpp
)

## Check for Windows Version ##
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
set(DRIVERS inteld415_win7.cat
IntelD415_win7.inf
WdfCoinstaller01011.dll
winusbcoinstaller2.dll
)

foreach(item IN LISTS DRIVERS)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${item}"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/d415_driver/${item}" "${CMAKE_CURRENT_BINARY_DIR}/${item}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${item}"
)
endforeach()
endif()
add_custom_target(realsense-driver ALL DEPENDS ${DRIVERS})

list(APPEND REALSENSE_CPP
src/win7/win7-helpers.cpp
src/win7/win7-uvc.cpp
src/win7/win7-usb.cpp
src/win7/win7-hid.cpp
src/win7/win7-backend.cpp
)
else() # Some other windows version
list(APPEND REALSENSE_CPP
src/win/win-helpers.cpp
src/win/win-uvc.cpp
src/win/win-usb.cpp
src/win/win-hid.cpp
src/win/win-backend.cpp
)
endif()

if (BUILD_WITH_CUDA)
set(REALSENSE_CU
src/cuda/cuda-conversion.cu
Expand Down Expand Up @@ -307,11 +338,6 @@ set(REALSENSE_HPP
src/ds5/ds5-color.h
src/linux/backend-v4l2.h
src/linux/backend-hid.h
src/win/win-helpers.h
src/win/win-uvc.h
src/win/win-usb.h
src/win/win-hid.h
src/win/win-backend.h
src/api.h
src/core/serialization.h

Expand All @@ -335,6 +361,25 @@ set(REALSENSE_HPP
src/media/ros/ros_file_format.h
)

## Check for Windows Version ##
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
list(APPEND REALSENSE_HPP
src/win7/win7-helpers.h
src/win7/win7-uvc.h
src/win7/win7-usb.h
src/win7/win7-hid.h
src/win7/win7-backend.h
)
else() # Some other windows version
list(APPEND REALSENSE_HPP
src/win/win-helpers.h
src/win/win-uvc.h
src/win/win-usb.h
src/win/win-hid.h
src/win/win-backend.h
)
endif()

if(BUILD_EASYLOGGINGPP)
list(APPEND REALSENSE_CPP third-party/easyloggingpp/src/easylogging++.cc)
list(APPEND REALSENSE_HPP third-party/easyloggingpp/src/easylogging++.h)
Expand All @@ -343,16 +388,56 @@ endif()
option(BUILD_WITH_STATIC_CRT "Build with static link CRT" ON)

if(WIN32)
source_group("Source Files\\Backend" FILES
src/win/win-helpers.cpp
src/win/win-uvc.cpp
src/win/win-usb.cpp
src/win/win-hid.cpp
src/win/win-backend.cpp
src/linux/backend-v4l2.cpp
src/linux/backend-hid.cpp
src/backend.cpp
)
## Check for Windows Version ##
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
source_group("Source Files\\Backend" FILES
src/win7/win7-helpers.cpp
src/win7/win7-uvc.cpp
src/win7/win7-usb.cpp
src/win7/win7-hid.cpp
src/win7/win7-backend.cpp
src/linux/backend-v4l2.cpp
src/linux/backend-hid.cpp
src/backend.cpp
)

source_group("Header Files\\Backend" FILES
src/win7/win7-helpers.h
src/win7/win7-uvc.h
src/win7/win7-usb.h
src/win7/win7-hid.h
src/win7/win7-backend.h
src/linux/backend-v4l2.h
src/linux/backend-hid.h
src/backend.h)

else() # Some other windows version
source_group("Source Files\\Backend" FILES
src/win/win-helpers.cpp
src/win/win-uvc.cpp
src/win/win-usb.cpp
src/win/win-hid.cpp
src/win/win-backend.cpp
src/linux/backend-v4l2.cpp
src/linux/backend-hid.cpp
src/backend.cpp
src/win7/win7-helpers.cpp
src/win7/win7-uvc.cpp
src/win7/win7-usb.cpp
src/win7/win7-hid.cpp
src/win7/win7-backend.cpp
)

source_group("Header Files\\Backend" FILES
src/win/win-helpers.h
src/win/win-uvc.h
src/win/win-usb.h
src/win/win-hid.h
src/win/win-backend.h
src/linux/backend-v4l2.h
src/linux/backend-hid.h
src/backend.h)
endif()

source_group("Source Files\\Logging" FILES
third-party/easyloggingpp/src/easylogging++.cc
Expand All @@ -366,16 +451,6 @@ if(WIN32)
src/media/playback/playback_sensor.cpp
)

source_group("Header Files\\Backend" FILES
src/win/win-helpers.h
src/win/win-uvc.h
src/win/win-usb.h
src/win/win-hid.h
src/win/win-backend.h
src/linux/backend-v4l2.h
src/linux/backend-hid.h
src/backend.h)

source_group("Header Files\\API" FILES
include/librealsense2/rs.hpp
include/librealsense2/rs.h
Expand Down Expand Up @@ -550,9 +625,16 @@ else()
endif()

option(FORCE_LIBUVC "Explicitly turn-on libuvc backend" OFF)
option(FORCE_WINUSB_UVC "Explicitly turn-on winusb_uvc (for win7) backend" OFF)

if(WIN32)
set(BACKEND RS2_USE_WMF_BACKEND)
## Check for Windows Version ##
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
set(FORCE_WINUSB_UVC ON)
else() # Some other windows version
set(BACKEND RS2_USE_WMF_BACKEND)
endif()

set(REALSENSE_DEF CMake/realsense.def)
# Makes VS15 find the DLL when trying to run examples/tests
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
Expand All @@ -561,14 +643,39 @@ if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
add_definitions(-D__SSSE3__ -D_CRT_SECURE_NO_WARNINGS)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
elseif(APPLE)
set(FORCE_LIBUVC ON)
else()
set(BACKEND RS2_USE_V4L2_BACKEND)
endif()


if(FORCE_WINUSB_UVC)
set(BACKEND RS2_USE_WINUSB_UVC_BACKEND)
#
list(APPEND REALSENSE_CPP
src/win7/winusb_uvc/winusb_uvc.cpp
)
#
list(APPEND REALSENSE_HPP
src/libuvc/utlist.h
src/win7/winusb_uvc/winusb_uvc.h
)
#
source_group("Source Files\\WinUsbUvc" FILES
src/win7/winusb_uvc/winusb_uvc.cpp
)
#
source_group("Header Files\\WinUsbUvc" FILES
src/libuvc/utlist.h
src/win7/winusb_uvc/winusb_uvc.h
)
#
# message( WARNING "Using winusb_uvc!" )
endif()


if(FORCE_LIBUVC)
set(BACKEND RS2_USE_LIBUVC_BACKEND)

Expand Down Expand Up @@ -802,6 +909,12 @@ target_include_directories(realsense2 PRIVATE
${BOOST_INCLUDE_PATH}
${LZ4_INCLUDE_PATH}
)
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
add_dependencies(realsense2 realsense-driver)
set_target_properties (realsense-driver PROPERTIES
FOLDER Library
)
endif()

if (USE_SYSTEM_LIBUSB)
target_include_directories(realsense2 PRIVATE ${LIBUSB1_INCLUDE_DIRS})
Expand Down Expand Up @@ -930,4 +1043,4 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" DESTINATION
# Update system cache with newly installed binaries/libraries
if(UNIX)
install(CODE "execute_process(COMMAND ldconfig)")
endif()
endif()
10 changes: 6 additions & 4 deletions src/backend.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.

#if defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND)
#if defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND)
// UVC support will be provided via libuvc / libusb backend
#elif !defined(RS2_USE_LIBUVC_BACKEND) && defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND)
#elif !defined(RS2_USE_LIBUVC_BACKEND) && defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND)
// UVC support will be provided via Windows Media Foundation / WinUSB backend
#elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && defined(RS2_USE_V4L2_BACKEND)
#elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && defined(RS2_USE_WINUSB_UVC_BACKEND)
// UVC support will be provided via WinUSB / WinUSB backend
#elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND)
// UVC support will be provided via Video 4 Linux 2 / libusb backend
#else
#error No UVC backend selected. Please #define exactly one of RS2_USE_LIBUVC_BACKEND, RS2_USE_WMF_BACKEND, or RS2_USE_V4L2_BACKEND
#error No UVC backend selected. Please #define exactly one of RS2_USE_LIBUVC_BACKEND, RS2_USE_WMF_BACKEND, RS2_USE_WINUSB_UVC_BACKEND or RS2_USE_V4L2_BACKEND
#endif

#include "backend.h"
Expand Down
2 changes: 2 additions & 0 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,8 @@ namespace librealsense
int size = 0;

public:
static const int CAPACITY = C;

small_heap()
{
for (auto i = 0; i < C; i++)
Expand Down
Binary file added src/win7/d415_driver/IntelD415_win7.inf
Binary file not shown.
Binary file added src/win7/d415_driver/WdfCoinstaller01011.dll
Binary file not shown.
Binary file added src/win7/d415_driver/winusbcoinstaller2.dll
Binary file not shown.
Loading

0 comments on commit 793b89e

Please sign in to comment.