Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update librealsense to v2.54.2 #6714

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
STOOLS_VER: "67.3.2"
JEDI_VER: "0.17.2" # https://github.com/ipython/ipython/issues/12740
IDNA_VER: "2.8" # https://github.com/psf/requests/issues/5710
CUDA_VERSION: 11.7.1
SRC_DIR: "D:\\a\\open3d\\open3d"
BUILD_DIR: "C:\\Open3D\\build"
NPROC: 2
Expand All @@ -34,7 +35,7 @@ jobs:
windows:
permissions:
contents: write # upload
runs-on: windows-2019
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
Expand All @@ -47,7 +48,6 @@ jobs:
STATIC_RUNTIME: ON
include:
- BUILD_CUDA_MODULE: ON
CUDA_VERSION: 11.0.3
env:
BUILD_WEBRTC: ${{ ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }}

Expand All @@ -64,16 +64,12 @@ jobs:
if: ${{ matrix.BUILD_CUDA_MODULE == 'ON' }}
run: |
# Define variables
$CUDA_VER_FULL = "${{ matrix.CUDA_VERSION }}"
$CUDA_VER_FULL = "${{ env.CUDA_VERSION }}"
$CUDA_VER_ARR = $CUDA_VER_FULL.Split(".")
$CUDA_VER = "$($CUDA_VER_ARR[0]).$($CUDA_VER_ARR[1])"
$CUDA_VER_ID = "$($CUDA_VER_ARR[0])_$($CUDA_VER_ARR[1])"
# Installer url
if ( $CUDA_VER_ARR[0] -ge 11 ) {
$CUDA_URL = "http://developer.download.nvidia.com/compute/cuda/$CUDA_VER_FULL/network_installers/cuda_$($CUDA_VER_FULL)_win10_network.exe"
} else {
$CUDA_URL = "http://developer.download.nvidia.com/compute/cuda/$CUDA_VER/Prod/network_installers/cuda_$($CUDA_VER_FULL)_win10_network.exe"
}
$CUDA_URL = "https://developer.download.nvidia.com/compute/cuda/$CUDA_VER_FULL/network_installers/cuda_$($CUDA_VER_FULL)_windows_network.exe"
# Installer arguments
$CUDA_INSTALL_ARGS = "-s"
# Required packages
Expand Down Expand Up @@ -110,7 +106,7 @@ jobs:
if (${env:DEVELOPER_BUILD} -ne "OFF") {
${env:DEVELOPER_BUILD}="ON"
}
cmake -G "Visual Studio 16 2019" -A x64 `
cmake -G "Visual Studio 17 2022" -A x64 `
-DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" `
-DCMAKE_SYSTEM_VERSION="10.0.19041.0" `
-DBUILD_EXAMPLES=OFF `
Expand Down Expand Up @@ -205,7 +201,7 @@ jobs:
$ErrorActionPreference = 'Stop'
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 `
cmake -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" `
-DSTATIC_WINDOWS_RUNTIME=${{ matrix.STATIC_RUNTIME }} `
..
Expand Down Expand Up @@ -235,7 +231,7 @@ jobs:
name: Build wheel
permissions:
contents: write # upload
runs-on: windows-2019
runs-on: windows-2022
strategy:
fail-fast: false
# https://gh.neting.ccmunity/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6
Expand Down Expand Up @@ -280,7 +276,7 @@ jobs:
if (${env:DEVELOPER_BUILD} -ne "OFF") {
${env:DEVELOPER_BUILD}="ON"
}
cmake -G "Visual Studio 16 2019" -A x64 `
cmake -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" `
-DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" `
-DCMAKE_SYSTEM_VERSION="10.0.19041.0" `
Expand Down Expand Up @@ -323,7 +319,7 @@ jobs:
name: Test wheel
permissions:
contents: read
runs-on: windows-2019
runs-on: windows-2019 # build on 2022, test on 2019
needs: [build-wheel]
strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dirent 1.21 MIT license
https://github.com/tronkko/dirent
A C/C++ programming interface for cross-platform filesystem
--------------------------------------------------------------------------------
librealsense 2.44.0 Apache-2 license
librealsense 2.54.2 Apache-2 license
A cross-platform library for capturing data from the Intel RealSense F200,
SR300, R200 and L500 cameras
https://github.com/IntelRealSense/librealsense
Expand Down Expand Up @@ -113,7 +113,7 @@ As an alternative, you can modify 3rdparty/zeromq/zeromq_build.cmake to fetch
zeromq from our fork
https://github.com/isl-org/libzmq
--------------------------------------------------------------------------------
embree 3.13.0 Apache-2 license
embree 4.3.1 Apache-2 license
Embree is a collection of high-performance ray tracing kernels
https://github.com/embree/embree
--------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ set(ExternalProject_CMAKE_ARGS
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_CUDA_COMPILER_LAUNCHER=${CMAKE_CUDA_COMPILER_LAUNCHER}
-DCMAKE_CUDA_FLAGS=${CMAKE_CUDA_FLAGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}
-DCMAKE_INSTALL_LIBDIR=${Open3D_INSTALL_LIB_DIR}
Expand Down
22 changes: 0 additions & 22 deletions 3rdparty/librealsense/fix-macos-arm64.patch

This file was deleted.

30 changes: 30 additions & 0 deletions 3rdparty/librealsense/fix_mac_apple_silicon_build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 5a244052e2df7842940dfb5a9011973a09626300 Mon Sep 17 00:00:00 2001
From: Nir Azkiel <nir.azkiel@intel.com>
Date: Tue, 28 May 2024 17:17:04 +0300
Subject: [PATCH] fix mac apple silicon build

---
CMake/unix_config.cmake | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/CMake/unix_config.cmake b/CMake/unix_config.cmake
index 5a187c7c7a..89272b8ee1 100644
--- a/CMake/unix_config.cmake
+++ b/CMake/unix_config.cmake
@@ -19,12 +19,12 @@ macro(os_set_flags)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security")

execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE MACHINE)
- if(${MACHINE} MATCHES "arm-*")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")
- elseif(${MACHINE} MATCHES "aarch64-*")
+ if(${MACHINE} MATCHES "arm64-*" OR ${MACHINE} MATCHES "aarch64-*")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstrict-align -ftree-vectorize")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstrict-align -ftree-vectorize")
+ elseif(${MACHINE} MATCHES "arm-*")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")
elseif(${MACHINE} MATCHES "powerpc64(le)?-linux-gnu")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftree-vectorize")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize")
34 changes: 20 additions & 14 deletions 3rdparty/librealsense/librealsense.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ find_package(Git QUIET REQUIRED)
ExternalProject_Add(
ext_librealsense
PREFIX librealsense
URL https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.44.0.tar.gz # 2020 Apr 1
URL_HASH SHA256=5b0158592646984f0f7348da3783e2fb49e99308a97f2348fe3cc82c770c6dde
URL https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.54.2.tar.gz # 2023 Sep 28
# Future versions after v2.54.2 may not support L515 and SR300
URL_HASH SHA256=e3a767337ff40ae41000049a490ab84bd70b00cbfef65e8cdbadf17fd2e1e5a8
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/librealsense"
UPDATE_COMMAND ""
# Patch for libusb static build failure on Linux
Expand All @@ -17,9 +18,7 @@ ExternalProject_Add(
COMMAND ${GIT_EXECUTABLE} init
COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace
${CMAKE_CURRENT_LIST_DIR}/fix-cudacrt.patch
# Patch for macOS ARM64 support for versions < 2.50.0
COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace
${CMAKE_CURRENT_LIST_DIR}/fix-macos-arm64.patch
${CMAKE_CURRENT_LIST_DIR}/fix_mac_apple_silicon_build.patch
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DBUILD_SHARED_LIBS=OFF
Expand All @@ -30,6 +29,7 @@ ExternalProject_Add(
-DBUILD_PYTHON_BINDINGS=OFF
-DBUILD_WITH_CUDA=${BUILD_CUDA_MODULE}
-DUSE_EXTERNAL_USB=ON
-DBUILD_TOOLS=OFF
# Syncing GLIBCXX_USE_CXX11_ABI for MSVC causes problems, but directly
# checking CXX_COMPILER_ID is not supported.
$<IF:$<PLATFORM_ID:Windows>,"",-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=$<BOOL:${GLIBCXX_USE_CXX11_ABI}>>
Expand All @@ -43,27 +43,33 @@ ExternalProject_Add(
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}realsense2${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}realsense-file${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}fw${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}rsutils${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_librealsense INSTALL_DIR)
set(LIBREALSENSE_INCLUDE_DIR "${INSTALL_DIR}/include/") # "/" is critical.
set(LIBREALSENSE_LIB_DIR "${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR}")

set(LIBREALSENSE_LIBRARIES realsense2 fw realsense-file usb) # The order is critical.
set(LIBREALSENSE_LIBRARIES realsense2 fw realsense-file rsutils) # The order is critical.
if (NOT MSVC)
list(APPEND LIBREALSENSE_LIBRARIES usb)
endif()
if(MSVC) # Rename debug libs to ${LIBREALSENSE_LIBRARIES}. rem (comment) is no-op
ExternalProject_Add_Step(ext_librealsense rename_debug_libs
COMMAND $<IF:$<CONFIG:Debug>,move,rem> /Y realsense2d.lib realsense2.lib
COMMAND $<IF:$<CONFIG:Debug>,move,rem> /Y fwd.lib fw.lib
COMMAND $<IF:$<CONFIG:Debug>,move,rem> /Y realsense-filed.lib realsense-file.lib
COMMAND $<IF:$<CONFIG:Debug>,move,rem> /Y rsutilsd.lib rsutils.lib
WORKING_DIRECTORY "${LIBREALSENSE_LIB_DIR}"
DEPENDEES install
)
endif()

ExternalProject_Add_Step(ext_librealsense copy_libusb_to_lib_folder
COMMAND ${CMAKE_COMMAND} -E copy
"<BINARY_DIR>/libusb_install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${LIBREALSENSE_LIB_DIR}"
DEPENDEES install
BYPRODUCTS "${LIBREALSENSE_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
if (NOT MSVC)
ExternalProject_Add_Step(ext_librealsense copy_libusb_to_lib_folder
COMMAND ${CMAKE_COMMAND} -E copy
"<BINARY_DIR>/libusb_install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${LIBREALSENSE_LIB_DIR}"
DEPENDEES install
BYPRODUCTS "${LIBREALSENSE_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
5 changes: 3 additions & 2 deletions 3rdparty/stdgpu/stdgpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ include(ExternalProject)
ExternalProject_Add(
ext_stdgpu
PREFIX stdgpu
URL https://github.com/stotko/stdgpu/archive/e10f6f3ccc9902d693af4380c3bcd188ec34a2e6.tar.gz
URL_HASH SHA256=7bb2733b099f7cedc86d2aee7830d128ac1222cfafa34cbaa4e818483c0a93f6
# Jul 2024: Fix FindThrust.cmake
URL https://github.com/stotko/stdgpu/archive/1b6a3319f1fbf180166e1bbc1d75f69ab622a0a0.tar.gz
URL_HASH SHA256=FAA3BF9CBE49EF9CC09E2E07E60D10BBF3B896EDB6089C920BEBE0F850FD95E4
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/stdgpu"
UPDATE_COMMAND ""
CMAKE_ARGS
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ cmake_language(EVAL CODE "cmake_language(DEFER CALL open3d_patch_findthreads_mod

# Build CUDA module by default if CUDA is available
if(BUILD_CUDA_MODULE)
# Suppress nvcc unsupported compiler error for MSVC 2022 with CUDA 11.7 to 12.4
# https://forums.developer.nvidia.com/t/problems-with-latest-vs2022-update/294150/12
if (MSVC AND MSVC_VERSION VERSION_LESS_EQUAL "1949")
# Set this before any CUDA checks
set(CMAKE_CUDA_FLAGS "--allow-unsupported-compiler" CACHE STRING "Additional flags for nvcc" FORCE)
message(WARNING "Using --allow-unsupported-compiler flag for nvcc with MSVC 2022.")
endif()

if(BUILD_COMMON_CUDA_ARCHS)
if (CMAKE_CUDA_ARCHITECTURES)
message(STATUS "Building with user-provided architectures: ${CMAKE_CUDA_ARCHITECTURES}")
Expand Down
4 changes: 1 addition & 3 deletions python/test/t/io/test_realsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_RSBagReader():
assert n_frames == 6

# save_frames
bag_reader = o3d.t.io.RGBDVideoReader.create("L515_test_s.bag")
bag_reader = o3d.t.io.RGBDVideoReader.create(sample_l515_bag.path)
bag_reader.save_frames("L515_test_s")
# Use issubset() since there may be other OS files present
assert {'depth', 'color',
Expand All @@ -79,8 +79,6 @@ def test_RSBagReader():
}.issubset(os.listdir('L515_test_s/color'))

shutil.rmtree("L515_test_s")
if os.name != 'nt': # Permission error in Windows
os.remove("L515_test_s.bag")


# Test recording from a RealSense camera, if one is connected
Expand Down
Loading