forked from signal11/hidapi
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sensestage/master
report descriptor parser
- Loading branch information
Showing
29 changed files
with
3,078 additions
and
73 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
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,74 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(hidapi) | ||
|
||
set(VERSION_MAJOR "0") | ||
set(VERSION_MINOR "7") | ||
set(VERSION_PATCH "1") | ||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") | ||
|
||
|
||
option(DEBUG_PARSER "verbose parser debuggint output" OFF) | ||
|
||
option(LIBUSB "use libusb backend" OFF) | ||
option(HIDRAW "use hidraw backend (linux/freebsd)" ON) | ||
|
||
option(EXAMPLE_TEST "build test example" ON) | ||
option(EXAMPLE_OSC "build osc example" ON) | ||
|
||
|
||
# add our own cmake-modules | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake_modules/") | ||
|
||
if( DEBUG_PARSER ) | ||
add_definitions( -DDEBUG_PARSER ) | ||
endif() | ||
|
||
# some default libraries | ||
if (NOT WIN32) | ||
find_package(Pthreads) | ||
if (NOT PTHREADS_FOUND) | ||
message(SEND_ERROR "cannot find libpthreads") | ||
endif() | ||
endif() | ||
|
||
|
||
# directories | ||
add_subdirectory(hidapi) | ||
|
||
if(LIBUSB) | ||
add_subdirectory(libusb) | ||
# set( hidapi_source ${hidapi_SOURCE_DIR}/libusb ) | ||
link_directories( ${LIBUSB_1_LIBRARIES} ${PTHREADS_LIBRARIES} ) | ||
endif() | ||
|
||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND HIDRAW) | ||
add_subdirectory(linux) | ||
# set( hidapi_source ${hidapi_SOURCE_DIR}/linux ) | ||
link_directories( ${UDEV_LIBRARIES} ) | ||
endif() | ||
|
||
if(WIN32) | ||
add_subdirectory(windows) | ||
# set( hidapi_source ${hidapi_SOURCE_DIR}/windows ) | ||
#todo: add library dependencies | ||
endif() | ||
if(APPLE) | ||
add_subdirectory(mac) | ||
# set( hidapi_source ${hidapi_SOURCE_DIR}/mac ) | ||
#todo: add library dependencies - TEST | ||
link_directories("-framework IOKit -framework CoreFoundation") | ||
endif() | ||
|
||
add_subdirectory(hidapi_parser) | ||
|
||
# message( "main: hidapi source dir: ${hidapi_source}" ) | ||
|
||
if( EXAMPLE_TEST ) | ||
add_subdirectory(hidtest) | ||
add_subdirectory(hidparsertest) | ||
endif() | ||
|
||
if( EXAMPLE_OSC ) | ||
add_subdirectory(hidapi2osc) | ||
endif() |
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
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
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,43 @@ | ||
# Find iconv library | ||
# | ||
# Author: Eddy Xu <eddyxu at gmail.com> | ||
# | ||
# Released under BSD license | ||
# | ||
# ICONV_INCLUDE_DIRS - where to find iconv.h, etc | ||
# ICONV_LIBRARIES - Lists of libraries when using iconv | ||
# ICONV_FOUND - True if iconv found | ||
|
||
|
||
# Look for the header file | ||
FIND_PATH( ICONV_INCLUDE_DIR NAMES iconv.h ) | ||
MARK_AS_ADVANCED( ICONV_INCLUDE_DIR ) | ||
|
||
# Look for the library | ||
FIND_LIBRARY( ICONV_LIBRARY NAMES iconv ) | ||
MARK_AS_ADVANCED( ICONV_LIBRARY ) | ||
|
||
# Copy the result to output variables | ||
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) | ||
SET(ICONV_FOUND 1) | ||
SET(ICONV_LIBRARIES ${ICONV_LIBRARY}) | ||
SET(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR}) | ||
ELSE(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) | ||
SET(ICONV_FOUND 0) | ||
SET(ICONV_LIBRARIES) | ||
SET(ICONV_INCLUDE_DIRS) | ||
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) | ||
|
||
# Report results | ||
IF(NOT ICONV_FOUND) | ||
SET(ICONV_DIR_MESSAGE | ||
"Iconv was not found. Make sure ICONV_LIBRARY and ICONV_INCLUDE_DIR are | ||
set.") | ||
IF(NOT ICONV_FIND_QUIETLY) | ||
MESSAGE(STATUS ${ICONV_DIR_MESSAGE}) | ||
ELSE(NOT ICONV_FIND_QUIETLY) | ||
IF(ICONV_FIND_REQUIRED) | ||
MESSAGE(FETAL_ERROR ${ICONV_DIR_MESSAGE}) | ||
ENDIF(ICONV_FIND_REQUIRED) | ||
ENDIF(NOT ICONV_FIND_QUIETLY) | ||
ENDIF(NOT ICONV_FOUND) |
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,104 @@ | ||
# - Find the Pthreads library | ||
# This module searches for the Pthreads library (including the | ||
# pthreads-win32 port). | ||
# | ||
# This module defines these variables: | ||
# | ||
# PTHREADS_FOUND | ||
# True if the Pthreads library was found | ||
# PTHREADS_LIBRARY | ||
# The location of the Pthreads library | ||
# PTHREADS_INCLUDE_DIR | ||
# The include directory of the Pthreads library | ||
# PTHREADS_DEFINITIONS | ||
# Preprocessor definitions to define (HAVE_PTHREAD_H is a fairly common | ||
# one) | ||
# | ||
# This module responds to the PTHREADS_EXCEPTION_SCHEME | ||
# variable on Win32 to allow the user to control the | ||
# library linked against. The Pthreads-win32 port | ||
# provides the ability to link against a version of the | ||
# library with exception handling. IT IS NOT RECOMMENDED | ||
# THAT YOU CHANGE PTHREADS_EXCEPTION_SCHEME TO ANYTHING OTHER THAN | ||
# "C" because most POSIX thread implementations do not support stack | ||
# unwinding. | ||
# | ||
# PTHREADS_EXCEPTION_SCHEME | ||
# C = no exceptions (default) | ||
# (NOTE: This is the default scheme on most POSIX thread | ||
# implementations and what you should probably be using) | ||
# CE = C++ Exception Handling | ||
# SE = Structure Exception Handling (MSVC only) | ||
# | ||
|
||
# | ||
# Define a default exception scheme to link against | ||
# and validate user choice. | ||
# | ||
|
||
IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) | ||
SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H) | ||
SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) | ||
SET(PTHREADS_LIBRARIES ${PTHREADS_LIBRARY}) | ||
SET(FOUND_PTHREADS TRUE) | ||
ENDIF() | ||
|
||
IF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) | ||
# Assign default if needed | ||
SET(PTHREADS_EXCEPTION_SCHEME "C") | ||
ELSE(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) | ||
# Validate | ||
IF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND | ||
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND | ||
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") | ||
|
||
MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed") | ||
|
||
ENDIF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND | ||
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND | ||
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") | ||
|
||
IF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") | ||
MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC") | ||
ENDIF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") | ||
|
||
ENDIF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) | ||
|
||
# | ||
# Find the header file | ||
# | ||
FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h) | ||
|
||
# | ||
# Find the library | ||
# | ||
SET(names) | ||
IF(MSVC) | ||
SET(names | ||
pthreadV${PTHREADS_EXCEPTION_SCHEME}2 | ||
pthread | ||
) | ||
ELSEIF(MINGW) | ||
SET(names | ||
pthreadG${PTHREADS_EXCEPTION_SCHEME}2 | ||
pthread | ||
) | ||
ELSE(MSVC) # Unix / Cygwin / Apple / Etc. | ||
SET(names pthread) | ||
ENDIF(MSVC) | ||
|
||
FIND_LIBRARY(PTHREADS_LIBRARY NAMES ${names} | ||
DOC "The Portable Threads Library") | ||
|
||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pthreads DEFAULT_MSG | ||
PTHREADS_LIBRARY PTHREADS_INCLUDE_DIR) | ||
|
||
IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) | ||
SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H) | ||
SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) | ||
SET(PTHREADS_LIBRARIES ${PTHREADS_LIBRARY}) | ||
ENDIF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) | ||
|
||
MARK_AS_ADVANCED(PTHREADS_INCLUDE_DIR) | ||
MARK_AS_ADVANCED(PTHREADS_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,53 @@ | ||
# razor-de: Configure libudev environment | ||
# | ||
# UDEV_FOUND - system has a libudev | ||
# UDEV_INCLUDE_DIR - where to find header files | ||
# UDEV_LIBRARIES - the libraries to link against udev | ||
# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API | ||
# | ||
# copyright (c) 2011 Petr Vanek <[email protected]> | ||
# Redistribution and use is allowed according to the terms of the BSD license. | ||
# | ||
|
||
FIND_PATH( | ||
UDEV_INCLUDE_DIR | ||
libudev.h | ||
/usr/include | ||
/usr/local/include | ||
${UDEV_PATH_INCLUDES} | ||
) | ||
|
||
FIND_LIBRARY( | ||
UDEV_LIBRARIES | ||
NAMES udev libudev | ||
PATHS | ||
/usr/lib${LIB_SUFFIX} | ||
/usr/local/lib${LIB_SUFFIX} | ||
${UDEV_PATH_LIB} | ||
) | ||
|
||
IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR) | ||
SET(UDEV_FOUND "YES") | ||
execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE) | ||
# retvale is 0 of the condition is "true" so we need to negate the value... | ||
if (UDEV_STABLE) | ||
set(UDEV_STABLE 0) | ||
else (UDEV_STABLE) | ||
set(UDEV_STABLE 1) | ||
endif (UDEV_STABLE) | ||
message(STATUS "libudev stable: ${UDEV_STABLE}") | ||
ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR) | ||
|
||
IF (UDEV_FOUND) | ||
MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}") | ||
MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}") | ||
ELSE (UDEV_FOUND) | ||
MESSAGE(STATUS "UDev not found.") | ||
MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include") | ||
MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}") | ||
MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib") | ||
MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}") | ||
IF (UDev_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find UDev library") | ||
ENDIF (UDev_FIND_REQUIRED) | ||
ENDIF (UDEV_FOUND) |
Oops, something went wrong.