diff options
| author | James Xu <kejia.xu@microsoft.com> | 2019-09-10 08:51:46 -0700 |
|---|---|---|
| committer | Curtis J Bezault <curtbezault@gmail.com> | 2019-09-10 08:51:46 -0700 |
| commit | 301beba9d94f93d4bb3fd0a5c1582fac468195ef (patch) | |
| tree | 2d29d0b6e6ddcb94e9d7b39ea77da13eafbf4fba | |
| parent | c3b02026f8bfd5253ded45680872df69e95a81d2 (diff) | |
| download | vcpkg-301beba9d94f93d4bb3fd0a5c1582fac468195ef.tar.gz vcpkg-301beba9d94f93d4bb3fd0a5c1582fac468195ef.zip | |
[hidapi] add new port (#8113)
* add hidapi port
* explicitly fail on non-Windows builds
* remove dlls for static build
| -rw-r--r-- | ports/hidapi/CONTROL | 4 | ||||
| -rw-r--r-- | ports/hidapi/hidapi-config.cmake | 48 | ||||
| -rw-r--r-- | ports/hidapi/portfile.cmake | 34 |
3 files changed, 86 insertions, 0 deletions
diff --git a/ports/hidapi/CONTROL b/ports/hidapi/CONTROL new file mode 100644 index 000000000..80f18b493 --- /dev/null +++ b/ports/hidapi/CONTROL @@ -0,0 +1,4 @@ +Source: hidapi
+Version: 2019-08-30
+Description: A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows.
+Homepage: https://github.com/libusb/hidapi
diff --git a/ports/hidapi/hidapi-config.cmake b/ports/hidapi/hidapi-config.cmake new file mode 100644 index 000000000..126685a89 --- /dev/null +++ b/ports/hidapi/hidapi-config.cmake @@ -0,0 +1,48 @@ +# - try to find HIDAPI library
+# from http://www.signal11.us/oss/hidapi/
+#
+# Cache Variables: (probably not for direct use in your scripts)
+# HIDAPI_INCLUDE_DIR
+# HIDAPI_LIBRARY
+#
+# Non-cache variables you might use in your CMakeLists.txt:
+# HIDAPI_FOUND
+# HIDAPI_INCLUDE_DIRS
+# HIDAPI_LIBRARIES
+#
+# Requires these CMake modules:
+# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# hacking FindHIDAPI.cmake as hidapi-config.cmake
+
+find_library(HIDAPI_LIBRARY
+ NAMES hidapi hidapi-libusb)
+
+find_path(HIDAPI_INCLUDE_DIR
+ NAMES hidapi.h
+ PATH_SUFFIXES
+ hidapi)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HIDAPI
+ DEFAULT_MSG
+ HIDAPI_LIBRARY
+ HIDAPI_INCLUDE_DIR)
+
+if(HIDAPI_FOUND)
+ set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
+
+ set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
+endif()
+
+mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
diff --git a/ports/hidapi/portfile.cmake b/ports/hidapi/portfile.cmake new file mode 100644 index 000000000..93969227d --- /dev/null +++ b/ports/hidapi/portfile.cmake @@ -0,0 +1,34 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libusb/hidapi
+ REF fc677b81951d8facc99bab6b4f0060b5d89e2e15 # use commit from master for windows/hidapi.vcxproj
+ SHA512 8a779c1d4fe83e264046f3193a5cefe2d9765dcde30628767838180b3dec2bdd25c9c1ec9a96b3a7edaf00df7662b4d658f2b57bda67cebc7d7cb4e737cb1f88
+ HEAD_REF master
+)
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ if(TRIPLET_SYSTEM_ARCH MATCHES "arm")
+ message(FATAL_ERROR "ARM builds are currently not supported!")
+ elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ message(FATAL_ERROR "UWP builds are currently not supported!")
+ endif()
+
+ vcpkg_install_msbuild(
+ SOURCE_PATH ${SOURCE_PATH}
+ PROJECT_SUBPATH windows/hidapi.sln
+ INCLUDES_SUBPATH hidapi ALLOW_ROOT_INCLUDES
+ LICENSE_SUBPATH LICENSE-bsd.txt # use BSD license
+ )
+
+ file(COPY
+ ${CMAKE_CURRENT_LIST_DIR}/hidapi-config.cmake
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ endif()
+else()
+ message(FATAL_ERROR "Non-Windows builds are currently not supported!")
+endif()
|
