[azure-kinect-sensor-sdk] Fix Deploy Azure Kinect Sensor SDK on Windows (#11139)

* Fix Deploy Azure Kinect Sensor SDK on Windows

Fix deploy Azure Kinect Sensor SDK on Windows by copy Depth Engine.

* Fix Download URL by Version Number

* Fix Check SHA512 Hash of NuGet package

* Add Check Library Linkage

* Change Install Directory for Deploy Files

* Update ports/azure-kinect-sensor-sdk/portfile.cmake

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
Tsukasa Sugiura 2020-05-09 06:35:59 +09:00 committed by GitHub
parent a1c887936f
commit 687a2b9b89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 4 deletions

View File

@ -1,5 +1,5 @@
Source: azure-kinect-sensor-sdk
Version: 1.4.0-alpha.0-4
Version: 1.4.0-alpha.0-5
Homepage: https://github.com/microsoft/Azure-Kinect-Sensor-SDK
Description: Azure Kinect SDK is a cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.
Build-Depends: azure-c-shared-utility, glfw3, gtest, imgui, libusb, spdlog, cjson, ebml, libjpeg-turbo, matroska, libsoundio, libyuv

View File

@ -0,0 +1,10 @@
# Note: This function signature and behavior is depended upon by applocal.ps1
function deployAzureKinectSensorSDK([string]$targetBinaryDir, [string]$installedDir, [string]$targetBinaryName) {
if ($targetBinaryName -like "k4a.dll") {
if(Test-Path "$installedDir\tools\azure-kinect-sensor-sdk\depthengine_2_0.dll") {
Write-Verbose " Deploying Azure Kinect Sensor SDK Initialization"
deployBinary "$targetBinaryDir" "$installedDir\tools\azure-kinect-sensor-sdk\" "depthengine_2_0.dll"
}
}
}

View File

@ -1,8 +1,9 @@
set(VERSION 1.4.0-alpha.0)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/Azure-Kinect-Sensor-SDK
REF 17b644560ce7b4ee7dd921dfff0ae811aa54ede6 #v1.4.0-alpha.0
SHA512 2746eebe5ef66c4b9d2215b6883723fca66dab77d405c662cc2af9364dc7fcd76aade396d23427db5797e0a534764eb2398890930ff3c792d0df8a681ce31462
REF v${VERSION}
SHA512 bf09ff92dc1b8621a941d838aef9c804bb5635f7984b7f86f01a38441d44935db764b69483d598e1f2c0aafb5c7ec196ef9c722967d92e6d075cb67ce781fea9
HEAD_REF master
PATCHES
fix-builds.patch
@ -59,5 +60,31 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
# Install Depth Engine
vcpkg_download_distfile(ARCHIVE
URLS "https://www.nuget.org/api/v2/package/Microsoft.Azure.Kinect.Sensor/${VERSION}"
FILENAME "azure-kinect-sensor-sdk.zip"
SHA512 6c15975e7c834672de723b0c474fa4cd58f41c5bee6511dcbdbc22f1a58daa906c4f01a7e941af0e7d09f763ff886015c1f6b1e29b6bdfb333f10857edfec2ca
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH PACKAGE_PATH
ARCHIVE ${ARCHIVE}
NO_REMOVE_ONE_LEVEL
)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
set(ARCHITECTURE "x86")
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
set(ARCHITECTURE "amd64")
else ()
message(FATAL_ERROR "this architecture is not supported.")
endif ()
file(COPY ${PACKAGE_PATH}/lib/native/${ARCHITECTURE}/release/depthengine_2_0.dll DESTINATION ${CURRENT_PACKAGES_DIR}/tools/azure-kinect-sensor-sdk)
file(COPY ${PACKAGE_PATH}/lib/native/${ARCHITECTURE}/release/depthengine_2_0.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/azure-kinect-sensor-sdk)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/k4adeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/tools/azure-kinect-sensor-sdk)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/k4adeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/azure-kinect-sensor-sdk)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -78,6 +78,7 @@ function resolve([string]$targetBinary) {
deployPluginsIfMagnum $targetBinaryDir "$g_install_root\bin\magnum" "$_"
}
}
if (Test-Path function:\deployAzureKinectSensorSDK) { deployAzureKinectSensorSDK $targetBinaryDir "$g_install_root" "$_" }
resolve "$baseTargetBinaryDir\$_"
} elseif (Test-Path "$targetBinaryDir\$_") {
Write-Verbose " ${_}: $_ not found in vcpkg; locally deployed"
@ -107,5 +108,10 @@ if (Test-Path "$g_install_root\bin\magnum\magnumdeploy.ps1") {
. "$g_install_root\bin\magnum-d\magnumdeploy.ps1"
}
# Note: This is a hack to make Azure Kinect Sensor SDK work.
if (Test-Path "$g_install_root\tools\azure-kinect-sensor-sdk\k4adeploy.ps1") {
. "$g_install_root\tools\azure-kinect-sensor-sdk\k4adeploy.ps1"
}
resolve($targetBinary)
Write-Verbose $($g_searched | out-string)