[libusbp] add new port (#40343)

Co-authored-by: Nick D'Ademo <dademo.n@duerr-ndt.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
Nick D'Ademo 2024-09-09 03:08:44 +08:00 committed by GitHub
parent a01cae2636
commit 4d84733f48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,19 @@
if(NOT TARGET unofficial::libusbp::libusbp)
add_library(unofficial::libusbp::libusbp UNKNOWN IMPORTED)
set_target_properties(unofficial::libusbp::libusbp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/libusbp-1"
)
find_library(libusbp_LIBRARY_RELEASE NAMES usbp-1 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
if(EXISTS "${libusbp_LIBRARY_RELEASE}")
set_property(TARGET unofficial::libusbp::libusbp APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release")
set_target_properties(unofficial::libusbp::libusbp PROPERTIES IMPORTED_LOCATION_RELEASE "${libusbp_LIBRARY_RELEASE}")
endif()
find_library(libusbp_LIBRARY_DEBUG NAMES usbp-1 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
if(EXISTS "${libusbp_LIBRARY_DEBUG}")
set_property(TARGET unofficial::libusbp::libusbp APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
set_target_properties(unofficial::libusbp::libusbp PROPERTIES IMPORTED_LOCATION_DEBUG "${libusbp_LIBRARY_DEBUG}")
endif()
endif()

View File

@ -0,0 +1,39 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(
"${PORT} currently requires the following libraries from the system package manager:
libudev-dev
These can be installed on Ubuntu systems via sudo apt install libudev-dev"
)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pololu/libusbp
REF "${VERSION}"
SHA512 3705ab40b65323eab788592b1b5e1cd94ef1d7ee55fb0f2919013a8bdb488eb83e257623a8be8c5230a74eaea1c0fd8a5926a8a399f0d2f6eebcd82ec0a01c4d
HEAD_REF master
)
vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
configure_file("${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" @ONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")

9
ports/libusbp/usage Normal file
View File

@ -0,0 +1,9 @@
libusbp provides pkg-config modules:
# Library for accessing USB devices.
libusbp
libusbp provides CMake targets:
find_package(unofficial-libusbp CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::libusbp::libusbp)

18
ports/libusbp/vcpkg.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "libusbp",
"version": "1.3.1",
"description": "The Pololu USB Library (also known as libusbp) is a cross-platform C library for accessing USB devices.",
"homepage": "https://github.com/pololu/libusbp",
"license": "MIT",
"supports": "!android & !uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -5220,6 +5220,10 @@
"baseline": "2023-06-21",
"port-version": 1
},
"libusbp": {
"baseline": "1.3.1",
"port-version": 0
},
"libuuid": {
"baseline": "1.0.3",
"port-version": 14

9
versions/l-/libusbp.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "daf8ebcc9f66cd78734a4cc0f7cc9234f925d3f3",
"version": "1.3.1",
"port-version": 0
}
]
}