diff --git a/ports/hidapi/CONTROL b/ports/hidapi/CONTROL
deleted file mode 100644
index 80f18b4935..0000000000
--- a/ports/hidapi/CONTROL
+++ /dev/null
@@ -1,4 +0,0 @@
-Source: hidapi
-Version: 2019-08-30
-Description: A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows.
-Homepage: https://github.com/libusb/hidapi
diff --git a/ports/hidapi/portfile.cmake b/ports/hidapi/portfile.cmake
index ec7abb495e..ea2cd092bf 100644
--- a/ports/hidapi/portfile.cmake
+++ b/ports/hidapi/portfile.cmake
@@ -1,3 +1,5 @@
+vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "linux" "osx" "uwp")
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libusb/hidapi
@@ -7,26 +9,46 @@ vcpkg_from_github(
)
if(VCPKG_TARGET_IS_WINDOWS)
- if(TRIPLET_SYSTEM_ARCH MATCHES "arm")
- message(FATAL_ERROR "ARM builds are currently not supported!")
- elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
- message(FATAL_ERROR "UWP builds are currently not supported!")
+ file(READ "${SOURCE_PATH}/windows/hidapi.vcxproj" _contents)
+ if(${VCPKG_CRT_LINKAGE} STREQUAL "dynamic")
+ string(REGEX REPLACE
+ "MultiThreadedDebug"
+ "MultiThreadedDebugDLL"
+ _contents "${_contents}")
+ string(REGEX REPLACE
+ "MultiThreaded"
+ "MultiThreadedDLL"
+ _contents "${_contents}")
+ else()
+ string(REGEX REPLACE
+ "MultiThreadedDebugDLL"
+ "MultiThreadedDebug"
+ _contents "${_contents}")
+ string(REGEX REPLACE
+ "MultiThreadedDLL"
+ "MultiThreaded"
+ _contents "${_contents}")
endif()
+ if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "dynamic")
+ string(REPLACE
+ "StaticLibrary"
+ "DynamicLibrary"
+ _contents "${_contents}")
+ else()
+ string(REPLACE
+ "DynamicLibrary"
+ "StaticLibrary"
+ _contents "${_contents}")
+ endif()
+ file(WRITE "${SOURCE_PATH}/windows/hidapi.vcxproj" "${_contents}")
+
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
- PROJECT_SUBPATH windows/hidapi.sln
+ PROJECT_SUBPATH windows/hidapi.vcxproj
INCLUDES_SUBPATH hidapi ALLOW_ROOT_INCLUDES
LICENSE_SUBPATH LICENSE-bsd.txt # use BSD license
)
- file(COPY
- ${CMAKE_CURRENT_LIST_DIR}/hidapi-config.cmake
- DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
-
- if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
- endif()
-else()
- message(FATAL_ERROR "Non-Windows builds are currently not supported!")
+ file(COPY ${CMAKE_CURRENT_LIST_DIR}/hidapi-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
endif()
diff --git a/ports/hidapi/vcpkg.json b/ports/hidapi/vcpkg.json
new file mode 100644
index 0000000000..f73f97f2ea
--- /dev/null
+++ b/ports/hidapi/vcpkg.json
@@ -0,0 +1,8 @@
+{
+ "name": "hidapi",
+ "version-string": "2019-08-30",
+ "port-version": 1,
+ "description": "A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows.",
+ "homepage": "https://github.com/libusb/hidapi",
+ "supports": "windows & !(arm | arm64 | uwp)"
+}