From f37984ff746bc990be7150ea40c8a147acc25b66 Mon Sep 17 00:00:00 2001 From: MonicaLiu <110024546+MonicaLiu0311@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:52:53 -0800 Subject: [PATCH] [realsense2] Update to 2.56.2 (#41984) Co-authored-by: Monica --- .../realsense2/fix-android-prefix-path.patch | 17 +++++ ports/realsense2/fix-nlohmann_json.patch | 47 ++++++++++++ ports/realsense2/fix-osx.patch | 73 ------------------- ports/realsense2/portfile.cmake | 12 +-- ports/realsense2/vcpkg.json | 4 +- versions/baseline.json | 4 +- versions/r-/realsense2.json | 5 ++ 7 files changed, 76 insertions(+), 86 deletions(-) create mode 100644 ports/realsense2/fix-android-prefix-path.patch create mode 100644 ports/realsense2/fix-nlohmann_json.patch delete mode 100644 ports/realsense2/fix-osx.patch diff --git a/ports/realsense2/fix-android-prefix-path.patch b/ports/realsense2/fix-android-prefix-path.patch new file mode 100644 index 0000000000..486bdbabc2 --- /dev/null +++ b/ports/realsense2/fix-android-prefix-path.patch @@ -0,0 +1,17 @@ +diff --git a/CMake/android_config.cmake b/CMake/android_config.cmake +index 203003e..4eac6dd 100644 +--- a/CMake/android_config.cmake ++++ b/CMake/android_config.cmake +@@ -16,7 +16,11 @@ macro(os_set_flags) + 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) +- ++ ++ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) ++ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) ++ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) ++ + if(FORCE_RSUSB_BACKEND) + set(BACKEND RS2_USE_ANDROID_BACKEND) + set(IMPORT_DEPTH_CAM_FW OFF) diff --git a/ports/realsense2/fix-nlohmann_json.patch b/ports/realsense2/fix-nlohmann_json.patch new file mode 100644 index 0000000000..4949a4fea1 --- /dev/null +++ b/ports/realsense2/fix-nlohmann_json.patch @@ -0,0 +1,47 @@ +diff --git a/CMake/realsense2Config.cmake.in b/CMake/realsense2Config.cmake.in +index b7319a6..f1301ab 100644 +--- a/CMake/realsense2Config.cmake.in ++++ b/CMake/realsense2Config.cmake.in +@@ -1,3 +1,6 @@ ++include(CMakeFindDependencyMacro) ++find_dependency(nlohmann_json) ++ + @PACKAGE_INIT@ + + set(realsense2_VERSION_MAJOR "@REALSENSE_VERSION_MAJOR@") +diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt +index c703140..e1fe5b9 100644 +--- a/third-party/CMakeLists.txt ++++ b/third-party/CMakeLists.txt +@@ -1,7 +1,5 @@ + string(REPLACE ${PROJECT_SOURCE_DIR}/ "" _rel_path ${CMAKE_CURRENT_LIST_DIR}) + +-include(CMake/external_json.cmake) +- + add_subdirectory( "${CMAKE_CURRENT_LIST_DIR}/rsutils" ) + + # Add additional include directories to allow file to include rosbag headers +diff --git a/third-party/rsutils/CMakeLists.txt b/third-party/rsutils/CMakeLists.txt +index b0fc310..95e8a46 100644 +--- a/third-party/rsutils/CMakeLists.txt ++++ b/third-party/rsutils/CMakeLists.txt +@@ -4,15 +4,16 @@ cmake_minimum_required(VERSION 3.8.0) # source_group(TREE) + project( rsutils ) + + add_library( ${PROJECT_NAME} STATIC "" ) +-# We cannot directly interface with nlohmann_json (doesn't work on bionic) +-#target_link_libraries( ${PROJECT_NAME} PUBLIC nlohmann_json ) ++ ++find_package(nlohmann_json CONFIG REQUIRED) ++target_link_libraries(${PROJECT_NAME} PUBLIC nlohmann_json::nlohmann_json) ++ + target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_14 ) + set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Library ) + + target_include_directories( ${PROJECT_NAME} + PUBLIC + $ +- $ + ) + + # Headers ----------------------------------------------------------------------------------- diff --git a/ports/realsense2/fix-osx.patch b/ports/realsense2/fix-osx.patch deleted file mode 100644 index e09756bcfb..0000000000 --- a/ports/realsense2/fix-osx.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff --git a/CMake/lrs_macros.cmake b/CMake/lrs_macros.cmake -index b19a729049..cabb376c97 100644 ---- a/CMake/lrs_macros.cmake -+++ b/CMake/lrs_macros.cmake -@@ -7,21 +7,10 @@ macro(infoValue variableName) - endmacro() - - macro(config_cxx_flags) -- include(CheckCXXCompilerFlag) -- if(MSVC OR MSVC_IDE) -- check_cxx_compiler_flag(/std:c++14 SUPPORTS_CXX14) -- else() -- check_cxx_compiler_flag(-std=c++14 SUPPORTS_CXX14) -- endif() -- if( NOT SUPPORTS_CXX14 ) -- message(FATAL_ERROR "Project '${PROJECT_NAME}' requires C++14 or higher") -- endif() -- if( NOT CMAKE_CXX_STANDARD ) -- set( CMAKE_CXX_STANDARD 14 ) -- endif() - # We require that the current project (e.g., librealsense) use C++14. However, projects using - # the library don't need to be C++14 -- they can use C++11. Hence this is PRIVATE and not PUBLIC: -- target_compile_features( ${PROJECT_NAME} PRIVATE cxx_std_${CMAKE_CXX_STANDARD} ) -+ target_compile_features( ${PROJECT_NAME} PRIVATE cxx_std_14 ) -+ target_compile_features( ${PROJECT_NAME} INTERFACE cxx_std_11 ) - #set( CMAKE_CUDA_STANDARD ${LRS_CXX_STANDARD} ) - endmacro() - - -From b049865e918c44833c5f6ea293b5ae1ccdea99e2 Mon Sep 17 00:00:00 2001 -From: Leander Schulten -Date: Mon, 17 Jul 2023 00:48:18 +0200 -Subject: [PATCH 2/3] rsutils: specify required c++ version - ---- - third-party/rsutils/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/third-party/rsutils/CMakeLists.txt b/third-party/rsutils/CMakeLists.txt -index f6a0e41141..b31e684c43 100644 ---- a/third-party/rsutils/CMakeLists.txt -+++ b/third-party/rsutils/CMakeLists.txt -@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.8.0) # source_group(TREE) - project( rsutils ) - - add_library( ${PROJECT_NAME} STATIC "" ) -+target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_11 ) - set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Library ) - - target_include_directories( ${PROJECT_NAME} - -From eaa61985dd54e88e943fc433264b1161c4482593 Mon Sep 17 00:00:00 2001 -From: Leander Schulten -Date: Mon, 17 Jul 2023 00:57:00 +0200 -Subject: [PATCH 3/3] realsense-file: specify required c++ version - ---- - third-party/realsense-file/CMakeLists.txt | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/third-party/realsense-file/CMakeLists.txt b/third-party/realsense-file/CMakeLists.txt -index a805cddf8c..63c3526b1d 100644 ---- a/third-party/realsense-file/CMakeLists.txt -+++ b/third-party/realsense-file/CMakeLists.txt -@@ -27,6 +27,8 @@ add_library(${PROJECT_NAME} STATIC - ${SOURCE_FILES_COMPRESSION} - ) - -+target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) -+ - target_include_directories(${PROJECT_NAME} PRIVATE - ${ROSBAG_HEADER_DIRS} - ${LZ4_INCLUDE_PATH} diff --git a/ports/realsense2/portfile.cmake b/ports/realsense2/portfile.cmake index 1fcd2fb33e..8050dd4357 100644 --- a/ports/realsense2/portfile.cmake +++ b/ports/realsense2/portfile.cmake @@ -1,19 +1,13 @@ -vcpkg_download_distfile(ARM64_DETECTION_FIX - URLS https://github.com/IntelRealSense/librealsense/commit/5a244052e2df7842940dfb5a9011973a09626300.patch?full_desc=1 - FILENAME realsense2-arm64-detection-fix-5a244052e2df7842940dfb5a9011973a09626300.patch - SHA512 2897a55a58ec549914378213a5decd0092a527268651e7cb140ce2dad3ee99ddde2735113a448d8a191552fc32fa40a45422b274f617c98cda3d1b3ce948204b -) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO IntelRealSense/librealsense REF "v${VERSION}" - SHA512 20561294da571e0e1f5f8c9ac1039828512f3361a4241e5ad320bbb684626c1e78cd18e6a6344ec80fcd86dc699742c51069bc2b6895aec1dcbd9f394d2c9998 + SHA512 0e8acc96bff60b6842fea03c871ff9b350c4f1c90c9493d6e1163384ebd4ba7c31fb110e9cca3547d36145628ad93cca298f36ba9d9cf8692dab5ad0d3d58a4d HEAD_REF master PATCHES fix_openni2.patch - fix-osx.patch # from https://github.com/IntelRealSense/librealsense/pull/11997 - "${ARM64_DETECTION_FIX}" + fix-nlohmann_json.patch + fix-android-prefix-path.patch ) file(COPY "${SOURCE_PATH}/src/win7/drivers/IntelRealSense_D400_series_win7.inf" DESTINATION "${SOURCE_PATH}") diff --git a/ports/realsense2/vcpkg.json b/ports/realsense2/vcpkg.json index a400ee5f91..76fb99c1d5 100644 --- a/ports/realsense2/vcpkg.json +++ b/ports/realsense2/vcpkg.json @@ -1,7 +1,6 @@ { "name": "realsense2", - "version": "2.54.2", - "port-version": 3, + "version": "2.56.2", "description": "Intel® RealSense™ SDK 2.0 is a cross-platform library for Intel® RealSense™ depth cameras (D400 series and the SR300).", "homepage": "https://github.com/IntelRealSense/librealsense", "license": "Apache-2.0", @@ -11,6 +10,7 @@ "name": "libusb", "platform": "!windows" }, + "nlohmann-json", { "name": "vcpkg-cmake", "host": true diff --git a/versions/baseline.json b/versions/baseline.json index 8382dfb6cb..cd6e9c7cf2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7869,8 +7869,8 @@ "port-version": 0 }, "realsense2": { - "baseline": "2.54.2", - "port-version": 3 + "baseline": "2.56.2", + "port-version": 0 }, "recast": { "baseline": "deprecated", diff --git a/versions/r-/realsense2.json b/versions/r-/realsense2.json index 9ef6862a2a..ce9afed11a 100644 --- a/versions/r-/realsense2.json +++ b/versions/r-/realsense2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cd83d4d25a389c96970ee763fa48a48b9b419f5b", + "version": "2.56.2", + "port-version": 0 + }, { "git-tree": "6206dc9c187261a734853fb0983ac24302fc07ae", "version": "2.54.2",