Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
719QM committed Oct 19, 2024
0 parents commit f7e0bd9
Show file tree
Hide file tree
Showing 3,302 changed files with 905,951 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
* Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

* Consider checking out SDK [examples](https://github.com/IntelRealSense/librealsense/tree/master/examples#sample-code-for-intel-realsense-cameras).
* Have you looked in our [documentations](https://github.com/IntelRealSense/librealsense/tree/master/doc#useful-links)?
* Is you question a [frequently asked one](https://github.com/IntelRealSense/librealsense/wiki/Troubleshooting-Q%26A)?
* Try [searching our GitHub Issues](https://github.com/IntelRealSense/librealsense/issues?utf8=%E2%9C%93&q=is%3Aissue) (open and closed) for a similar issue.

* All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)

----------------------------------------------------------------------------------------------------

| Required Info | |
|---------------------------------|------------------------------------------- |
| Camera Model | { R200 / F200 / SR300 / ZR300 / D400 } |
| Firmware Version | (Open RealSense Viewer --> Click info) |
| Operating System & Version | {Win (8.1/10) / Linux (Ubuntu 14/16/17) / MacOS |
| Kernel Version (Linux Only) | (e.g. 4.14.13) |
| Platform | PC/Raspberry Pi/ NVIDIA Jetson / etc.. |
| SDK Version | { legacy / 2.<?>.<?> } |
| Language | {C/C#/labview/nodejs/opencv/pcl/python/unity } |
| Segment | {Robot/Smartphone/VR/AR/others } |

### Issue Description
<Describe your issue / question / feature request / etc..>
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

/build/
167 changes: 167 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
env:
global:
- LRS_BUILD_CONFIG=Debug
- LRS_RUN_CONFIG=Release
matrix:
include:
- name: "Windows Testing - cpp, Win USB (Win7)"
os: windows
language: cpp
env: VS15=false RS_CPP_TEST=true
script:
# map librealsense folder to overcome windows path too long issue
- pwd
- |
subst d: ../.
- cd d:/build
- cmake .. -G "Visual Studio 15 2017 Win64" -DPYTHON_EXECUTABLE="C:/Python38/python.exe" -DBUILD_PYTHON_BINDINGS=true -DPYBIND11_PYTHON_VERSION=3.8 -DBUILD_UNIT_TESTS=true -DBUILD_EXAMPLES=false -DBUILD_GRAPHICAL_EXAMPLES=false -DBUILD_WITH_TM2=false -DFORCE_RSUSB_BACKEND=true -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_RUN_CONFIG -- -m
- cd $LRS_RUN_CONFIG
- ls
- ./live-test.exe -d yes -i [software-device]
- unset LRS_LOG_LEVEL
- C:/Python38/python.exe ../../unit-tests/run-unit-tests.py --verbose .

- name: "Windows - cpp"
os: windows
language: cpp
env: VS15=true
script:
# map librealsense folder to overcome windows path too long issue
- pwd
- |
subst d: ../.
- cd d:/build
- cmake .. -G "Visual Studio 14 2015 Win64" -DBUILD_EXAMPLES=true -DBUILD_WITH_TM2=true -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_BUILD_CONFIG -- -m
- ls $LRS_BUILD_CONFIG

- name: "Windows - C#"
os: windows
language: cpp
env: VS15=true
script:
# map librealsense folder to overcome windows path too long issue
- pwd
- |
subst d: ../.
- cd d:/build
- cmake .. -G "Visual Studio 14 2015 Win64" -DBUILD_EXAMPLES=false -DBUILD_CSHARP_BINDINGS=true -DDOTNET_VERSION_LIBRARY="4.5" -DDOTNET_VERSION_EXAMPLES="4.5" -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_BUILD_CONFIG -- -m
- ls $LRS_BUILD_CONFIG

- name: "Linux Testing - cpp"
os: linux
language: cpp
sudo: required
dist: xenial
env: RS_CPP_TEST=true
script:
- cmake .. -DBUILD_UNIT_TESTS=true -DBUILD_EXAMPLES=false -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_RUN_CONFIG -- -j$(($(nproc)-1))
- ./unit-tests/live-test -d yes -i [software-device]
- for i in ./records/single_cam/*; do ./unit-tests/live-test -d yes -i ~[multicam] from "$i"; done
- for i in ./records/multi_cam/*; do ./unit-tests/live-test -d yes -i [multicam] from "$i"; done

- name: "Linux - cpp - static"
os: linux
language: cpp
sudo: required
dist: xenial
script:
- cd ../scripts && ./pr_check.sh && cd ../build
- cmake .. -DBUILD_UNIT_TESTS=true -DBUILD_EXAMPLES=true -DBUILD_WITH_TM2=true -DBUILD_SHARED_LIBS=false -DCHECK_FOR_UPDATES=true -DBUILD_PYTHON_BINDINGS=true -DPYBIND11_PYTHON_VERSION=3.5
- cmake --build . --config $LRS_BUILD_CONFIG -- -j$(($(nproc)-1))
- python3 ../unit-tests/run-unit-tests.py --verbose .

- name: "Linux - python & nodejs"
os: linux
language: cpp
sudo: required
dist: xenial
python: "2.7"
node_js: "10"
env: LRS_BUILD_NODEJS=true
script:
- python ../wrappers/nodejs/tools/enums.py -i ../include/librealsense2 -a ../wrappers/nodejs/src -v
- cmake .. -DBUILD_PYTHON_BINDINGS=true -DBUILD_NODEJS_BINDINGS=true -DPYBIND11_PYTHON_VERSION=2.7 -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_BUILD_CONFIG -- -j$(($(nproc)-1))
- cd ../wrappers/nodejs/
- npm install
- cd test
- wget http://realsense-hw-public.s3.amazonaws.com/rs-tests/nodejs_records.rec

- name: "Mac - cpp"
os: osx
language: cpp
sudo: required
osx_image: xcode7
script:
- cmake .. -DBUILD_EXAMPLES=true -DBUILD_WITH_OPENMP=false -DHWM_OVER_XU=false -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_BUILD_CONFIG -- -j$(($(nproc)-1))
- ls

- name: "Android - cpp"
os: linux
language: cpp
sudo: required
dist: xenial
env: LRS_BUILD_ANDROID=true
script:
- cmake .. -DCMAKE_TOOLCHAIN_FILE=../android-ndk-r20b/build/cmake/android.toolchain.cmake -DCHECK_FOR_UPDATES=true
- cmake --build . --config $LRS_BUILD_CONFIG -- -j$(($(nproc)-1))
- ls

before_install:
- cd scripts && ./api_check.sh && cd ..
- if [[ "$LRS_BUILD_NODEJS" == "true" ]]; then
nvm install 10.15.3;
nvm use 10.15.3;
npm install -g node-gyp;
npm install -g mocha;
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git;
export OLDPATH=$PATH && export PATH=$PATH:$(pwd)/depot_tools;
cd wrappers/nodejs/tools && npm install && cd ..;
node ./tools/linter.js;
export PATH=$OLDPATH && unset OLDPATH && cd ../../;
fi
- if [[ "$LRS_BUILD_ANDROID" == "true" ]]; then
wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip;
unzip -q android-ndk-r20b-linux-x86_64.zip -d ./;
fi
- mkdir build && cd build
- if [[ "$RS_CPP_TEST" == "true" ]]; then
export LRS_LOG_LEVEL="DEBUG";
url_records_path="http://realsense-hw-public.s3.amazonaws.com/rs-tests/lrs_2.8.3/";
records_name="records_test.txt";
url_records_list=$url_records_path$records_name;
wget $url_records_path$records_name;
tests_list=`cat $records_name`;
for record in $tests_list; do echo $url_records_path$record; wget $url_records_path$record -P "records/"$(echo $record | cut -d '/' -f 1); done;
fi

install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test;
sudo apt-get update;
sudo apt-get install -qq build-essential xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev libglm-dev;
sudo apt-get install -qq libusb-1.0-0-dev;
sudo apt-get install -qq libgtk-3-dev;
sudo apt-get install gcc-5 g++-5;
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5;
sudo apt-get install libglfw3-dev libglfw3;
fi

- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
choco install -y python3 --version 3.8.1;
if [[ "$VS15" == "true" ]]; then
choco install -y vcbuildtools --version 2015.4 --force;
fi;
fi

- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew uninstall xctool;
brew install xctool --HEAD;
brew install homebrew/core/glfw3;
brew list libusb || brew install libusb;
fi
33 changes: 33 additions & 0 deletions CMake/android_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
message(STATUS "Setting Android configurations")
message(STATUS "Prepare RealSense SDK for Android OS (${ANDROID_NDK_ABI_NAME})")

macro(os_set_flags)
unset(WIN32)
unset(UNIX)
unset(APPLE)
set(BUILD_WITH_TM2 OFF)
set(BUILD_UNIT_TESTS OFF)
set(BUILD_EXAMPLES OFF)
set(BUILD_WITH_OPENMP OFF)
set(BUILD_GRAPHICAL_EXAMPLES OFF)
set(ANDROID_STL "c++_static")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -pedantic -g -D_DEFAULT_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
set(HWM_OVER_XU ON)

if(FORCE_RSUSB_BACKEND)
set(BACKEND RS2_USE_ANDROID_BACKEND)
set(IMPORT_DEPTH_CAM_FW OFF)
else()
set(BACKEND RS2_USE_V4L2_BACKEND)
endif()
endmacro()

macro(os_target_config)
if(BUILD_SHARED_LIBS)
find_library(log-lib log)
target_link_libraries(${LRS_TARGET} PRIVATE log)
endif()
endmacro()
12 changes: 12 additions & 0 deletions CMake/connectivity_check.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2019 Intel Corporation. All Rights Reserved.
message(STATUS "Checking internet connection...")
file(DOWNLOAD "http://realsense-hw-public.s3-eu-west-1.amazonaws.com/Releases/connectivity_check" "${CMAKE_CURRENT_SOURCE_DIR}/connectivity_check" SHOW_PROGRESS TIMEOUT 5 STATUS status)
list (FIND status "\"No error\"" _index)
if (${_index} EQUAL -1)
message(STATUS "Failed to identify Internet connection")
set(INTERNET_CONNECTION OFF)
else()
message(STATUS "Internet connection identified")
set(INTERNET_CONNECTION ON)
endif()
15 changes: 15 additions & 0 deletions CMake/cuda_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
info("Building with CUDA requires CMake v3.8+")
cmake_minimum_required(VERSION 3.8.0)
project(librealsense2 LANGUAGES CXX C CUDA)

find_package(CUDA REQUIRED)

include_directories(${CUDA_INCLUDE_DIRS})
SET(ALL_CUDA_LIBS ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY})
SET(LIBS ${LIBS} ${ALL_CUDA_LIBS})

message(STATUS "CUDA_LIBRARIES: ${CUDA_INCLUDE_DIRS} ${ALL_CUDA_LIBS}")

set(CUDA_PROPAGATE_HOST_FLAGS OFF)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -O3 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62;")
28 changes: 28 additions & 0 deletions CMake/embedd_udev_rules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
file(READ "config/99-realsense-libusb.rules" contents HEX)

set(UDEV_HEADER "${CMAKE_CURRENT_BINARY_DIR}/udev-rules.h")

file(WRITE "${UDEV_HEADER}" "#ifndef __UDEV_RULES_H__\n")
file(APPEND "${UDEV_HEADER}" "#define __UDEV_RULES_H__\n")
file(APPEND "${UDEV_HEADER}" "#ifdef __cplusplus\n")
file(APPEND "${UDEV_HEADER}" "extern \"C\" {\n")
file(APPEND "${UDEV_HEADER}" "#endif\n")

file(APPEND "${UDEV_HEADER}" "const char "
"realsense_udev_rules[] = {")

string(LENGTH "${contents}" contents_length)
math(EXPR contents_length "${contents_length} - 1")

foreach(iter RANGE 0 ${contents_length} 2)
string(SUBSTRING ${contents} ${iter} 2 line)
file(APPEND "${UDEV_HEADER}" "0x${line},")
endforeach()

file(APPEND "${UDEV_HEADER}" "};\n")

file(APPEND "${UDEV_HEADER}" "#ifdef __cplusplus\n")
file(APPEND "${UDEV_HEADER}" "}\n")
file(APPEND "${UDEV_HEADER}" "#endif\n")

file(APPEND "${UDEV_HEADER}" "#endif//\n")
49 changes: 49 additions & 0 deletions CMake/external_libcurl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
if(CHECK_FOR_UPDATES)
include(ExternalProject)
message(STATUS "Building libcurl enabled")

set(CURL_FLAGS -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_WIN32_LDAP=OFF -DHTTP_ONLY=ON -DCURL_ZLIB=OFF -DCURL_DISABLE_CRYPTO_AUTH=ON -DCMAKE_USE_OPENSSL=OFF -DCMAKE_USE_LIBSSH2=OFF -DBUILD_TESTING=OFF )
if (WIN32)
set(CURL_FLAGS ${CURL_FLAGS} -DCURL_STATIC_CRT=ON )
endif()

ExternalProject_Add(
libcurl
PREFIX libcurl
GIT_REPOSITORY "https://github.com/curl/curl.git"
GIT_TAG "53cdc2c963e33bc0cc1a51ad2df79396202e07f8" # curl-7_70_0
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/third-party/libcurl
CMAKE_ARGS -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_STANDARD_LIBRARIES=${CMAKE_CXX_STANDARD_LIBRARIES}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/libcurl/libcurl_install
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL} ${CURL_FLAGS}
UPDATE_COMMAND ""
PATCH_COMMAND ""
TEST_COMMAND ""
)

set(CURL_DEBUG_TARGET_NAME "libcurl-d")
set(CURL_RELEASE_TARGET_NAME "libcurl")
add_library(curl INTERFACE)
add_definitions(-DCURL_STATICLIB) # Mandatory for building libcurl as static lib

target_include_directories(curl INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/libcurl/libcurl_install/include>)

# libcurl require ws2_32.lib for windows only
if (WIN32)
target_link_libraries(curl INTERFACE ws2_32.lib)
endif()

target_link_libraries(curl INTERFACE debug ${CMAKE_CURRENT_BINARY_DIR}/libcurl/libcurl_install/lib/${CURL_DEBUG_TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
target_link_libraries(curl INTERFACE optimized ${CMAKE_CURRENT_BINARY_DIR}/libcurl/libcurl_install/lib/${CURL_RELEASE_TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})

endif() #CHECK_FOR_UPDATES
Loading

0 comments on commit f7e0bd9

Please sign in to comment.