Skip to content

Commit

Permalink
Revert "testing on GHA windows -DFORSE_RSUSB_BACKEND=ON"
Browse files Browse the repository at this point in the history
This reverts commit 072849b.
  • Loading branch information
Tamir91 committed Nov 5, 2023
1 parent 072849b commit de586da
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/buildsCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
cd ${{env.WIN_BUILD_DIR}}
pwd
ls
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DFORSE_RSUSB_BACKEND=ON -DCHECK_FOR_UPDATES=true
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=true
- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
cd ${{env.WIN_BUILD_DIR}}
pwd
ls
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DFORSE_RSUSB_BACKEND=ON -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=false -DBUILD_EASYLOGGINGPP=false
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=false -DBUILD_EASYLOGGINGPP=false
- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
run: |
LRS_SRC_DIR=$(pwd)
cd ${{env.WIN_BUILD_DIR}}
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DFORSE_RSUSB_BACKEND=ON -DBUILD_UNIT_TESTS=true -DUNIT_TESTS_ARGS="--not-live --context=windows" -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=true -DUNIT_TESTS_ARGS="--not-live --context=windows" -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true
- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
run: |
LRS_SRC_DIR=$(pwd)
cd ${{env.WIN_BUILD_DIR}}
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DFORSE_RSUSB_BACKEND=ON -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=false -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=false -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true
- name: Build
# Build your program with the given configuration
Expand Down
38 changes: 38 additions & 0 deletions CMake/external_libusb.cmake
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()
9 changes: 5 additions & 4 deletions CMake/libusb_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ 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_LIB LIBUSB_INC)

add_library(usb INTERFACE)
if (USB_FOUND)
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)
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()
98 changes: 98 additions & 0 deletions third-party/libusb/CMakeLists.txt
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
)

0 comments on commit de586da

Please sign in to comment.