diff --git a/CMake/external_libusb.cmake b/CMake/external_libusb.cmake deleted file mode 100644 index 22acb98f515..00000000000 --- a/CMake/external_libusb.cmake +++ /dev/null @@ -1,38 +0,0 @@ -include(ExternalProject) - -ExternalProject_Add( - libusb - - # Work-around for libusb master broken on Nov 26' 2020 with introduction of v1.0.24 - # the issue has been reported in https://github.com/libusb/libusb/issues/812 - GIT_REPOSITORY "https://github.com/ev-mp/libusb.git" - GIT_TAG "2a7372db54094a406a755f0b8548b614ba8c78ec" # "v1.0.22" + Mac get_device_list hang fix - - UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/third-party/libusb/CMakeLists.txt - ${CMAKE_CURRENT_BINARY_DIR}/third-party/libusb/CMakeLists.txt - PATCH_COMMAND "" - - SOURCE_DIR "third-party/libusb/" - CMAKE_ARGS -DCMAKE_CXX_STANDARD_LIBRARIES=${CMAKE_CXX_STANDARD_LIBRARIES} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DANDROID_ABI=${ANDROID_ABI} - -DANDROID_STL=${ANDROID_STL} - -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/libusb_install - TEST_COMMAND "" - BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/libusb_install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX} -) - -add_library(usb INTERFACE) -target_include_directories(usb INTERFACE $) -target_link_libraries(usb INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/libusb_install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}usb${CMAKE_STATIC_LIBRARY_SUFFIX}) -set(USE_EXTERNAL_USB ON) # INTERFACE libraries can't have real deps, so targets that link with usb need to also depend on libusb - -set_target_properties( libusb PROPERTIES FOLDER "3rd Party") - -if (APPLE) - find_library(corefoundation_lib CoreFoundation) - find_library(iokit_lib IOKit) - target_link_libraries(usb INTERFACE objc ${corefoundation_lib} ${iokit_lib}) -endif() diff --git a/CMake/libusb_config.cmake b/CMake/libusb_config.cmake index ca221ca66da..26ad55457e2 100644 --- a/CMake/libusb_config.cmake +++ b/CMake/libusb_config.cmake @@ -2,13 +2,12 @@ if (NOT TARGET usb) find_library(LIBUSB_LIB usb-1.0) find_path(LIBUSB_INC libusb.h HINTS PATH_SUFFIXES libusb-1.0) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(usb "libusb not found; using internal version" LIBUSB_LIB LIBUSB_INC) - if (USB_FOUND AND NOT USE_EXTERNAL_USB) - add_library(usb INTERFACE) + find_package_handle_standard_args(usb LIBUSB_LIB LIBUSB_INC) + + add_library(usb INTERFACE) + if (USB_FOUND) target_include_directories(usb INTERFACE ${LIBUSB_INC}) target_link_libraries(usb INTERFACE ${LIBUSB_LIB}) - else() - include(CMake/external_libusb.cmake) endif() install(TARGETS usb EXPORT realsense2Targets) endif() diff --git a/third-party/libusb/CMakeLists.txt b/third-party/libusb/CMakeLists.txt deleted file mode 100644 index ce9cd49292d..00000000000 --- a/third-party/libusb/CMakeLists.txt +++ /dev/null @@ -1,98 +0,0 @@ -# ubuntu 12.04 LTS cmake version 2.8.7 -# ubuntu 14.04 LTS cmake version 2.8.12.2 -# ubuntu 16.04 LTS cmake version 3.5.1 -cmake_minimum_required(VERSION 2.8.3) - -project(usb) - - set(LIBUSB_C - libusb/core.c - libusb/descriptor.c - libusb/hotplug.c - libusb/io.c - libusb/strerror.c - libusb/sync.c - ) - -if(WIN32) - LIST(APPEND LIBUSB_C - libusb/os/threads_windows.c - libusb/os/poll_windows.c - libusb/os/windows_winusb.c - libusb/os/windows_nt_common.c - libusb/os/windows_usbdk.c - ) -elseif (APPLE) - LIST(APPEND LIBUSB_C - libusb/os/poll_posix.c - libusb/os/threads_posix.c - libusb/os/darwin_usb.c - ) -elseif(ANDROID) - LIST(APPEND LIBUSB_C - libusb/os/linux_usbfs.c - libusb/os/poll_posix.c - libusb/os/threads_posix.c - libusb/os/linux_netlink.c - ) -else() - LIST(APPEND LIBUSB_C - libusb/os/linux_usbfs.c - libusb/os/poll_posix.c - libusb/os/threads_posix.c - libusb/os/linux_udev.c - ) -endif() - -set(LIBUSB_H - libusb/libusb.h -) - -include_directories( - libusb - libusb/os -) - -add_library(usb STATIC ${LIBUSB_C} ${LIBUSB_H}) - -if(WIN32) - set_target_properties (usb PROPERTIES - FOLDER "3rd Party" - ) - include_directories(msvc) - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8") -endif() - -if(ANDROID) - include_directories(android) -endif() - -if(APPLE) - find_library(corefoundation_lib CoreFoundation) - find_library(iokit_lib IOKit) - target_include_directories(usb PRIVATE XCode) - TARGET_LINK_LIBRARIES(usb objc ${corefoundation_lib} ${iokit_lib}) -endif() - -if((NOT APPLE) AND (NOT ANDROID) AND (NOT WIN32)) - TARGET_LINK_LIBRARIES(usb udev) -endif() - -#set_target_properties(usb PROPERTIES PREFIX "") - -install(TARGETS ${PROJECT_NAME} - EXPORT realsense2Targets - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - )