aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libusbp
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libusbp')
-rw-r--r--vcpkg/ports/libusbp/Config.cmake.in19
-rw-r--r--vcpkg/ports/libusbp/portfile.cmake39
-rw-r--r--vcpkg/ports/libusbp/usage9
-rw-r--r--vcpkg/ports/libusbp/vcpkg.json18
4 files changed, 85 insertions, 0 deletions
diff --git a/vcpkg/ports/libusbp/Config.cmake.in b/vcpkg/ports/libusbp/Config.cmake.in
new file mode 100644
index 0000000..172e08b
--- /dev/null
+++ b/vcpkg/ports/libusbp/Config.cmake.in
@@ -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()
diff --git a/vcpkg/ports/libusbp/portfile.cmake b/vcpkg/ports/libusbp/portfile.cmake
new file mode 100644
index 0000000..5758dbb
--- /dev/null
+++ b/vcpkg/ports/libusbp/portfile.cmake
@@ -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")
diff --git a/vcpkg/ports/libusbp/usage b/vcpkg/ports/libusbp/usage
new file mode 100644
index 0000000..dce5153
--- /dev/null
+++ b/vcpkg/ports/libusbp/usage
@@ -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)
diff --git a/vcpkg/ports/libusbp/vcpkg.json b/vcpkg/ports/libusbp/vcpkg.json
new file mode 100644
index 0000000..031395e
--- /dev/null
+++ b/vcpkg/ports/libusbp/vcpkg.json
@@ -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
+ }
+ ]
+}