Skip to content

Commit

Permalink
build: Clarify usbhid naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jcm93 committed Dec 17, 2024
1 parent 562c182 commit 347bfeb
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_sources(
finders/FindOSS.cmake
finders/FindPulseAudio.cmake
finders/Findudev.cmake
finders/Finduhid.cmake
finders/Findusbhid.cmake
macos/dependencies.cmake
macos/compilerconfig.cmake
macos/defaults.cmake
Expand Down
67 changes: 0 additions & 67 deletions cmake/finders/Finduhid.cmake

This file was deleted.

67 changes: 67 additions & 0 deletions cmake/finders/Findusbhid.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#[=======================================================================[.rst:
Findusbhid
-------
Finds the usbhid library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``usbhid::usbhid``
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``usbhid_FOUND``
True if the system has usbhid.
``usbhid_LIBRARIES``
The location of the usbhid library.
``usbhid_INCLUDE_DIR``
Include directories needed to use usbhid.
#]=======================================================================]

include(FindPackageHandleStandardArgs)

find_path(
usbhid_INCLUDE_DIR
NAMES usbhid.h /dev/usb/usbhid.h
PATHS /usr/include /usr/local/include
DOC "usbhid include directory"
)

find_library(
usbhid_LIBRARIES
NAMES usbhid
PATHS /usr/lib /usr/local/lib
DOC "usbhid location"
)

set(usbhid_VERSION ${CMAKE_HOST_SYSTEM_VERSION})

find_package_handle_standard_args(
usbhid
REQUIRED_VARS usbhid_INCLUDE_DIR usbhid_LIBRARIES
VERSION_VAR usbhid_VERSION
REASON_FAILURE_MESSAGE "Ensure that usbhid is installed on the system."
)
mark_as_advanced(usbhid_INCLUDE_DIR usbhid_LIBRARY)

if(usbhid_FOUND)
if(NOT TARGET usbhid::usbhid)
add_library(usbhid::usbhid MODULE IMPORTED)
set_property(TARGET usbhid::usbhid PROPERTY IMPORTED_LOCATION "${usbhid_LIBRARIES}")

set_target_properties(
usbhid::usbhid
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${usbhid_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${usbhid_LIBRARIES}"
VERSION ${usbhid_VERSION}
)
endif()
endif()
14 changes: 7 additions & 7 deletions ruby/cmake/os-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ else()
target_disable_feature(ruby "udev input driver")
endif()

option(ARES_ENABLE_UHID "Enable the uhid input driver" ON)
if(ARES_ENABLE_UHID)
find_package(uhid)
option(ARES_ENABLE_USBHID "Enable the usbhid input driver" ON)
if(ARES_ENABLE_USBHID)
find_package(usbhid)
endif()
if(uhid_FOUND)
target_enable_feature(ruby "uhid input driver" INPUT_UHID)
if(usbhid_FOUND)
target_enable_feature(ruby "usbhid input driver" INPUT_UHID)
else()
target_disable_feature(ruby "uhid input driver")
target_disable_feature(ruby "usbhid input driver")
endif()

target_link_libraries(
Expand All @@ -139,5 +139,5 @@ target_link_libraries(
$<$<BOOL:${PulseAudio_FOUND}>:PulseAudio::PulseAudioSimple>
$<$<BOOL:${AO_FOUND}>:AO::AO>
$<$<BOOL:${udev_FOUND}>:udev::udev>
$<$<BOOL:${uhid_FOUND}>:uhid::uhid>
$<$<BOOL:${usbhid_FOUND}>:usbhid::usbhid>
)

0 comments on commit 347bfeb

Please sign in to comment.