Skip to content

Commit 1da552a

Browse files
committed
[usbipdcpp] New port: A C++ library for creating usbip servers
1 parent d3a1e8c commit 1da552a

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

ports/usbipdcpp/portfile.cmake

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO yunsmall/usbipdcpp
4+
REF v0.0.1
5+
SHA512 4e22ec6cb9a200d2b0d52239a04f46df2eda9b2bfb69859f53ab4192c49dafe079133298872a87b3e4dbcccd3b762b900573a108b67dc7e49ccd4710ca3926ef
6+
HEAD_REF main
7+
)
8+
9+
set(OPTIONS
10+
-DUSBIPDCPP_BUILD_EXAMPLES=OFF
11+
-DUSBIPDCPP_BUILD_TESTS=OFF
12+
)
13+
14+
if("coroutine" IN_LIST FEATURES)
15+
list(APPEND OPTIONS -DUSBIPDCPP_USE_COROUTINE=ON)
16+
else()
17+
list(APPEND OPTIONS -DUSBIPDCPP_USE_COROUTINE=OFF)
18+
endif()
19+
20+
if("libusb" IN_LIST FEATURES)
21+
list(APPEND OPTIONS -DUSBIPDCPP_BUILD_LIBUSB_COMPONENTS=ON)
22+
else()
23+
list(APPEND OPTIONS -DUSBIPDCPP_BUILD_LIBUSB_COMPONENTS=OFF)
24+
endif()
25+
26+
vcpkg_find_acquire_program(PKGCONFIG)
27+
28+
vcpkg_backup_env_variables(VARS PKG_CONFIG_PATH)
29+
vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}${path_suffix}/lib/pkgconfig")
30+
31+
list(APPEND OPTIONS -DPKG_CONFIG_EXECUTABLE=${PKGCONFIG})
32+
33+
vcpkg_cmake_configure(
34+
SOURCE_PATH "${SOURCE_PATH}"
35+
OPTIONS ${OPTIONS}
36+
)
37+
38+
vcpkg_restore_env_variables(VARS PKG_CONFIG_PATH)
39+
40+
vcpkg_cmake_install()
41+
42+
vcpkg_cmake_config_fixup(
43+
PACKAGE_NAME usbipdcpp
44+
CONFIG_PATH lib/cmake/usbipdcpp
45+
)
46+
47+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
48+
49+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
50+
51+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

ports/usbipdcpp/usage

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The package usbipdcpp provides CMake targets:
2+
3+
find_package(usbipdcpp CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE usbipdcpp::usbipdcpp)
5+
6+
Features:
7+
- coroutine: Use C++20 coroutine-based implementation
8+
- libusb: Build libusb-based server components for physical USB device forwarding
9+
10+
Install with features:
11+
12+
vcpkg install usbipdcpp[coroutine]
13+
vcpkg install usbipdcpp[libusb]
14+
vcpkg install usbipdcpp[coroutine,libusb]
15+
16+
For libusb support in CMake:
17+
18+
find_package(usbipdcpp CONFIG REQUIRED COMPONENTS libusb)
19+
target_link_libraries(main PRIVATE usbipdcpp::usbipdcpp usbipdcpp::libusb)

ports/usbipdcpp/vcpkg.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "usbipdcpp",
3+
"version": "0.0.1",
4+
"description": "A C++ library for creating usbip servers",
5+
"homepage": "https://github.com/yunsmall/usbipdcpp",
6+
"license": "Apache-2.0",
7+
"dependencies": [
8+
"asio",
9+
"spdlog",
10+
{
11+
"name": "vcpkg-cmake",
12+
"host": true
13+
},
14+
{
15+
"name": "vcpkg-cmake-config",
16+
"host": true
17+
}
18+
],
19+
"features": {
20+
"coroutine": {
21+
"description": "Use C++20 coroutine-based implementation"
22+
},
23+
"libusb": {
24+
"description": "Build libusb-based server components for physical USB device forwarding",
25+
"dependencies": [
26+
"libusb"
27+
]
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)