Add option to use system hidapi

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
Marcin Serwin 2025-08-02 17:33:28 +02:00 committed by Megamouse
commit 2211876b57
2 changed files with 28 additions and 19 deletions

View file

@ -1,4 +1,11 @@
# hidapi # hidapi
if(USE_SYSTEM_HIDAPI)
message(STATUS "RPCS3: using shared hidapi")
pkg_check_modules(hidapi-hidraw REQUIRED IMPORTED_TARGET hidapi-hidraw)
add_library(3rdparty_hidapi INTERFACE)
target_link_libraries(3rdparty_hidapi INTERFACE PkgConfig::hidapi-hidraw)
target_include_directories(3rdparty_hidapi INTERFACE PkgConfig::hidapi-hidraw)
else()
set(BUILD_SHARED_LIBS FALSE CACHE BOOL "Don't build shared libs") set(BUILD_SHARED_LIBS FALSE CACHE BOOL "Don't build shared libs")
set(HIDAPI_INSTALL_TARGETS FALSE CACHE BOOL "Don't install anything") set(HIDAPI_INSTALL_TARGETS FALSE CACHE BOOL "Don't install anything")
@ -20,3 +27,4 @@ elseif(ANDROID)
else() else()
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb) target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
endif() endif()
endif()

View file

@ -44,6 +44,7 @@ option(USE_SYSTEM_FAUDIO "Prefer system FAudio instead of the builtin one" OFF)
option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF) option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF)
option(USE_SYSTEM_FLATBUFFERS "Prefer system flatbuffers instead of the builtin one" OFF) option(USE_SYSTEM_FLATBUFFERS "Prefer system flatbuffers instead of the builtin one" OFF)
option(USE_SYSTEM_GLSLANG "Prefer system glslang instead of the builtin one" OFF) option(USE_SYSTEM_GLSLANG "Prefer system glslang instead of the builtin one" OFF)
option(USE_SYSTEM_HIDAPI "Prefer system hidapi instead of the builtin one" OFF)
option(USE_SYSTEM_LIBPNG "Prefer system libpng instead of the builtin one" OFF) option(USE_SYSTEM_LIBPNG "Prefer system libpng instead of the builtin one" OFF)
option(USE_SYSTEM_LIBUSB "Prefer system libusb instead of the builtin one" OFF) option(USE_SYSTEM_LIBUSB "Prefer system libusb instead of the builtin one" OFF)
option(USE_SYSTEM_MINIUPNPC "Prefer system MiniUPnPc instead of the builtin one" OFF) option(USE_SYSTEM_MINIUPNPC "Prefer system MiniUPnPc instead of the builtin one" OFF)