|
1 |
| -cmake_minimum_required(VERSION 3.0) |
2 |
| - |
3 |
| -project(hidapi VERSION 0.7.1) |
4 |
| - |
5 |
| -option(HID_DEBUG_PARSER "verbose parser debugging output" OFF) |
6 |
| - |
7 |
| -# option(LIBUSB "use libusb backend" OFF) |
8 |
| -# option(HIDRAW "use hidraw backend (linux/freebsd)" ON) |
9 |
| - |
10 |
| -option(HID_EXAMPLE_TEST "build test example" OFF) |
| 1 | +cmake_minimum_required(VERSION 3.6) |
| 2 | +project(hidapi_tools) |
11 | 3 | option(HID_EXAMPLE_OSC "build osc example" OFF)
|
12 |
| - |
13 | 4 | option(HID_INSTALL_HUT "install hid usage tables" ON)
|
14 |
| - |
15 |
| -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
16 |
| - set(HIDAPI "default" CACHE STRING "HID API to use (one of {default,hidraw,libusb})") |
17 |
| -elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
18 |
| - set(HIDAPI "libusb") |
19 |
| -endif() |
20 |
| - |
21 |
| -# add our own cmake-modules |
22 |
| -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake_modules/") |
23 |
| - |
24 |
| -if( HID_DEBUG_PARSER ) |
25 |
| - add_definitions( -DDEBUG_PARSER ) |
26 |
| -endif() |
27 |
| - |
28 |
| -# some default libraries |
29 |
| -if (NOT WIN32) |
30 |
| - find_package(Pthreads) |
31 |
| - if (NOT PTHREADS_FOUND) |
32 |
| - message(SEND_ERROR "cannot find libpthreads") |
33 |
| - endif() |
34 |
| -endif() |
35 |
| - |
36 |
| - |
37 |
| -# directories |
38 |
| -add_subdirectory(hidapi) |
39 |
| - |
40 |
| -if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
41 |
| - add_definitions( -DLINUX_FREEBSD ) |
42 |
| - if(HIDAPI STREQUAL "default") |
43 |
| - set( HIDAPI hidraw ) |
44 |
| - endif() |
45 |
| - |
46 |
| - if(NOT HIDAPI MATCHES "^(libusb|hidraw)$") |
47 |
| - message(WARNING "Unrecognised hid API: ${HIDAPI}") |
48 |
| - endif() |
49 |
| - |
50 |
| - if (HIDAPI STREQUAL hidraw) |
51 |
| - add_subdirectory(linux) |
52 |
| - # set( hidapi_source ${hidapi_SOURCE_DIR}/linux ) |
53 |
| - link_directories( ${UDEV_LIBRARIES} ) |
54 |
| - elseif (HIDAPI STREQUAL libusb) |
55 |
| - add_subdirectory(libusb) |
56 |
| - # set( hidapi_source ${hidapi_SOURCE_DIR}/libusb ) |
57 |
| - link_directories( ${LIBUSB_1_LIBRARIES} ${PTHREADS_LIBRARIES} ) |
58 |
| - endif() |
59 |
| - |
60 |
| -endif() |
61 |
| - |
62 |
| - |
63 |
| -if(WIN32) |
64 |
| - add_definitions( -DWIN32 ) |
65 |
| - add_subdirectory(windows) |
66 |
| -# set( hidapi_source ${hidapi_SOURCE_DIR}/windows ) |
67 |
| - #todo: add library dependencies |
68 |
| -endif() |
69 |
| - |
70 |
| -if(APPLE) |
71 |
| - add_definitions( -DAPPLE ) |
72 |
| - add_subdirectory(mac) |
73 |
| -# set( hidapi_source ${hidapi_SOURCE_DIR}/mac ) |
74 |
| - #todo: add library dependencies - TEST |
75 |
| - find_library(IOKIT_LIBRARY IOKit ) |
76 |
| - find_library(COREFOUNDATION_LIBRARY CoreFoundation ) |
77 |
| - mark_as_advanced (COREFOUNDATION_LIBRARY |
78 |
| - IOKIT_LIBRARY) |
79 |
| - set(EXTRA_LIBS ${COREFOUNDATION_LIBRARY} ${IOKIT_LIBRARY}) |
80 |
| - #link_directories("-framework IOKit -framework CoreFoundation") |
81 |
| -endif() |
| 5 | +find_package(hidapi REQUIRED) |
82 | 6 |
|
83 | 7 | add_subdirectory(hidapi_parser)
|
84 | 8 |
|
85 |
| -# message( "main: hidapi source dir: ${hidapi_source}" ) |
86 | 9 |
|
87 |
| -if( HID_EXAMPLE_TEST ) |
88 |
| - add_subdirectory(hidtest) |
| 10 | +if( HID_PARSER_TEST ) |
89 | 11 | add_subdirectory(hidparsertest)
|
90 |
| - if(APPLE) |
91 |
| - add_subdirectory(hidtestosx) |
92 |
| - endif() |
93 |
| - if(WIN32) |
94 |
| - add_subdirectory(hidtestwindows) |
95 |
| - endif() |
96 | 12 | endif()
|
97 | 13 |
|
98 | 14 | if( HID_EXAMPLE_OSC )
|
99 | 15 | add_subdirectory(hidapi2osc)
|
100 | 16 | endif()
|
101 | 17 |
|
102 |
| -if( HID_DEBUG_PARSER OR HID_INSTALL_HUT ) |
103 |
| - # provisional to avoid having to commit to sc master while the HID submodule |
104 |
| - # is not final/added to master |
105 |
| - # the sc-settings for cmake_install_prefix and scappauxresourcesdir are not |
106 |
| - # visible in this scope |
| 18 | +if( HID_INSTALL_HUT ) |
107 | 19 | if(APPLE)
|
108 | 20 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
109 | 21 | SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install")
|
|
0 commit comments