forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "testing on GHA windows -DFORSE_RSUSB_BACKEND=ON"
This reverts commit 072849b.
- Loading branch information
Showing
4 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/third-party/libusb/libusb>) | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# 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 | ||
) |