From f30434939d5516ce764c549ab04e3d23d312180a Mon Sep 17 00:00:00 2001 From: Frank <65999885+FrankXie05@users.noreply.github.com> Date: Fri, 22 Dec 2023 08:11:21 +0800 Subject: [PATCH] [treehopper] Fix dependency handling of libusb (#35480) --- ports/treehopper/fix-dependences.patch | 42 ++++++++++++++++++++++++++ ports/treehopper/portfile.cmake | 11 ++++--- ports/treehopper/vcpkg.json | 9 ++++-- scripts/ci.baseline.txt | 1 - versions/baseline.json | 2 +- versions/t-/treehopper.json | 5 +++ 6 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 ports/treehopper/fix-dependences.patch diff --git a/ports/treehopper/fix-dependences.patch b/ports/treehopper/fix-dependences.patch new file mode 100644 index 00000000000000..7fdd26a4553832 --- /dev/null +++ b/ports/treehopper/fix-dependences.patch @@ -0,0 +1,42 @@ +diff --git a/C++/API/CMakeLists.txt b/C++/API/CMakeLists.txt +index 8537305..db3d29b 100644 +--- a/C++/API/CMakeLists.txt ++++ b/C++/API/CMakeLists.txt +@@ -37,7 +37,10 @@ if(APPLE) + find_library(IOKIT IOKit) + target_link_libraries(treehopper pthread ${CORE_FOUNDATION} ${IOKIT}) + elseif(UNIX) +- target_link_libraries(treehopper usb-1.0 pthread) ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0) ++ ++ target_link_libraries(treehopper PRIVATE PkgConfig::libusb pthread) + elseif(WIN32) + target_link_libraries(treehopper winusb setupapi) + endif(APPLE) +diff --git a/C++/API/inc/ConnectionService.h b/C++/API/inc/ConnectionService.h +index 66d338e..12a0192 100644 +--- a/C++/API/inc/ConnectionService.h ++++ b/C++/API/inc/ConnectionService.h +@@ -8,7 +8,7 @@ + #include + #endif + #ifdef __linux__ +-#include "libusb-1.0/libusb.h" ++#include "libusb.h" + #endif + #include + +diff --git a/C++/API/inc/LibUsbConnection.h b/C++/API/inc/LibUsbConnection.h +index b6d5198..e9cd29e 100644 +--- a/C++/API/inc/LibUsbConnection.h ++++ b/C++/API/inc/LibUsbConnection.h +@@ -6,7 +6,7 @@ + + #include "Treehopper.h" + +-#include ++#include + #include "UsbConnection.h" + + namespace Treehopper { diff --git a/ports/treehopper/portfile.cmake b/ports/treehopper/portfile.cmake index 3b6cfa9c196d39..d2b263386875ac 100644 --- a/ports/treehopper/portfile.cmake +++ b/ports/treehopper/portfile.cmake @@ -3,9 +3,12 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO treehopper-electronics/treehopper-sdk - REF 1.11.3 + REF "${VERSION}" SHA512 65b748375b798787c8b59f9657151f340920c939c3f079105b9b78f4e3b775125598106c6dfa4feba111a64d30f007003a70110ac767802a7dd1127a25c9fb14 - HEAD_REF master) + HEAD_REF master + PATCHES + fix-dependences.patch +) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}/C++/API/" @@ -18,6 +21,4 @@ vcpkg_cmake_config_fixup() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(INSTALL "${SOURCE_PATH}/C++/API/inc/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/Treehopper/") - -file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) - +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/treehopper/vcpkg.json b/ports/treehopper/vcpkg.json index 42d19e0f68220b..fdf185fb78a49c 100644 --- a/ports/treehopper/vcpkg.json +++ b/ports/treehopper/vcpkg.json @@ -1,12 +1,15 @@ { "name": "treehopper", "version": "1.11.3", - "port-version": 8, + "port-version": 9, "description": "Treehopper connects the physical world to your computer, tablet, or smartphone.", "homepage": "https://treehopper.io", - "supports": "!staticcrt", + "supports": "!staticcrt & !uwp", "dependencies": [ - "libusb", + { + "name": "libusb", + "platform": "linux" + }, { "name": "vcpkg-cmake", "host": true diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index bbf6c962993520..ff121cb1bea4e0 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1162,7 +1162,6 @@ torch-th:arm64-uwp=fail torch-th:x64-android=fail torch-th:x64-uwp=fail torch-th:x64-windows-static=fail -treehopper:x64-linux=fail turbobase64:arm-neon-android=fail tvision:arm-neon-android=fail tvision:arm64-android=fail diff --git a/versions/baseline.json b/versions/baseline.json index bf3309ecd086eb..d4a5e35e5fdf37 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8602,7 +8602,7 @@ }, "treehopper": { "baseline": "1.11.3", - "port-version": 8 + "port-version": 9 }, "triangle": { "baseline": "1.6", diff --git a/versions/t-/treehopper.json b/versions/t-/treehopper.json index 8569bae3611fb5..06616ffa10d147 100644 --- a/versions/t-/treehopper.json +++ b/versions/t-/treehopper.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "145e9145dba553063f0483909603c6369c5a4e63", + "version": "1.11.3", + "port-version": 9 + }, { "git-tree": "94c478388c393d8b174b2fd9c4ad0f77805583dc", "version": "1.11.3",