forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> <[email protected]> | ||
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO libusb/hidapi | ||
REF hidapi-0.10.1 | ||
SHA512 0479706c631775483378070ff7170542725678eabc202a5bd07436c951fd766e01743417999ac3fb2b5436c865f6ace2cfced1f210fa3a3e88c19ceb3bbe0534 | ||
HEAD_REF master | ||
) | ||
|
||
if(VCPKG_TARGET_IS_WINDOWS) | ||
file(READ "${SOURCE_PATH}/windows/hidapi.vcxproj" _contents) | ||
if(${VCPKG_CRT_LINKAGE} STREQUAL "dynamic") | ||
string(REGEX REPLACE | ||
"<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" | ||
"<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" | ||
_contents "${_contents}") | ||
string(REGEX REPLACE | ||
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" | ||
"<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" | ||
_contents "${_contents}") | ||
else() | ||
string(REGEX REPLACE | ||
"<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" | ||
"<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" | ||
_contents "${_contents}") | ||
string(REGEX REPLACE | ||
"<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" | ||
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" | ||
_contents "${_contents}") | ||
endif() | ||
|
||
if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "dynamic") | ||
string(REPLACE | ||
"<ConfigurationType>StaticLibrary</ConfigurationType>" | ||
"<ConfigurationType>DynamicLibrary</ConfigurationType>" | ||
_contents "${_contents}") | ||
else() | ||
string(REPLACE | ||
"<ConfigurationType>DynamicLibrary</ConfigurationType>" | ||
"<ConfigurationType>StaticLibrary</ConfigurationType>" | ||
_contents "${_contents}") | ||
endif() | ||
file(WRITE "${SOURCE_PATH}/windows/hidapi.vcxproj" "${_contents}") | ||
|
||
vcpkg_install_msbuild( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PROJECT_SUBPATH windows/hidapi.vcxproj | ||
INCLUDES_SUBPATH hidapi ALLOW_ROOT_INCLUDES | ||
LICENSE_SUBPATH LICENSE-bsd.txt # use BSD license | ||
) | ||
else() | ||
vcpkg_configure_make( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
) | ||
vcpkg_install_make() | ||
file(COPY "${SOURCE_PATH}/LICENSE-bsd.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/hidapi/copyright") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") | ||
endif() | ||
|
||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/hidapi-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "hidapi", | ||
"version-string": "0.10.1", | ||
"port-version": 2, | ||
"description": "A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows.", | ||
"homepage": "https://github.com/libusb/hidapi", | ||
"supports": "!uwp" | ||
} |