Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[treehopper] Fix dependence libusb #35480

Merged
merged 19 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions ports/treehopper/fix-dependences.patch
Original file line number Diff line number Diff line change
@@ -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)
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
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 <CoreFoundation/CFRunLoop.h>
#endif
#ifdef __linux__
-#include "libusb-1.0/libusb.h"
+#include "libusb.h"
#endif
#include <vector>

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 <libusb-1.0/libusb.h>
+#include <libusb.h>
#include "UsbConnection.h"

namespace Treehopper {
11 changes: 6 additions & 5 deletions ports/treehopper/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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")
7 changes: 5 additions & 2 deletions ports/treehopper/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
"dependencies": [
"libusb",
{
"name": "libusb",
"platform": "linux"
},
{
"name": "vcpkg-cmake",
"host": true
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8602,7 +8602,7 @@
},
"treehopper": {
"baseline": "1.11.3",
"port-version": 8
"port-version": 9
},
"triangle": {
"baseline": "1.6",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/treehopper.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "36bae0eb80724eaefece77807a3176fe1a79aaa3",
"version": "1.11.3",
"port-version": 9
},
{
"git-tree": "94c478388c393d8b174b2fd9c4ad0f77805583dc",
"version": "1.11.3",
Expand Down
Loading