Skip to content

Commit fa5ccae

Browse files
MonicaLiu0311Monica
authored andcommitted
[libusb] Fix usage (microsoft#35498)
* fix usage * update version * redo x64-windows.cmake * resolve conflicts * updaet git-tree * fix downstream * update version * fix libirecovery * update git-tree * fix pkg_check_modules * update git-tree * fix libfreenect2 * update version * fix libuvc * update version * fix libuvc patch * update git-tree * fix libuvc build_fix.patch * update git-tree * format * update git-tree * undo supports * update git-tree * fix azure-kinect-sensor-sdk * update version * add pkg-config.exe * update git-tree * disable build examples and tests * update git-tree --------- Co-authored-by: Monica <[email protected]>
1 parent 0d5b42e commit fa5ccae

31 files changed

+181
-85
lines changed

ports/azure-kinect-sensor-sdk/fix-builds.patch

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 4f002b5..d48f3f2 100644
2+
index 4f002b5..dd9b1df 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
55
@@ -27,8 +27,6 @@ option(K4A_BUILD_DOCS "Build K4A doxygen documentation" OFF)
@@ -11,7 +11,7 @@ index 4f002b5..d48f3f2 100644
1111
# Set the project version
1212
include(K4AProjectVersion)
1313

14-
@@ -100,6 +98,43 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL
14+
@@ -100,6 +98,42 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL
1515
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
1616
endif()
1717

@@ -34,14 +34,13 @@ index 4f002b5..d48f3f2 100644
3434
+add_definitions(-DMATROSKA_VERSION=2)
3535
+find_package(libsoundio CONFIG REQUIRED)
3636
+if (NOT WIN32)
37-
+ find_package(libusb CONFIG REQUIRED)
3837
+ find_package(libuvc CONFIG REQUIRED)
3938
+ add_library(libuvc::libuvc ALIAS LibUVC::UVCStatic)
4039
+ find_package(OpenSSL REQUIRED)
4140
+ find_package(ZLIB REQUIRED)
42-
+else()
43-
+ find_library(LibUSB libusb-1.0 REQUIRED)
4441
+endif()
42+
+FIND_PACKAGE(PkgConfig REQUIRED)
43+
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
4544
+find_package(libyuv CONFIG REQUIRED)
4645
+find_package(spdlog CONFIG REQUIRED)
4746
+if (BUILD_TOOLS)
@@ -295,7 +294,7 @@ index e4a696e..6ee6696 100644
295294
k4ainternal::deloader)
296295

297296
diff --git a/src/usbcommand/CMakeLists.txt b/src/usbcommand/CMakeLists.txt
298-
index f75bd55..5403216 100644
297+
index f75bd55..7130728 100644
299298
--- a/src/usbcommand/CMakeLists.txt
300299
+++ b/src/usbcommand/CMakeLists.txt
301300
@@ -12,8 +12,8 @@ target_include_directories(k4a_usb_cmd PUBLIC
@@ -305,7 +304,7 @@ index f75bd55..5403216 100644
305304
- azure::aziotsharedutil
306305
- LibUSB::LibUSB
307306
+ aziotsharedutil
308-
+ ${LibUSB}
307+
+ PkgConfig::libusb
309308
k4ainternal::allocator
310309
k4ainternal::image
311310
k4ainternal::logging)
@@ -585,7 +584,7 @@ index c544e1e..9489bf8 100644
585584
k4ainternal::logging
586585
k4ainternal::utcommon)
587586
diff --git a/tools/k4aviewer/CMakeLists.txt b/tools/k4aviewer/CMakeLists.txt
588-
index 98578c0..6ab38d9 100644
587+
index 98578c0..244c867 100644
589588
--- a/tools/k4aviewer/CMakeLists.txt
590589
+++ b/tools/k4aviewer/CMakeLists.txt
591590
@@ -60,10 +60,11 @@ set(EXTERNAL_LIBRARIES
@@ -595,7 +594,7 @@ index 98578c0..6ab38d9 100644
595594
- LibUSB::LibUSB
596595
- libyuv::libyuv
597596
- glfw::glfw
598-
+ ${LibUSB}
597+
+ PkgConfig::libusb
599598
+ yuv
600599
+ glfw
601600
${OPENGL_LIBRARIES}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set(VERSION 1.4.1)
22
vcpkg_from_github(
33
OUT_SOURCE_PATH SOURCE_PATH
44
REPO microsoft/Azure-Kinect-Sensor-SDK
5-
REF v${VERSION}
5+
REF "v${VERSION}"
66
SHA512 ef94c072caae43b0a105b192013e09082d267d4064e6676fac981b52e7576a663f59fcb53f0afe66b425ef2cea0cb3aa224ff7be6485c0b5543ff9cdabd82d4d
77
HEAD_REF master
88
PATCHES
@@ -14,6 +14,7 @@ vcpkg_from_github(
1414
)
1515

1616
vcpkg_find_acquire_program(PYTHON3)
17+
vcpkg_find_acquire_program(PKGCONFIG)
1718
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
1819
vcpkg_add_to_path("${PYTHON3_DIR}")
1920

@@ -27,7 +28,9 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
2728
vcpkg_cmake_configure(
2829
SOURCE_PATH "${SOURCE_PATH}"
2930
DISABLE_PARALLEL_CONFIGURE
30-
OPTIONS ${FEATURE_OPTIONS}
31+
OPTIONS
32+
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
33+
${FEATURE_OPTIONS}
3134
-DK4A_SOURCE_LINK=OFF
3235
-DK4A_MTE_VERSION=ON
3336
-DBUILD_EXAMPLES=OFF
@@ -88,4 +91,4 @@ else()
8891
endif()
8992

9093
# Handle copyright
91-
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
94+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

ports/azure-kinect-sensor-sdk/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-kinect-sensor-sdk",
33
"version": "1.4.1",
4-
"port-version": 5,
4+
"port-version": 6,
55
"description": "Azure Kinect SDK is a cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.",
66
"homepage": "https://github.com/microsoft/Azure-Kinect-Sensor-SDK",
77
"supports": "linux | windows",

ports/dv-processing/portfile.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ vcpkg_check_features(
2424
tools ENABLE_UTILITIES
2525
)
2626

27+
vcpkg_find_acquire_program(PKGCONFIG)
28+
2729
set(VCPKG_BUILD_TYPE release) # no lib binaries
2830
vcpkg_cmake_configure(
2931
SOURCE_PATH "${SOURCE_PATH}"
3032
DISABLE_PARALLEL_CONFIGURE # writes to include/dv-processing/version.hpp
3133
OPTIONS
34+
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
3235
${FEATURE_OPTIONS}
3336
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
3437
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON

ports/dv-processing/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "dv-processing",
33
"version": "1.7.9",
4+
"port-version": 1,
45
"description": "Generic algorithms for event cameras. (C++20 required.)",
56
"homepage": "https://gitlab.com/inivation/dv/dv-processing",
67
"license": "Apache-2.0",

ports/libcaer/fix-libusb.diff

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,62 @@
11
diff --git a/cmakemod/libcaerConfig.cmake.in b/cmakemod/libcaerConfig.cmake.in
2-
index cdf9f88..475d543 100644
2+
index cdf9f88..f0a17ba 100644
33
--- a/cmakemod/libcaerConfig.cmake.in
44
+++ b/cmakemod/libcaerConfig.cmake.in
5-
@@ -21,6 +21,12 @@
5+
@@ -21,6 +21,10 @@
66
CMAKE_POLICY(PUSH)
77
CMAKE_POLICY(VERSION 3.10)
88

99
+include(CMakeFindDependencyMacro)
10-
+if(NOT "@CC_MSVC@")
11-
+ find_dependency(PkgConfig)
12-
+ pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
13-
+endif()
10+
+find_dependency(PkgConfig)
11+
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
1412
+
1513
INCLUDE(@PACKAGE_export_destination@/libcaer-exports.cmake)
1614
SET(libcaer_INCLUDE_DIRS @PACKAGE_include_dirs@)
1715

16+
diff --git a/CMakeLists.txt b/CMakeLists.txt
17+
index 3ce94a6..f03d7ae 100644
18+
--- a/CMakeLists.txt
19+
+++ b/CMakeLists.txt
20+
@@ -52,16 +52,12 @@ MESSAGE(STATUS "Base libraries: ${BASE_LIBS}")
21+
INCLUDE(FindPkgConfig)
22+
23+
# Required: basic USB devices support
24+
-IF(CC_MSVC)
25+
- FIND_PACKAGE(libusb CONFIG REQUIRED)
26+
-ELSE()
27+
- PKG_CHECK_MODULES(
28+
- libusb
29+
- REQUIRED
30+
- IMPORTED_TARGET
31+
- libusb-1.0>=1.0.17)
32+
- SET(LIBCAER_PKGCONFIG_REQUIRES_PRIVATE "libusb-1.0 >= 1.0.17")
33+
-ENDIF()
34+
+PKG_CHECK_MODULES(
35+
+ libusb
36+
+ REQUIRED
37+
+ IMPORTED_TARGET
38+
+ libusb-1.0>=1.0.17)
39+
+SET(LIBCAER_PKGCONFIG_REQUIRES_PRIVATE "libusb-1.0 >= 1.0.17")
40+
41+
# Optional: serial devices support
42+
IF(ENABLE_SERIALDEV)
43+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
44+
index 0ef4ac7..6f70a26 100644
45+
--- a/src/CMakeLists.txt
46+
+++ b/src/CMakeLists.txt
47+
@@ -49,12 +49,11 @@ ENDIF()
48+
49+
IF(CC_MSVC)
50+
LIST(APPEND LIBCAER_SOURCES ../thirdparty/simple-stdatomic/stdatomic.c)
51+
- INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
52+
- LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE ${LIBUSB_LIBRARIES})
53+
-ELSE()
54+
- LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE PkgConfig::libusb)
55+
ENDIF()
56+
57+
+LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE PkgConfig::libusb)
58+
+
59+
+
60+
# Set full RPATH
61+
SET(CMAKE_INSTALL_RPATH ${USER_LOCAL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
62+

ports/libcaer/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "libcaer",
33
"version": "3.3.15",
4+
"port-version": 1,
45
"description": "Minimal C library to access, configure and get data from neuromorphic sensors and processors.",
56
"homepage": "https://gitlab.com/inivation/dv/libcaer",
67
"license": "BSD-2-Clause AND Apache-2.0",
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 1e0d192..aedc576 100644
2+
index 3648fb5..43c3d28 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -90,7 +90,7 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
5+
@@ -91,7 +91,7 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
66

77
# dependencies
88
FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found
99
-FIND_PACKAGE(LibUSB REQUIRED)
10-
+FIND_PACKAGE(libusb CONFIG REQUIRED)
10+
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
1111

1212
# Add includes
1313
INCLUDE_DIRECTORIES(
14-
@@ -98,7 +98,7 @@ INCLUDE_DIRECTORIES(
14+
@@ -99,7 +99,7 @@ INCLUDE_DIRECTORIES(
1515
"${MY_DIR}/include/internal"
1616
${PROJECT_BINARY_DIR} # for generated headers
1717
${LIBFREENECT2_THREADING_INCLUDE_DIR}
1818
- ${LibUSB_INCLUDE_DIRS}
19-
+ ${LIBUSB_INCLUDE_DIRS}
19+
+ ${libusb_INCLUDE_DIRS}
2020
)
2121

2222
SET(RESOURCES_INC_FILE "${PROJECT_BINARY_DIR}/resources.inc.h")
23-
@@ -154,7 +154,7 @@ SET(SOURCES
23+
@@ -157,7 +157,7 @@ SET(SOURCES
2424
)
2525

2626
SET(LIBRARIES
2727
- ${LibUSB_LIBRARIES}
28-
+ ${LIBUSB_LIBRARIES}
28+
+ PkgConfig::libusb
2929
${LIBFREENECT2_THREADING_LIBRARIES}
3030
)
3131

ports/libfreenect2/portfile.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,26 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
2121
openni2 BUILD_OPENNI2_DRIVER
2222
)
2323

24+
vcpkg_find_acquire_program(PKGCONFIG)
25+
26+
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
27+
set(path_suffix "/debug")
28+
endif()
29+
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
30+
set(path_suffix "")
31+
endif()
32+
vcpkg_backup_env_variables(VARS PKG_CONFIG_PATH)
33+
vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}${path_suffix}/lib/pkgconfig")
34+
2435
vcpkg_cmake_configure(
2536
SOURCE_PATH "${SOURCE_PATH}"
2637
OPTIONS
38+
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
2739
-DENABLE_CUDA=OFF
2840
-DBUILD_EXAMPLES=OFF
2941
${FEATURE_OPTIONS}
3042
)
43+
vcpkg_restore_env_variables(VARS PKG_CONFIG_PATH)
3144

3245
vcpkg_cmake_install()
3346

ports/libfreenect2/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "libfreenect2",
33
"version": "0.2.1",
4+
"port-version": 1,
45
"description": "Open source drivers for the Kinect for Windows v2 device",
56
"homepage": "https://github.com/OpenKinect/libfreenect2",
67
"license": "GPL-2.0-only",

0 commit comments

Comments
 (0)