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.
Merge pull request IntelRealSense#39 from IntelRealSense/development
Merge from intelrealsense/librealsense/Development
- Loading branch information
Showing
134 changed files
with
4,069 additions
and
3,154 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,30 @@ | ||
message(STATUS "Setting Android configurations") | ||
message(STATUS "Prepare RealSense SDK for Android OS (${ANDROID_NDK_ABI_NAME})") | ||
|
||
macro(os_set_flags) | ||
unset(WIN32) | ||
unset(UNIX) | ||
unset(APPLE) | ||
set(BUILD_WITH_TM2 OFF) | ||
set(BUILD_WITH_OPENMP OFF) | ||
set(FORCE_LIBUVC ON) | ||
set(BUILD_GRAPHICAL_EXAMPLES OFF) | ||
set(ANDROID_STL "c++_static") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -pedantic -g -D_BSD_SOURCE") | ||
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") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie") | ||
set(BACKEND RS2_USE_V4L2_BACKEND) | ||
include(CMake/external_libusb.cmake) | ||
set(LIBUSB1_LIBRARIES ${LIBUSB1_LIBRARIES} log) | ||
endmacro() | ||
|
||
macro(os_target_config) | ||
if(BUILD_SHARED_LIBS) | ||
find_library(log-lib log) | ||
target_link_libraries(${LRS_TARGET} PRIVATE log) | ||
endif() | ||
|
||
add_dependencies(${LRS_TARGET} libusb) | ||
target_link_libraries(${LRS_TARGET} PRIVATE ${LIBUSB1_LIBRARIES}) | ||
endmacro() |
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,22 @@ | ||
message(STATUS "Setting Apple configurations") | ||
|
||
macro(os_set_flags) | ||
set(FORCE_LIBUVC ON) | ||
set(BUILD_WITH_TM2 OFF) | ||
|
||
add_definitions(-DUSE_SYSTEM_LIBUSB) | ||
endmacro() | ||
|
||
macro(os_target_config) | ||
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() |
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,15 @@ | ||
info("Building with CUDA requires CMake v3.8+") | ||
cmake_minimum_required(VERSION 3.8.0) | ||
project(librealsense2 LANGUAGES CXX C CUDA) | ||
|
||
find_package(CUDA REQUIRED) | ||
|
||
include_directories(${CUDA_INCLUDE_DIRS}) | ||
SET(ALL_CUDA_LIBS ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY}) | ||
SET(LIBS ${LIBS} ${ALL_CUDA_LIBS}) | ||
|
||
message(STATUS "CUDA_LIBRARIES: ${CUDA_INCLUDE_DIRS} ${ALL_CUDA_LIBS}") | ||
|
||
set(CUDA_PROPAGATE_HOST_FLAGS OFF) | ||
set(CUDA_SEPARABLE_COMPILATION ON) | ||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -O3 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62;") |
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,29 @@ | ||
message(STATUS "Use external libusb") | ||
include(ExternalProject) | ||
|
||
ExternalProject_Add( | ||
libusb | ||
|
||
GIT_REPOSITORY "https://github.com/libusb/libusb.git" | ||
GIT_TAG "master" | ||
|
||
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy | ||
${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_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/libusb_install | ||
TEST_COMMAND "" | ||
) | ||
|
||
set(LIBUSB1_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libusb_install/lib) | ||
link_directories(${LIBUSB1_LIBRARY_DIRS}) | ||
|
||
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) |
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,92 @@ | ||
# Save the command line compile commands in the build output | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) | ||
# View the makefile commands during build | ||
#set(CMAKE_VERBOSE_MAKEFILE on) | ||
|
||
include(GNUInstallDirs) | ||
# include librealsense helper macros | ||
include(CMake/lrs_macros.cmake) | ||
include(CMake/version_config.cmake) | ||
include(CMake/lrs_options.cmake) | ||
|
||
if(ENABLE_CCACHE) | ||
find_program(CCACHE_FOUND ccache) | ||
if(CCACHE_FOUND) | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) | ||
endif(CCACHE_FOUND) | ||
endif() | ||
|
||
macro(global_set_flags) | ||
set(LRS_TARGET realsense2) | ||
set(LRS_LIB_NAME ${LRS_TARGET}) | ||
|
||
add_definitions(-DELPP_THREAD_SAFE) | ||
add_definitions(-DELPP_NO_DEFAULT_LOG_FILE) | ||
|
||
if (ENABLE_ZERO_COPY) | ||
add_definitions(-DZERO_COPY) | ||
endif() | ||
|
||
if (BUILD_EASYLOGGINGPP) | ||
add_definitions(-DBUILD_EASYLOGGINGPP) | ||
endif() | ||
|
||
if(TRACE_API) | ||
add_definitions(-DTRACE_API) | ||
endif() | ||
|
||
if(HWM_OVER_XU) | ||
add_definitions(-DHWM_OVER_XU) | ||
endif() | ||
|
||
if (ENFORCE_METADATA) | ||
add_definitions(-DENFORCE_METADATA) | ||
endif() | ||
|
||
if (BUILD_WITH_CUDA) | ||
add_definitions(-DRS2_USE_CUDA) | ||
endif() | ||
|
||
if(FORCE_LIBUVC) | ||
set(BACKEND RS2_USE_LIBUVC_BACKEND) | ||
message( WARNING "Using libuvc!" ) | ||
endif() | ||
|
||
if (BUILD_WITH_CUDA) | ||
include(CMake/cuda_config.cmake) | ||
endif() | ||
|
||
add_definitions(-D${BACKEND} -DUNICODE) | ||
endmacro() | ||
|
||
macro(global_target_config) | ||
target_link_libraries(${LRS_TARGET} PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS}) | ||
|
||
include_directories(${LRS_TARGET} src) | ||
|
||
set_target_properties (${LRS_TARGET} PROPERTIES FOLDER Library) | ||
|
||
target_include_directories(${LRS_TARGET} | ||
PRIVATE | ||
${ROSBAG_HEADER_DIRS} | ||
${BOOST_INCLUDE_PATH} | ||
${LZ4_INCLUDE_PATH} | ||
${LIBUSB_LOCAL_INCLUDE_PATH} | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
PRIVATE ${USB_INCLUDE_DIRS} | ||
) | ||
endmacro() | ||
|
||
macro(add_tm2) | ||
message(STATUS "Building with TM2") | ||
add_subdirectory(third-party/libtm) | ||
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) | ||
endmacro() |
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,11 @@ | ||
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() |
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,51 @@ | ||
# Set CMAKE_INSTALL_* if not defined | ||
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${LRS_TARGET}") | ||
|
||
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/realsense2ConfigVersion.cmake" | ||
VERSION ${REALSENSE_VERSION_STRING} COMPATIBILITY AnyNewerVersion) | ||
|
||
configure_package_config_file(CMake/realsense2Config.cmake.in realsense2Config.cmake | ||
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} | ||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/bin | ||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR | ||
) | ||
|
||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) | ||
configure_file(config/librealsense.pc.in config/realsense2.pc @ONLY) | ||
|
||
install(TARGETS ${LRS_TARGET} | ||
EXPORT realsense2Targets | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/librealsense2" | ||
) | ||
|
||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/librealsense2 | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install(EXPORT realsense2Targets | ||
FILE realsense2Targets.cmake | ||
NAMESPACE ${LRS_TARGET}:: | ||
DESTINATION ${CMAKECONFIG_INSTALL_DIR} | ||
) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/realsense2Config.cmake" | ||
DESTINATION ${CMAKECONFIG_INSTALL_DIR} | ||
) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/realsense2ConfigVersion.cmake" | ||
DESTINATION ${CMAKECONFIG_INSTALL_DIR} | ||
) | ||
|
||
install(CODE "execute_process(COMMAND ldconfig)") | ||
|
||
# Set library pkgconfig file for facilitating 3rd party integration | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" | ||
) |
Oops, something went wrong.