Skip to content

Commit

Permalink
windows: let's just try libusb-1.0 for now, instead of libusb-win32
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Nov 14, 2023
1 parent 2d7ef7d commit 7cea3a4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions libticables/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ endif()

# external deps lookup
pkg_check_modules(DEPS REQUIRED glib-2.0 libusb-1.0>=1.0.16)
if(WIN32)
# Actually, the lib files are called libusb-1.0.ext, with the prefix (not usb-1.0.ext)
list(REMOVE_ITEM DEPS_LIBRARIES "usb-1.0")
list(APPEND DEPS_LIBRARIES "libusb-1.0")
list(REMOVE_DUPLICATES DEPS_LIBRARIES) # just in case
endif()

try_static_libs_if_needed()

Expand Down
2 changes: 1 addition & 1 deletion libticables/trunk/src/link_usb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifndef NO_CABLE_SLV

#if defined(__WIN32__) && !defined(__MINGW32__)
#if !defined(HAVE_LIBUSB_1_0) && defined(__WIN32__) && !defined(__MINGW32__)
# define HAVE_LIBUSB
#endif

Expand Down
8 changes: 4 additions & 4 deletions libticables/trunk/src/ticables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include <sys/utsname.h>
#endif

#ifdef _MSC_VER
# include "./win32/usb.h"
#if defined(HAVE_LIBUSB_1_0)
# include <libusb.h>
#elif defined(HAVE_LIBUSB)
# include <usb.h>
#elif defined(HAVE_LIBUSB_1_0)
# include <libusb.h>
#elif defined(_MSC_VER)
# include "./win32/usb.h"
#endif

#include "gettext.h"
Expand Down
6 changes: 5 additions & 1 deletion libticables/trunk/src/win32/detect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ int win32_check_rwp(void)

int win32_check_libusb(void)
{
if(usb_get_version() != NULL)
#ifdef HAVE_LIBUSB_1_0
return 0;
#else
if (usb_get_version() != NULL)
return 0;
else
return ERR_LIBUSBWIN32_NOT_PRESENT;
#endif // HAVE_LIBUSB_1_0
}
6 changes: 6 additions & 0 deletions libticables/trunk/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ add_executable(torture_ticables torture_ticables.c)
add_executable(test_ticables_2 test_ticables_2.cc)

pkg_check_modules(DEPS REQUIRED glib-2.0 libusb-1.0>=1.0.16)
if(WIN32)
# Actually, the lib files are called libusb-1.0.ext, with the prefix (not usb-1.0.ext)
list(REMOVE_ITEM DEPS_LIBRARIES "usb-1.0")
list(APPEND DEPS_LIBRARIES "libusb-1.0")
list(REMOVE_DUPLICATES DEPS_LIBRARIES) # just in case
endif()

foreach(tar torture_ticables test_ticables_2)
target_compile_options(${tar} PRIVATE ${DEPS_CFLAGS})
Expand Down
6 changes: 6 additions & 0 deletions libticalcs/trunk/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ add_executable(torture_ticalcs torture_ticalcs.c)
add_executable(test_ticalcs_2 test_ticalcs_2.cc)

pkg_check_modules(DEPS REQUIRED glib-2.0 libusb-1.0>=1.0.16 libarchive zlib)
if(WIN32)
# Actually, the lib files are called libusb-1.0.ext, with the prefix (not usb-1.0.ext)
list(REMOVE_ITEM DEPS_LIBRARIES "usb-1.0")
list(APPEND DEPS_LIBRARIES "libusb-1.0")
list(REMOVE_DUPLICATES DEPS_LIBRARIES) # just in case
endif()

foreach(tar torture_ticalcs test_ticalcs_2)
target_compile_options(${tar} PRIVATE ${DEPS_CFLAGS})
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "libarchive",
"default-features": false
},
"libusb-win32",
"libusb",
"glib",
"gettext"
],
Expand Down

0 comments on commit 7cea3a4

Please sign in to comment.