diff options
Diffstat (limited to 'vcpkg/ports/azure-kinect-sensor-sdk')
7 files changed, 500 insertions, 0 deletions
diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/fix-build-imgui.patch b/vcpkg/ports/azure-kinect-sensor-sdk/fix-build-imgui.patch new file mode 100644 index 0000000..cca3eaf --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/fix-build-imgui.patch @@ -0,0 +1,72 @@ +diff --git a/tools/k4aviewer/k4alogdockcontrol.cpp b/tools/k4aviewer/k4alogdockcontrol.cpp +index 4289f71..407e912 100644 +--- a/tools/k4aviewer/k4alogdockcontrol.cpp ++++ b/tools/k4aviewer/k4alogdockcontrol.cpp +@@ -161,7 +161,7 @@ K4ADockControlStatus K4ALogDockControl::Show() + + if (updated) + { +- ImGui::SetScrollHere(1.0f); ++ ImGui::SetScrollHereY(1.0f); + } + + ImGui::EndChild(); +diff --git a/tools/k4aviewer/k4asourceselectiondockcontrol.cpp b/tools/k4aviewer/k4asourceselectiondockcontrol.cpp +index 812608b..31e961d 100644 +--- a/tools/k4aviewer/k4asourceselectiondockcontrol.cpp ++++ b/tools/k4aviewer/k4asourceselectiondockcontrol.cpp +@@ -34,7 +34,7 @@ K4ASourceSelectionDockControl::K4ASourceSelectionDockControl() + + K4ADockControlStatus K4ASourceSelectionDockControl::Show() + { +- ImGui::SetNextTreeNodeOpen(true, ImGuiCond_FirstUseEver); ++ ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver); + if (ImGui::TreeNode("Open Device")) + { + ImGuiExtensions::K4AComboBox("Device S/N", +diff --git a/tools/k4aviewer/k4adevicedockcontrol.cpp b/tools/k4aviewer/k4adevicedockcontrol.cpp +index 8fe5687..6d1e95a 100644 +--- a/tools/k4aviewer/k4adevicedockcontrol.cpp ++++ b/tools/k4aviewer/k4adevicedockcontrol.cpp +@@ -333,7 +333,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show() + + if (m_firstRun || depthEnabledStateChanged) + { +- ImGui::SetNextTreeNodeOpen(m_config.EnableDepthCamera); ++ ImGui::SetNextItemOpen(m_config.EnableDepthCamera); + } + + ImGui::Indent(); +@@ -376,7 +376,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show() + + if (m_firstRun || colorEnableStateChanged) + { +- ImGui::SetNextTreeNodeOpen(m_config.EnableColorCamera); ++ ImGui::SetNextItemOpen(m_config.EnableColorCamera); + } + + ImGui::Indent(); +@@ -710,7 +710,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show() + + if (m_firstRun && (m_syncInConnected || m_syncOutConnected)) + { +- ImGui::SetNextTreeNodeOpen(true); ++ ImGui::SetNextItemOpen(true); + } + if (ImGui::TreeNode("External Sync")) + { +diff --git a/tools/k4aviewer/k4aviewerimage.cpp b/tools/k4aviewer/k4aviewerimage.cpp +index 68899f1..ad23490 100644 +--- a/tools/k4aviewer/k4aviewerimage.cpp ++++ b/tools/k4aviewer/k4aviewerimage.cpp +@@ -134,7 +134,9 @@ GLenum K4AViewerImage::Create(std::shared_ptr<K4AViewerImage> *out, + + K4AViewerImage::operator ImTextureID() const + { +- return reinterpret_cast<ImTextureID>(static_cast<intptr_t>(m_texture.Id())); ++ // m_texture.Id() : GLUint, 32 bit unsigned ++ // ImTextureID : ImU64, 64 bit unsigned ++ return m_texture.Id(); + } + + K4AViewerImage::operator GLuint() const diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/fix-builds.patch b/vcpkg/ports/azure-kinect-sensor-sdk/fix-builds.patch new file mode 100644 index 0000000..a904cbb --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/fix-builds.patch @@ -0,0 +1,170 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4f002b5..dd9b1df 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,8 +27,6 @@ option(K4A_BUILD_DOCS "Build K4A doxygen documentation" OFF) + option(K4A_MTE_VERSION "Skip FW version check" OFF) + option(K4A_SOURCE_LINK "Enable source linking on MSVC" OFF) + +-include(GitCommands) +- + # Set the project version + include(K4AProjectVersion) + +@@ -101,7 +99,59 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL + endif() + + # Find all dependencies +-add_subdirectory(extern) ++find_package(azure_c_shared_utility CONFIG REQUIRED) ++add_library(azure::aziotsharedutil ALIAS aziotsharedutil) ++ ++find_package(cJSON CONFIG REQUIRED) ++add_library(cJSON::cJSON ALIAS cjson) ++ ++find_package(EBML CONFIG REQUIRED) ++add_library(ebml::ebml ALIAS EBML::ebml) ++ ++find_package(libjpeg-turbo CONFIG REQUIRED) ++if(TARGET libjpeg-turbo::turbojpeg) ++ add_library(libjpeg-turbo::libjpeg-turbo ALIAS libjpeg-turbo::turbojpeg) ++else() ++ add_library(libjpeg-turbo::libjpeg-turbo ALIAS libjpeg-turbo::turbojpeg-static) ++endif() ++ ++find_package(libsoundio CONFIG REQUIRED) ++ ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0) ++add_library(LibUSB::LibUSB ALIAS PkgConfig::libusb) ++ ++if(NOT WIN32) ++ find_package(libuvc CONFIG REQUIRED) ++ if(TARGET LibUVC::UVCShared) ++ add_library(libuvc::libuvc ALIAS LibUVC::UVCShared) ++ else() ++ add_library(libuvc::libuvc ALIAS LibUVC::UVCStatic) ++ endif() ++endif() ++ ++find_package(libyuv CONFIG REQUIRED) ++add_library(libyuv::libyuv ALIAS yuv) ++ ++find_package(Matroska CONFIG REQUIRED) ++add_library(matroska::matroska ALIAS Matroska::matroska) ++add_definitions(-DMATROSKA_VERSION=2) ++ ++find_package(spdlog CONFIG REQUIRED) ++ ++if (BUILD_TOOLS) ++ find_package(gl3w CONFIG REQUIRED) ++ ++ find_package(glfw3 CONFIG REQUIRED) ++ add_library(glfw::glfw ALIAS glfw) ++ ++ find_package(imgui CONFIG REQUIRED) ++endif() ++ ++# Fix embl error ++if (MSVC) ++ add_compile_options(/wd4828 /wd4251 /wd4275) ++endif() + + # Don't enable testing until after building dependencies + enable_testing() +@@ -161,10 +211,13 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + endif() + endif() + +-add_subdirectory(examples) +-add_subdirectory(src) +-add_subdirectory(tests) +-add_subdirectory(tools) ++if (BUILD_EXAMPLES) ++ add_subdirectory(examples) ++endif() ++ add_subdirectory(src) ++if (BUILD_TOOLS) ++ add_subdirectory(tools) ++endif() + + if (K4A_BUILD_DOCS) + find_package(Doxygen 1.8.14 EXACT) +diff --git a/src/calibration/calibration.c b/src/calibration/calibration.c +index bf5f34a..d37c4e6 100644 +--- a/src/calibration/calibration.c ++++ b/src/calibration/calibration.c +@@ -6,7 +6,7 @@ + + // Dependent libraries + #include <k4ainternal/common.h> +-#include <cJSON.h> ++#include <cjson/cJSON.h> + #include <locale.h> //cJSON.h need this set correctly. + + // System dependencies +diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp +index 05264c5..41185de 100644 +--- a/src/logging/logging.cpp ++++ b/src/logging/logging.cpp +@@ -24,6 +24,9 @@ + #pragma warning(disable : 4702) + #endif + #include <spdlog/spdlog.h> ++#include <spdlog/sinks/stdout_color_sinks.h> ++#include <spdlog/sinks/rotating_file_sink.h> ++#include <spdlog/sinks/stdout_sinks.h> + #ifdef _MSC_VER + #pragma warning(default : 4702) + #endif +diff --git a/src/usbcommand/usb_cmd_priv.h b/src/usbcommand/usb_cmd_priv.h +index 0aa502c..0405b58 100644 +--- a/src/usbcommand/usb_cmd_priv.h ++++ b/src/usbcommand/usb_cmd_priv.h +@@ -20,7 +20,7 @@ + #include <azure_c_shared_utility/threadapi.h> + + // Exteranl dependencis +-#include <libusb.h> ++#include <libusb-1.0/libusb.h> + + // Ensure we have LIBUSB_API_VERSION defined if not defined by libusb.h + #ifndef LIBUSB_API_VERSION +diff --git a/tools/k4aviewer/CMakeLists.txt b/tools/k4aviewer/CMakeLists.txt +index 98578c0..244c867 100644 +--- a/tools/k4aviewer/CMakeLists.txt ++++ b/tools/k4aviewer/CMakeLists.txt +@@ -64,6 +64,7 @@ set(EXTERNAL_LIBRARIES + libyuv::libyuv + glfw::glfw + ${OPENGL_LIBRARIES} ++ unofficial::gl3w::gl3w + ) + + # On Windows, we need to call into setupapi to get USB container ID information +diff --git a/tools/k4aviewer/k4aaudiomanager.cpp b/tools/k4aviewer/k4aaudiomanager.cpp +index 243c800..ef85d45 100644 +--- a/tools/k4aviewer/k4aaudiomanager.cpp ++++ b/tools/k4aviewer/k4aaudiomanager.cpp +@@ -11,7 +11,7 @@ + + // Library headers + // +-#include <libusb.h> ++#include <libusb-1.0/libusb.h> + + // Project headers + // +diff --git a/tools/k4aviewer/k4asoundio_util.h b/tools/k4aviewer/k4asoundio_util.h +index c9c2718..011a76e 100644 +--- a/tools/k4aviewer/k4asoundio_util.h ++++ b/tools/k4aviewer/k4asoundio_util.h +@@ -16,7 +16,7 @@ + // This disables that behavior. + // + #define NOMINMAX +-#include <soundio.h> ++#include <soundio/soundio.h> + + // Project headers + // diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/fix-calibration-c.patch b/vcpkg/ports/azure-kinect-sensor-sdk/fix-calibration-c.patch new file mode 100644 index 0000000..5925191 --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/fix-calibration-c.patch @@ -0,0 +1,70 @@ +diff --git a/src/calibration/calibration.c b/src/calibration/calibration.c +index d37c4e6..ec477f5 100644 +--- a/src/calibration/calibration.c ++++ b/src/calibration/calibration.c +@@ -7,7 +7,6 @@ + // Dependent libraries + #include <k4ainternal/common.h> + #include <cjson/cJSON.h> +-#include <locale.h> //cJSON.h need this set correctly. + + // System dependencies + #include <stdlib.h> +@@ -637,27 +636,6 @@ k4a_result_t calibration_create_from_raw(char *raw_calibration, + + k4a_result_t result = K4A_RESULT_SUCCEEDED; + +-#ifdef _WIN32 +- int previous_thread_locale = -1; +- if (K4A_SUCCEEDED(result)) +- { +- previous_thread_locale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); +- result = K4A_RESULT_FROM_BOOL(previous_thread_locale == _ENABLE_PER_THREAD_LOCALE || +- previous_thread_locale == _DISABLE_PER_THREAD_LOCALE); +- } +- +- if (K4A_SUCCEEDED(result)) +- { +- result = K4A_RESULT_FROM_BOOL(setlocale(LC_ALL, "C") != NULL); +- } +- +-#else // NOT _WIN32 +- +- locale_t thread_locale = newlocale(LC_ALL_MASK, "C", (locale_t)0); +- locale_t previous_locale = uselocale(thread_locale); +- +-#endif +- + if (K4A_SUCCEEDED(result) && depth_calibration != NULL) + { + result = get_camera_calibration(raw_calibration, depth_calibration, "CALIBRATION_CameraLocationD0"); +@@ -680,29 +658,6 @@ k4a_result_t calibration_create_from_raw(char *raw_calibration, + "CALIBRATION_InertialSensorType_Accelerometer"); + } + +-#ifdef _WIN32 +- if (previous_thread_locale == _ENABLE_PER_THREAD_LOCALE || previous_thread_locale == _DISABLE_PER_THREAD_LOCALE) +- { +- if (K4A_FAILED(K4A_RESULT_FROM_BOOL(_configthreadlocale(previous_thread_locale) != -1))) +- { +- // Only set result to failed, don't let this call succeed and clear a failure that might have happened +- // already. +- result = K4A_RESULT_FAILED; +- } +- } +-#else // NOT _WIN32 +- if ((previous_locale != NULL) && (K4A_FAILED(K4A_RESULT_FROM_BOOL(uselocale(previous_locale) != NULL)))) +- { +- // Only set result to failed, don't let this call succeed and clear a failure that might have happened +- // already. +- result = K4A_RESULT_FAILED; +- } +- if (thread_locale) +- { +- freelocale(thread_locale); +- } +-#endif +- + return result; + } + diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/fix-header.patch b/vcpkg/ports/azure-kinect-sensor-sdk/fix-header.patch new file mode 100644 index 0000000..cd8fd9b --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/fix-header.patch @@ -0,0 +1,48 @@ +diff --git a/tools/k4aviewer/k4aaudiochanneldatagraph.h b/tools/k4aviewer/k4aaudiochanneldatagraph.h +index 9aede89..56d2c77 100644 +--- a/tools/k4aviewer/k4aaudiochanneldatagraph.h ++++ b/tools/k4aviewer/k4aaudiochanneldatagraph.h +@@ -7,6 +7,7 @@ + // System headers + // + #include <array> ++#include <string> + + // Library headers + // +diff --git a/tools/k4aviewer/k4aaudiowindow.h b/tools/k4aviewer/k4aaudiowindow.h +index 87b63b3..fcfc86e 100644 +--- a/tools/k4aviewer/k4aaudiowindow.h ++++ b/tools/k4aviewer/k4aaudiowindow.h +@@ -8,6 +8,7 @@ + // + #include <array> + #include <memory> ++#include <string> + + // Library headers + // +diff --git a/tools/k4aviewer/k4amicrophonelistener.cpp b/tools/k4aviewer/k4amicrophonelistener.cpp +index db7b546..8baa05c 100644 +--- a/tools/k4aviewer/k4amicrophonelistener.cpp ++++ b/tools/k4aviewer/k4amicrophonelistener.cpp +@@ -8,6 +8,7 @@ + // System headers + // + #include <regex> ++#include <string> + + // Library headers + // +diff --git a/tools/k4aviewer/perfcounter.h b/tools/k4aviewer/perfcounter.h +index b39e721..c3e28d2 100644 +--- a/tools/k4aviewer/perfcounter.h ++++ b/tools/k4aviewer/perfcounter.h +@@ -13,6 +13,7 @@ + #include <mutex> + #include <numeric> + #include <ratio> ++#include <string> + + // Library headers + // diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/fix-linux.patch b/vcpkg/ports/azure-kinect-sensor-sdk/fix-linux.patch new file mode 100644 index 0000000..0dd8a15 --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/fix-linux.patch @@ -0,0 +1,39 @@ +diff --git a/cmake/k4aCompilerFlags.cmake b/cmake/k4aCompilerFlags.cmake +index e938c907..ccea0a8e 100644 +--- a/cmake/k4aCompilerFlags.cmake ++++ b/cmake/k4aCompilerFlags.cmake +@@ -34,22 +34,16 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + list(APPEND CLANG_ALL_WARNINGS "-Wno-extra-semi-stmt") # Allow semi-colons to be used after #define's + list(APPEND CLANG_ALL_WARNINGS "-Wno-atomic-implicit-seq-cst") # Allow use of __sync_add_and_fetch() atomic + endif() +- set(CLANG_WARNINGS_AS_ERRORS "-Werror") + add_compile_options(${CLANG_ALL_WARNINGS}) +- add_compile_options(${CLANG_WARNINGS_AS_ERRORS}) + elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + set(GNU_ALL_WARNINGS "-Wall" "-Wextra") + list(APPEND GNU_ALL_WARNINGS "-Wno-missing-field-initializers") # Allow c structs without all fields initialized +- set(GNU_WARNINGS_AS_ERRORS "-Werror") + add_compile_options(${GNU_ALL_WARNINGS}) +- add_compile_options(${GNU_WARNINGS_AS_ERRORS}) + elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + set(MSVC_ALL_WARNINGS "/W4" "/wd4200") #Note: allow zero length arrays +- set(MSVC_WARNINGS_AS_ERRORS "/WX") + string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + add_compile_options(${MSVC_ALL_WARNINGS}) +- add_compile_options(${MSVC_WARNINGS_AS_ERRORS}) + else() + message(FATAL_ERROR "Unknown C++ compiler: ${CMAKE_CXX_COMPILER_ID}") + endif() +diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp +index 05264c5f..6cd41d32 100644 +--- a/src/logging/logging.cpp ++++ b/src/logging/logging.cpp +@@ -15,6 +15,7 @@ + #include <stdlib.h> + #include <stdio.h> + #include <string.h> ++#include <stdarg.h> + + // External dependencies + diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/portfile.cmake b/vcpkg/ports/azure-kinect-sensor-sdk/portfile.cmake new file mode 100644 index 0000000..fc43187 --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/portfile.cmake @@ -0,0 +1,53 @@ +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/Azure-Kinect-Sensor-SDK + REF "v${VERSION}" + SHA512 34db933c56fc4c5f38db54a10e0e9cfcfce536d21d1a1c963f33c038d83eb5e90fc28d6360b3c737b54118878e062860c43c2e051f8030b205f640ad1f2d3a94 + HEAD_REF master + PATCHES + fix-builds.patch + fix-linux.patch + fix-calibration-c.patch + fix-build-imgui.patch + fix-header.patch +) + +vcpkg_find_acquire_program(PYTHON3) + +vcpkg_find_acquire_program(PKGCONFIG) +get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) +vcpkg_add_to_path("${PYTHON3_DIR}") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tool BUILD_TOOLS +) + +# .rc file needs windows.h, so do not use PREFER_NINJA here +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + ${FEATURE_OPTIONS} + -DCMAKE_POLICY_DEFAULT_CMP0072=NEW + -DBUILD_EXAMPLES=OFF + -DK4A_SOURCE_LINK=OFF + -DK4A_MTE_VERSION=ON + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/k4a" PACKAGE_NAME "k4a" DO_NOT_DELETE_PARENT_CONFIG_PATH) +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/k4arecord" PACKAGE_NAME "k4arecord") + +if ("tool" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES k4arecorder k4aviewer AzureKinectFirmwareTool AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/azure-kinect-sensor-sdk/vcpkg.json b/vcpkg/ports/azure-kinect-sensor-sdk/vcpkg.json new file mode 100644 index 0000000..b8c0d83 --- /dev/null +++ b/vcpkg/ports/azure-kinect-sensor-sdk/vcpkg.json @@ -0,0 +1,48 @@ +{ + "name": "azure-kinect-sensor-sdk", + "version": "1.4.2", + "description": "Azure Kinect SDK is a cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.", + "homepage": "https://github.com/microsoft/Azure-Kinect-Sensor-SDK", + "license": "MIT", + "supports": "(linux | windows) & !(static & staticcrt)", + "dependencies": [ + "azure-c-shared-utility", + "azure-kinect-depth-engine", + "cjson", + "ebml", + "libjpeg-turbo", + "libsoundio", + "libusb", + { + "name": "libuvc", + "platform": "!windows" + }, + "libyuv", + "matroska", + "spdlog", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tool": { + "description": "Build tools.", + "dependencies": [ + "gl3w", + "glfw3", + { + "name": "imgui", + "features": [ + "glfw-binding", + "opengl3-binding" + ] + } + ] + } + } +} |