diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 71bc8b6331..c6498001ff 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -1,3 +1,4 @@ +include(CMakeProject-hidapi.cmake) include(CMakeProject-lua.cmake) include(CMakeProject-glew.cmake) include(CMakeProject-json.cmake) diff --git a/extern/CMakeProject-hidapi.cmake b/extern/CMakeProject-hidapi.cmake new file mode 100644 index 0000000000..3fc8f899a5 --- /dev/null +++ b/extern/CMakeProject-hidapi.cmake @@ -0,0 +1,34 @@ +set(HIDAPI_HPP "hidapi/hidapi/hidapi.h") + +if(APPLE) + set(HIDAPI_SRC "hidapi/mac/hid.c") + list(APPEND HIDAPI_HPP + "hidapi/windows/hidapi_darwin.h") +endif() + +if(WIN32) + set(HIDAPI_SRC "hidapi/windows/hid.c" "hidapi/windows/hidapi_descriptor_reconstruct.c") + list(APPEND HIDAPI_HPP + "hidapi/windows/hidapi_cfgmgr32.h" + "hidapi/windows/hidapi_descriptor_reconstruct.h" + "hidapi/windows/hidapi_hidclass.h" + "hidapi/windows/hidapi_hidpi.h" + "hidapi/windows/hidapi_hidsdi.h" + "hidapi/windows/hidapi_winapi.h") +endif() + +if(UNIX) + set(HIDAPI_SRC "hidapi/linux/hid.c") +endif() + +source_group("" FILES ${HIDAPI_SRC} ${HIDAPI_HPP}) + +add_library("hidapi" STATIC ${HIDAPI_SRC} ${HIDAPI_HPP}) + +set_property(TARGET "hidapi" PROPERTY FOLDER "External Libraries") + +if(MSVC) + target_compile_definitions("hidapi" PRIVATE _CRT_SECURE_NO_WARNINGS) +endif() + +target_include_directories("hidapi" PUBLIC "hidapi/hidapi") \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f3db82dfc..50e770fe70 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -340,7 +340,8 @@ list(APPEND SMDATA_LINK_LIB "mad" "vorbisfile" "vorbis" "ogg" - "ixwebsocket") + "ixwebsocket" + "hidapi") if(WIN32) list(APPEND SMDATA_LINK_LIB