CMakeLists.txt
changeset 12974 0fef4b21fa1d
parent 12971 2fbd3d8432ab
child 12998 b87ba0fad17e
     1.1 --- a/CMakeLists.txt	Wed Jul 31 10:20:37 2019 -0700
     1.2 +++ b/CMakeLists.txt	Wed Jul 31 12:20:55 2019 -0400
     1.3 @@ -156,11 +156,10 @@
     1.4  endif()
     1.5  
     1.6  # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
     1.7 -#  so we'll just use libusb when it's available. Except that libusb
     1.8 -#  requires root permissions to open devices, so that's not generally
     1.9 -#  useful, and we'll disable this by default on Unix. Windows and macOS
    1.10 -#  can use it without root access, though, so enable by default there.
    1.11 -if(WINDOWS OR APPLE OR ANDROID)
    1.12 +#  so we'll just use libusb when it's available. libusb does not support iOS,
    1.13 +#  so we default to yes on iOS.
    1.14 +#  TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
    1.15 +if(WINDOWS OR IOS OR ANDROID)
    1.16    set(HIDAPI_SKIP_LIBUSB TRUE)
    1.17  else()
    1.18    set(HIDAPI_SKIP_LIBUSB FALSE)
    1.19 @@ -169,6 +168,14 @@
    1.20    set(OPT_DEF_HIDAPI ON)
    1.21  endif()
    1.22  
    1.23 +# On the other hand, *BSD specifically uses libusb only, so we make a special
    1.24 +#  case just for them.
    1.25 +if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
    1.26 +  set(HIDAPI_ONLY_LIBUSB TRUE)
    1.27 +else()
    1.28 +  set(HIDAPI_ONLY_LIBUSB FALSE)
    1.29 +endif()
    1.30 +
    1.31  # Compiler info
    1.32  if(CMAKE_COMPILER_IS_GNUCC)
    1.33    set(USE_GCC TRUE)
    1.34 @@ -1376,6 +1383,7 @@
    1.35  
    1.36    if(SDL_JOYSTICK)
    1.37      CheckHIDAPI()
    1.38 +    # TODO: Remove this hid.c block when SDL_hidapi.c is supported on Windows!
    1.39      if(HAVE_HIDAPI)
    1.40        set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/windows/hid.c)
    1.41      endif()
    1.42 @@ -1466,8 +1474,6 @@
    1.43      if(HAVE_HIDAPI)
    1.44        if(IOS)
    1.45          set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
    1.46 -      else()
    1.47 -        set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/mac/hid.c)
    1.48        endif()
    1.49      endif()
    1.50      set(SDL_JOYSTICK_IOKIT 1)