Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include TM2 firmware directly #3647

Merged
merged 31 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
84f0f8d
tm2: put operator<< in perc:: or clang can't find it
radfordi Mar 5, 2019
babf076
Use override consistently
radfordi Mar 6, 2019
f730c43
Use extra parens for assignments within if's to avoid warning
radfordi Mar 6, 2019
a87d4bb
using libuvc is not a warning, but a status
radfordi Mar 16, 2019
4e212a7
Remove the need for USE_SYSTEM_LIBUSB
radfordi Mar 16, 2019
6e0a0b0
Use installed glfw if available
radfordi Feb 20, 2019
0e1a354
Fix third-party/libusb build on a Mac
radfordi Mar 26, 2019
f5fa91e
Update libusb to fix get_device_list hang
radfordi Mar 26, 2019
a3cee5c
rs-pose is not graphical
radfordi Mar 26, 2019
6f61fd0
Use CMAKE_CXX_STANDARD instead of open coding it
radfordi Mar 27, 2019
787836b
Remove obsolete FindLibUSB.cmake and Findlibtm.cmake
radfordi Mar 27, 2019
1ac2cb8
Create a consistent usb target on every platform
radfordi Mar 16, 2019
ba320fb
Detect libusb generically for all platforms
radfordi Mar 26, 2019
5e09bec
Remove obsolete apple_config.cmake
radfordi Mar 28, 2019
895e734
Fix typo in central app version parsing
radfordi Apr 1, 2019
acf294f
Avoid creating version files in the source directory
radfordi Apr 2, 2019
9db097a
Match GCC diagnostic push with pop in libuvc
radfordi Apr 2, 2019
8053c1f
Add an install target of system libusb interface
radfordi Apr 2, 2019
78663df
Avoid trigging new builds of internal libusb
radfordi Apr 3, 2019
45b06bd
Remove pointless cmake messages from libtm
radfordi Apr 3, 2019
42cdafd
Avoid code page warnings for external project libusb
radfordi Apr 4, 2019
a57d214
Let libtm export its own include directory
radfordi Apr 5, 2019
2718030
Add parenthesis to macro arguments to avoid precedence issues
radfordi Apr 5, 2019
7ec1b01
Use extra parens for assignments within if's to avoid warning
radfordi Apr 16, 2019
036b8f2
Avoid non-standard fourcc C syntax
radfordi Apr 16, 2019
418f5f1
Append CMake/ to the module path so we can include from any directory
radfordi Apr 16, 2019
d9b8097
Include libusb_config on demand instead of globally
radfordi Apr 16, 2019
cc00611
Include android_config in preference to windows_config or unix_config
radfordi Apr 16, 2019
b97f707
Include libtm firmware directly as binary
radfordi Apr 1, 2019
585b08b
Resources don't get picked up from static libraries with out an expli…
Apr 2, 2019
1cd948f
Remove old libtm firwmare header generation
radfordi Apr 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions CMake/FindLibUSB.cmake

This file was deleted.

84 changes: 0 additions & 84 deletions CMake/Findlibtm.cmake

This file was deleted.

8 changes: 0 additions & 8 deletions CMake/android_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ macro(os_set_flags)
else()
set(FORCE_LIBUVC ON)
set(BACKEND RS2_USE_V4L2_BACKEND)
include(CMake/external_libusb.cmake)
set(LIBUSB1_LIBRARIES ${LIBUSB1_LIBRARIES} log)
endif()
endmacro()

Expand All @@ -33,10 +31,4 @@ macro(os_target_config)
find_library(log-lib log)
target_link_libraries(${LRS_TARGET} PRIVATE log)
endif()

if(NOT ANDROID_USB_HOST_UVC)
add_dependencies(${LRS_TARGET} libusb)
endif()

target_link_libraries(${LRS_TARGET} PRIVATE ${LIBUSB1_LIBRARIES})
endmacro()
22 changes: 0 additions & 22 deletions CMake/apple_config.cmake

This file was deleted.

22 changes: 12 additions & 10 deletions CMake/external_libusb.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
message(STATUS "Use external libusb")
include(ExternalProject)

ExternalProject_Add(
libusb

GIT_REPOSITORY "https://github.com/libusb/libusb.git"
GIT_TAG "v1.0.22"
GIT_TAG "2a7372db54094a406a755f0b8548b614ba8c78ec" # "v1.0.22" + Mac get_device_list hang fix

UPDATE_COMMAND ${CMAKE_COMMAND} -E copy
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 ""
Expand All @@ -20,13 +19,16 @@ ExternalProject_Add(
-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}
)

set(LIBUSB1_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libusb_install/lib)
link_directories(${LIBUSB1_LIBRARY_DIRS})
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(LIBUSB1_LIBRARIES usb)
#set(LIBUSB_LOCAL_INCLUDE_PATH third-party/libusb)

set(USE_EXTERNAL_USB ON)
set(LIBUSB_LOCAL_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/third-party/libusb)
if (APPLE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't it be moved to apple_config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really part of the exported interface of libusb, so I think it should stay in a libusb specific place. Normally this would come from a target_* function if we were actually compiling libusb, an installed cmake file, or a pkg-config file, but since we are using an "external project" without installation, we need to do it ourselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I removed (cc40ab3) apple_config.cmake as it wasn't being used. :)

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/global_config.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Save the command line compile commands in the build output
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_CXX_STANDARD 11)
# View the makefile commands during build
#set(CMAKE_VERBOSE_MAKEFILE on)

Expand Down Expand Up @@ -50,7 +51,7 @@ macro(global_set_flags)

if(FORCE_LIBUVC)
set(BACKEND RS2_USE_LIBUVC_BACKEND)
message( WARNING "Using libuvc!" )
message(STATUS "Using libuvc (by force)")
endif()

if (BUILD_WITH_CUDA)
Expand All @@ -61,7 +62,7 @@ macro(global_set_flags)
endmacro()

macro(global_target_config)
target_link_libraries(${LRS_TARGET} PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS})
target_link_libraries(${LRS_TARGET} PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT})

include_directories(${LRS_TARGET} src)

Expand All @@ -83,10 +84,10 @@ endmacro()
macro(add_tm2)
message(STATUS "Building with TM2")
add_subdirectory(third-party/libtm)
include(libusb_config)
if(USE_EXTERNAL_USB)
add_dependencies(tm libusb)
endif()
target_compile_definitions(${LRS_TARGET} PRIVATE WITH_TRACKING=1 BUILD_STATIC=1)
target_link_libraries(${LRS_TARGET} PRIVATE tm ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS})
target_include_directories(${LRS_TARGET} PRIVATE third-party/libtm/libtm/include)
target_link_libraries(${LRS_TARGET} PRIVATE tm ${CMAKE_THREAD_LIBS_INIT})
endmacro()
18 changes: 7 additions & 11 deletions CMake/include_os.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
if (WIN32)
include(CMake/windows_config.cmake)
endif()

if(UNIX)
include(CMake/unix_config.cmake)
endif()

if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
include(CMake/android_config.cmake)
endif()
if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
include(CMake/android_config.cmake)
elseif (WIN32)
include(CMake/windows_config.cmake)
else()
include(CMake/unix_config.cmake)
endif()
14 changes: 14 additions & 0 deletions CMake/libusb_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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)
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()
18 changes: 0 additions & 18 deletions CMake/unix_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ macro(os_set_flags)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar -Wsequence-point -Wformat-security")

add_definitions(-DUSE_SYSTEM_LIBUSB)

execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE MACHINE)
if(${MACHINE} MATCHES "arm-linux-gnueabihf")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize")
Expand All @@ -33,20 +31,4 @@ macro(os_set_flags)
endmacro()

macro(os_target_config)
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(FATAL_ERROR "\n\n PkgConfig package is missing!\n\n")
endif()

pkg_search_module(LIBUSB1 REQUIRED libusb-1.0)
if(LIBUSB1_FOUND)
include_directories(SYSTEM ${LIBUSB1_INCLUDE_DIRS})
link_directories(${LIBUSB1_LIBRARY_DIRS})
list(APPEND librealsense_PKG_DEPS "libusb-1.0")
else()
message( FATAL_ERROR "Failed to find libusb-1.0" )
endif(LIBUSB1_FOUND)

target_include_directories(${LRS_TARGET} PRIVATE ${LIBUSB1_INCLUDE_DIRS})
target_link_libraries(${LRS_TARGET} PRIVATE ${LIBUSB1_LIBRARIES})
endmacro()
2 changes: 0 additions & 2 deletions CMake/windows_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ macro(os_set_flags)
if(BUILD_EASYLOGGINGPP)
add_definitions(-DNOMINMAX)
endif()

include(CMake/external_libusb.cmake)
endmacro()

macro(os_target_config)
Expand Down
Loading