Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (53 sloc) 1.776 kb
11f3179 @edorfaus Added a build system based on CMake
authored
1 cmake_minimum_required(VERSION 2.8)
2 set(CMAKE_USER_MAKE_RULES_OVERRIDE
3 "${CMAKE_CURRENT_SOURCE_DIR}/default_c_flags.cmake"
4 )
5 project(TEMPered C)
6
7 include(CMakeDependentOption)
f5a5330 @opoplawski Add install commands
opoplawski authored
8 include(GNUInstallDirs)
11f3179 @edorfaus Added a build system based on CMake
authored
9
10 option(BUILD_HIDAPI_SHARED "Build with shared version of HIDAPI" ON)
11
12 option(BUILD_SHARED_LIB "Build shared version of tempered library" ON)
13 option(BUILD_STATIC_LIB "Build static version of tempered library" OFF)
14
15 cmake_dependent_option(
16 BUILD_UTILITIES "Build the utilities" ON
17 "( BUILD_SHARED_LIB OR BUILD_STATIC_LIB )" OFF
18 )
19 cmake_dependent_option(
20 UTILS_USE_SHARED_LIB "Utilities use the shared tempered library" ON
21 "BUILD_UTILITIES;BUILD_SHARED_LIB" OFF
22 )
23
24 find_path(HIDAPI_HEADER_DIR hidapi.h
25 PATHS ../hidapi ../hidapi.git
26 PATH_SUFFIXES hidapi
27 DOC "The location of HIDAPI's header file"
28 )
29
30 if (BUILD_HIDAPI_SHARED)
31 find_library(HIDAPI_LIB NAMES hidapi-hidraw hidapi-libusb
32 PATHS ../hidapi ../hidapi.git
885b6a7 @edorfaus Updated the library autodetection to work with libusb in current HIDAPI ...
authored
33 PATH_SUFFIXES linux libusb mac
11f3179 @edorfaus Added a build system based on CMake
authored
34 DOC "The location of the HIDAPI shared library file"
35 )
36 set(HIDAPI_STATIC_OBJECT)
37 set(HIDAPI_LINK_LIBS ${HIDAPI_LIB})
38 else()
39 set(HIDAPI_LIB)
40 find_file(HIDAPI_OBJECT NAMES hid.o hid-libusb.o
41 PATHS ../hidapi ../hidapi.git
885b6a7 @edorfaus Updated the library autodetection to work with libusb in current HIDAPI ...
authored
42 PATH_SUFFIXES linux libusb mac
11f3179 @edorfaus Added a build system based on CMake
authored
43 DOC "The location of the HIDAPI static object file"
44 )
45 set(HIDAPI_STATIC_OBJECT ${HIDAPI_OBJECT})
46 find_package(PkgConfig REQUIRED)
885b6a7 @edorfaus Updated the library autodetection to work with libusb in current HIDAPI ...
authored
47 if (HIDAPI_OBJECT MATCHES \(-libusb|/libusb/hid\)\\.o\$)
11f3179 @edorfaus Added a build system based on CMake
authored
48 pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
49 set(HIDAPI_LINK_LIBS ${LIBUSB_LIBRARIES})
50 else()
51 pkg_check_modules(LIBUDEV REQUIRED libudev)
52 set(HIDAPI_LINK_LIBS ${LIBUDEV_LIBRARIES})
53 endif()
54 endif()
55
56 include_directories(${HIDAPI_HEADER_DIR})
57
58 add_subdirectory(libtempered)
db33a52 @edorfaus Added a utility library with some generally useful code that is likely t...
authored
59 add_subdirectory(libtempered-util)
11f3179 @edorfaus Added a build system based on CMake
authored
60 add_subdirectory(utils)
d861b93 @edorfaus Added an example program that shows how to enumerate the attached device...
authored
61 add_subdirectory(examples)
Something went wrong with that request. Please try again.