From a03df3f43308901f742d2afd47e3a0a1abfc3a8b Mon Sep 17 00:00:00 2001 From: Tsukasa Sugiura Date: Thu, 8 Mar 2018 04:01:49 +0900 Subject: [PATCH] [realsense2] Update to v2.10.1 (#2956) * [realsense2] Update to v2.10.1 Update realsense2 port to librealsense v2.10.1. * [realsense2] Change HEAD to development Change HEAD to development. The latest branch of librealsense is "development". * [realsense2] Add option to support RGB image decode using AVX2 Add option to support RGB image decode using AVX2. This option will be deprecated in the later versions. * [realsense2] Add debug postfix Add debug postfix "_d". --- ports/realsense2/CONTROL | 5 +- ports/realsense2/build_with_static_crt.patch | 67 +++++++++++++++++++ .../realsense2/crt-linkage-restriction.patch | 21 ------ ports/realsense2/fix_rgb_using_avx2.patch | 12 ++++ ports/realsense2/portfile.cmake | 26 +++++-- 5 files changed, 102 insertions(+), 29 deletions(-) create mode 100644 ports/realsense2/build_with_static_crt.patch delete mode 100644 ports/realsense2/crt-linkage-restriction.patch create mode 100644 ports/realsense2/fix_rgb_using_avx2.patch diff --git a/ports/realsense2/CONTROL b/ports/realsense2/CONTROL index 22cbf12e41..f1674b7e9a 100644 --- a/ports/realsense2/CONTROL +++ b/ports/realsense2/CONTROL @@ -1,3 +1,6 @@ Source: realsense2 -Version: 2.10.0 +Version: 2.10.1 Description: Intel® RealSense™ SDK 2.0 is a cross-platform library for Intel® RealSense™ depth cameras (D400 series and the SR300). + +Feature: avx2 +Description: rgb image decode using avx2 \ No newline at end of file diff --git a/ports/realsense2/build_with_static_crt.patch b/ports/realsense2/build_with_static_crt.patch new file mode 100644 index 0000000000..ab8ec426d5 --- /dev/null +++ b/ports/realsense2/build_with_static_crt.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9425b92d..21232504 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -299,6 +299,8 @@ if(BUILD_EASYLOGGINGPP) + list(APPEND REALSENSE_HPP third-party/easyloggingpp/src/easylogging++.h) + 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 +@@ -484,15 +486,17 @@ if(WIN32) + src/proc/disparity-transform.h + ) + +- foreach(flag_var +- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE +- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO +- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE +- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) +- if(${flag_var} MATCHES "/MD") +- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") +- endif(${flag_var} MATCHES "/MD") +- endforeach(flag_var) ++ if(BUILD_WITH_STATIC_CRT) ++ foreach(flag_var ++ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE ++ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO ++ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE ++ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) ++ if(${flag_var} MATCHES "/MD") ++ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ++ endif(${flag_var} MATCHES "/MD") ++ endforeach(flag_var) ++ endif() + else() + + endif() +@@ -652,15 +656,17 @@ if (BUILD_WITH_TM2) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake) + find_package(libtm REQUIRED) + +- foreach(flag_var +- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE +- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO +- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE +- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) +- if(${flag_var} MATCHES "/MD") +- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") +- endif(${flag_var} MATCHES "/MD") +- endforeach(flag_var) ++ if(BUILD_WITH_STATIC_CRT) ++ foreach(flag_var ++ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE ++ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO ++ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE ++ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) ++ if(${flag_var} MATCHES "/MD") ++ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ++ endif(${flag_var} MATCHES "/MD") ++ endforeach(flag_var) ++ endif() + + list(APPEND REALSENSE_HPP + src/tm2/tm-context.h diff --git a/ports/realsense2/crt-linkage-restriction.patch b/ports/realsense2/crt-linkage-restriction.patch deleted file mode 100644 index 7729786162..0000000000 --- a/ports/realsense2/crt-linkage-restriction.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d6717b19..3fb373be 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -453,16 +453,6 @@ if(WIN32) - src/proc/syncer-processing-block.h - src/proc/disparity-transform.h - ) -- -- foreach(flag_var -- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE -- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO -- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE -- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) -- if(${flag_var} MATCHES "/MD") -- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") -- endif(${flag_var} MATCHES "/MD") -- endforeach(flag_var) - else() - - endif() diff --git a/ports/realsense2/fix_rgb_using_avx2.patch b/ports/realsense2/fix_rgb_using_avx2.patch new file mode 100644 index 0000000000..38ae33a7c7 --- /dev/null +++ b/ports/realsense2/fix_rgb_using_avx2.patch @@ -0,0 +1,12 @@ +diff --git a/src/image.cpp b/src/image.cpp +index 47cc68d8..04a8afd3 100644 +--- a/src/image.cpp ++++ b/src/image.cpp +@@ -8,6 +8,7 @@ + + #ifdef __SSSE3__ + #include // For SSE3 intrinsic used in unpack_yuy2_sse ++#include + #endif + + #pragma pack(push, 1) // All structs in this file are assumed to be byte-packed diff --git a/ports/realsense2/portfile.cmake b/ports/realsense2/portfile.cmake index b58be1ebe2..cec2c96955 100644 --- a/ports/realsense2/portfile.cmake +++ b/ports/realsense2/portfile.cmake @@ -3,18 +3,27 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO IntelRealSense/librealsense - REF v2.10.0 - SHA512 af5f77eb69620e8485bbe0b7c82c405ed518c50b3319e4c174c002180c4842d5dbfaab354051ed4b287effac58ae93dd1160ebc27d35def58e685874a89c02ee - HEAD_REF master + REF v2.10.1 + SHA512 fb00a424a5bd7335cc661261e76cf623e27a89af1033692d4cb6ed523af1295359929c235e82253911e61323cb7b82551a9223862174cb0e2363ac944b2db923 + HEAD_REF development ) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES - ${CMAKE_CURRENT_LIST_DIR}/crt-linkage-restriction.patch + ${CMAKE_CURRENT_LIST_DIR}/build_with_static_crt.patch # https://github.com/IntelRealSense/librealsense/pull/1262 + ${CMAKE_CURRENT_LIST_DIR}/fix_rgb_using_avx2.patch # https://github.com/IntelRealSense/librealsense/pull/1245 ) -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) +# This option will be deprecated in the later versions. +# Please see Pull Request #1245. https://github.com/IntelRealSense/librealsense/pull/1245 +set(RGB_USING_AVX2 OFF) +if("avx2" IN_LIST FEATURES) + set(RGB_USING_AVX2 ON) +endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LIBRARY_LINKAGE) +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_CRT_LINKAGE) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -24,10 +33,13 @@ vcpkg_configure_cmake( -DBUILD_GRAPHICAL_EXAMPLES=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_UNIT_TESTS=OFF - -DBUILD_WITH_OPENMP=OFF # keep OpenMP off until librealsense issue #744 is patched - -DBUILD_SHARED_LIBS=${BUILD_SHARED} + -DBUILD_WITH_OPENMP=OFF + -DBUILD_SHARED_LIBS=${BUILD_LIBRARY_LINKAGE} + -DBUILD_WITH_STATIC_CRT=${BUILD_CRT_LINKAGE} + -DRGB_USING_AVX2=${RGB_USING_AVX2} OPTIONS_DEBUG "-DCMAKE_PDB_OUTPUT_DIRECTORY=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + -DCMAKE_DEBUG_POSTFIX="_d" ) vcpkg_install_cmake()