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 8 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
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
22 changes: 0 additions & 22 deletions 3rdparty/librealsense/fix-macos-arm64.patch

This file was deleted.

32 changes: 18 additions & 14 deletions 3rdparty/librealsense/librealsense.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ 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
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 +17,6 @@ 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_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DBUILD_SHARED_LIBS=OFF
Expand All @@ -30,6 +27,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 +41,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()
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