1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
# Detect hidapi, then use this priority list to determine
# which library to use:
#
# Priority
# 1. HIDAPI_INCLUDEPATH / HIDAPI_LIBPATH (qmake parameter, not checked it given on commandline)
# 2. OPENSCAD_LIBRARIES (environment variable)
# 3. system's standard include paths from pkg-config
# read environment variables
OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES)
HIDAPI_DIR = $$(HIDAPIDIR)
!isEmpty(OPENSCAD_LIBRARIES_DIR) {
isEmpty(HIDAPI_INCLUDEPATH) {
exists($$OPENSCAD_LIBRARIES_DIR/include/hidapi) {
HIDAPI_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/hidapi
HIDAPI_LIBPATH = $$OPENSCAD_LIBRARIES_DIR/lib
}
}
}
win*: {
# Use included HIDAPI on MXE/Windows build.
HIDAPI_CFLAGS = -I$$_PRO_FILE_PWD_/src/ext/hidapi
HIDAPI_LIBS = -lsetupapi
HEADERS += src/ext/hidapi/hidapi.h
SOURCES += src/ext/hidapi/hid.c
} else {
isEmpty(HIDAPI_INCLUDEPATH) {
HIDAPI_CFLAGS = $$system("pkg-config --silence-errors --cflags hidapi-libusb")
} else {
HIDAPI_CFLAGS = -I$$HIDAPI_INCLUDEPATH
}
isEmpty(HIDAPI_LIBPATH) {
HIDAPI_LIBS = $$system("pkg-config --silence-errors --libs hidapi-libusb")
} else {
macx: {
HIDAPI_LIBS = -L$$HIDAPI_LIBPATH -lhidapi -framework IOKit -framework CoreFoundation
} else {
HIDAPI_LIBS = -L$$HIDAPI_LIBPATH -lhidapi-libusb
}
}
}
*-g++* {
GCC_VERSION = $$system("g++ -dumpversion | cut -d. -f1")
lessThan(GCC_VERSION, 5) {
DISABLE_HIDAPI="yes"
}
}
isEmpty(DISABLE_HIDAPI):!isEmpty(HIDAPI_CFLAGS) {
message("HIDAPI enabled")
QMAKE_CXXFLAGS += $$HIDAPI_CFLAGS
LIBS += $$HIDAPI_LIBS
DEFINES += ENABLE_HIDAPI
HEADERS += src/input/HidApiInputDriver.h
SOURCES += src/input/HidApiInputDriver.cc
}
|