diff --git a/libticables/trunk/CMakeLists.txt b/libticables/trunk/CMakeLists.txt index ee5936ac..85c8da87 100644 --- a/libticables/trunk/CMakeLists.txt +++ b/libticables/trunk/CMakeLists.txt @@ -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() diff --git a/libticables/trunk/src/link_usb.cc b/libticables/trunk/src/link_usb.cc index 6ea82a05..dedbba49 100644 --- a/libticables/trunk/src/link_usb.cc +++ b/libticables/trunk/src/link_usb.cc @@ -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 diff --git a/libticables/trunk/src/ticables.cc b/libticables/trunk/src/ticables.cc index a6da9fac..5f183723 100644 --- a/libticables/trunk/src/ticables.cc +++ b/libticables/trunk/src/ticables.cc @@ -35,12 +35,12 @@ #include #endif -#ifdef _MSC_VER -# include "./win32/usb.h" +#if defined(HAVE_LIBUSB_1_0) +# include #elif defined(HAVE_LIBUSB) # include -#elif defined(HAVE_LIBUSB_1_0) -# include +#elif defined(_MSC_VER) +# include "./win32/usb.h" #endif #include "gettext.h" diff --git a/libticables/trunk/src/win32/detect.cc b/libticables/trunk/src/win32/detect.cc index 64f5671f..6733c534 100644 --- a/libticables/trunk/src/win32/detect.cc +++ b/libticables/trunk/src/win32/detect.cc @@ -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 } diff --git a/libticables/trunk/tests/CMakeLists.txt b/libticables/trunk/tests/CMakeLists.txt index 49ff7dc5..2bf1df4c 100644 --- a/libticables/trunk/tests/CMakeLists.txt +++ b/libticables/trunk/tests/CMakeLists.txt @@ -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}) diff --git a/libticalcs/trunk/tests/CMakeLists.txt b/libticalcs/trunk/tests/CMakeLists.txt index 113df834..0ed7cd11 100644 --- a/libticalcs/trunk/tests/CMakeLists.txt +++ b/libticalcs/trunk/tests/CMakeLists.txt @@ -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}) diff --git a/vcpkg.json b/vcpkg.json index 100f82d8..920db4d0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -9,7 +9,7 @@ "name": "libarchive", "default-features": false }, - "libusb-win32", + "libusb", "glib", "gettext" ],