Skip to content

Commit

Permalink
realsense2 PRIVATE rsutils, to avoid .a dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Oct 13, 2023
1 parent 9c35d0d commit a653a93
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CMake/opengl_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if (POLICY CMP0072)
endif()

find_package(OpenGL REQUIRED)
set(DEPENDENCIES realsense2 glfw ${OPENGL_LIBRARIES})
list( APPEND DEPENDENCIES glfw ${OPENGL_LIBRARIES} )
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ target_include_directories( rsutils
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/third-party/json/include>
)

target_link_libraries( ${LRS_TARGET} PUBLIC rsutils )
target_link_libraries( ${LRS_TARGET} PRIVATE rsutils )

if(BUILD_WITH_DDS)
if (CMAKE_SYSTEM MATCHES "Windows" OR CMAKE_SYSTEM MATCHES "Linux")
Expand Down
6 changes: 3 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# View the makefile commands during build
#set(CMAKE_VERBOSE_MAKEFILE on)

set( DEPENDENCIES realsense2 )

if(BUILD_GRAPHICAL_EXAMPLES)
include(${CMAKE_SOURCE_DIR}/CMake/opengl_config.cmake)
else()
if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
find_library(log-lib log)
set(DEPENDENCIES realsense2 log)
else()
set(DEPENDENCIES realsense2)
list( APPEND DEPENDENCIES log )
endif()
endif()

Expand Down
6 changes: 2 additions & 4 deletions src/gl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(REALSENSE_GL_PUBLIC_HEADERS

set(CMAKECONFIG_GL_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${LRS_GL_TARGET}")

set( DEPENDENCIES realsense2 rsutils )
include(${CMAKE_SOURCE_DIR}/CMake/opengl_config.cmake)

if (${BUILD_SHARED_LIBS} AND ${BUILD_EASYLOGGINGPP})
Expand Down Expand Up @@ -88,10 +89,7 @@ configure_package_config_file(../../CMake/realsense2-glConfig.cmake.in realsense

configure_file(../../config/librealsense-gl.pc.in ../../config/realsense2-gl.pc @ONLY)

target_link_libraries( ${PROJECT_NAME}
PRIVATE
${DEPENDENCIES}
)
target_link_libraries( ${PROJECT_NAME} PRIVATE ${DEPENDENCIES} )

# CMake prior to 3.13 cannot install targets located in sub-directories.
#https://gitlab.kitware.com/cmake/cmake/merge_requests/2152
Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# View the makefile commands during build
#set(CMAKE_VERBOSE_MAKEFILE on)

list(APPEND DEPENDENCIES realsense2)
list( APPEND DEPENDENCIES realsense2 rsutils )

if(BUILD_TOOLS)
add_subdirectory(convert)
Expand Down
93 changes: 45 additions & 48 deletions tools/rosbag-inspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,53 @@ cmake_minimum_required(VERSION 2.8.3...3.20.5)
project(RealsenseToolsRosbagInspector)


if(BUILD_GRAPHICAL_EXAMPLES)

set(RS_ROSBAG_INSPECTOR_CPP
rs-rosbag-inspector.cpp
files_container.h
print_helpers.h
rosbag_content.h
../../common/os.h
../../common/os.cpp
../../third-party/glad/glad.c
../../third-party/imgui/imgui.cpp
../../third-party/imgui/imgui_draw.cpp
../../third-party/imgui/imgui_impl_glfw.cpp
../../third-party/imgui/imgui-fonts-karla.hpp
../../third-party/imgui/imgui-fonts-fontawesome.hpp
../../third-party/tinyfiledialogs/tinyfiledialogs.c
../../third-party/tinyfiledialogs/tinyfiledialogs.h
)

if(WIN32)
add_executable(rs-rosbag-inspector WIN32 ${RS_ROSBAG_INSPECTOR_CPP})
include_directories(../../third-party/imgui ../../common ../../third-party/glad
../../third-party/tinyfiledialogs ../../third-party ${CMAKE_CURRENT_SOURCE_DIR}/res/)
else()
add_executable(rs-rosbag-inspector ${RS_ROSBAG_INSPECTOR_CPP})
include_directories(../../third-party/imgui ../../common ../../third-party/glad
../../third-party/tinyfiledialogs ../../third-party)
endif()
set_property(TARGET rs-rosbag-inspector PROPERTY CXX_STANDARD 11)

target_include_directories(rs-rosbag-inspector PRIVATE
${ROSBAG_HEADER_DIRS}
${BOOST_INCLUDE_PATH}
${LZ4_INCLUDE_PATH}
)

target_link_libraries(rs-rosbag-inspector realsense-file ${DEPENDENCIES})

set_target_properties (rs-rosbag-inspector PROPERTIES
FOLDER Tools
set(RS_ROSBAG_INSPECTOR_CPP
rs-rosbag-inspector.cpp
files_container.h
print_helpers.h
rosbag_content.h
../../common/os.h
../../common/os.cpp
../../third-party/glad/glad.c
../../third-party/imgui/imgui.cpp
../../third-party/imgui/imgui_draw.cpp
../../third-party/imgui/imgui_impl_glfw.cpp
../../third-party/imgui/imgui-fonts-karla.hpp
../../third-party/imgui/imgui-fonts-fontawesome.hpp
../../third-party/tinyfiledialogs/tinyfiledialogs.c
../../third-party/tinyfiledialogs/tinyfiledialogs.h
)

using_easyloggingpp( rs-rosbag-inspector SHARED )
if(WIN32)
add_executable(rs-rosbag-inspector WIN32 ${RS_ROSBAG_INSPECTOR_CPP})
include_directories(../../third-party/imgui ../../common ../../third-party/glad
../../third-party/tinyfiledialogs ../../third-party ${CMAKE_CURRENT_SOURCE_DIR}/res/)
else()
add_executable(rs-rosbag-inspector ${RS_ROSBAG_INSPECTOR_CPP})
include_directories(../../third-party/imgui ../../common ../../third-party/glad
../../third-party/tinyfiledialogs ../../third-party)
endif()
set_property(TARGET rs-rosbag-inspector PROPERTY CXX_STANDARD 11)

install(
TARGETS
target_include_directories(rs-rosbag-inspector PRIVATE
${ROSBAG_HEADER_DIRS}
${BOOST_INCLUDE_PATH}
${LZ4_INCLUDE_PATH}
)

rs-rosbag-inspector
target_link_libraries(rs-rosbag-inspector realsense-file ${DEPENDENCIES})

RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
endif()
set_target_properties (rs-rosbag-inspector PROPERTIES
FOLDER Tools
)

using_easyloggingpp( rs-rosbag-inspector SHARED )

install(
TARGETS

rs-rosbag-inspector

RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
2 changes: 1 addition & 1 deletion unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(DEPENDENCIES realsense2)
set( DEPENDENCIES realsense2 rsutils )

find_package (Python3 COMPONENTS Interpreter Development)
if (NOT ${BUILD_EASYLOGGINGPP})
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/unit-test-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def process_cpp( dir, builddir ):
shared = False
static = False
custom_main = False
dependencies = 'realsense2'
dependencies = 'realsense2 rsutils'
for cmake_directive in file.grep( '^//#cmake:\s*', dir + '/' + f ):
m = cmake_directive['match']
index = cmake_directive['index']
Expand Down
2 changes: 1 addition & 1 deletion wrappers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1.0)

project(RealsenseWrappers)

set(DEPENDENCIES realsense2)
set(DEPENDENCIES realsense2 rsutils)

if (BUILD_PYTHON_BINDINGS OR BUILD_PYTHON_DOCS)
if (NOT INTERNET_CONNECTION)
Expand Down

0 comments on commit a653a93

Please sign in to comment.