Skip to content

Commit

Permalink
[foxy-backport] fast forward of ros2 (default) to foxy (#570)
Browse files Browse the repository at this point in the history
* restore compatibility with older Qt versions (#561)

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* Suppress warnings when building with older Qt versions. (#562)

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* Don't try to moc generate env_config.hpp file. (#550)

This removes one more warning from rviz_common builds.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* rewrite hack to avoid CMake warning with assimp 5.0.1 and older, apply cross platform (#565)

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* Use dedicated TransformListener thread (#551)

Signed-off-by: ymd-stella <world.applepie@gmail.com>

* restore alphabetical include order (#563)

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* Don't install test header files in rviz_rendering. (#564)

* Don't install test header files in rviz_rendering.

This change started as a relatively simple try at not installing
test includes when installing rviz_rendering.  As you can see,
it ballooned into quite a large change, so here is an explanation
of why.

We shouldn't install test include header files when installing
the package; that just ends up on the end user system, and
is a non-supported API.  Worse, we don't want to compile test
code in our main library.  Yet rviz_rendering is currently doing
both of these things.

Unfortunately, it is somewhat tricky to make that code and header
file private.  The problem is that that test code is used in
rviz_rendering, rviz_common, rviz_default_plugins, and
rviz_rendering_tests.

One solution might be to extract that test code into its own
package, and then have all of the other packages depend on it.
The problem is that that test package would both be depended
on by rviz_rendering (for tests), and depends itself on rviz_rendering
(for its functionality), creating a dependency loop.

The solution I opted for here is to copy the test code into the
appropriate packages.  This leads to some duplication of functionality,
but it effectively breaks the dependency loop and succeeds in
eliminating the test code from our installed library.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: ymd-stella <7959916+ymd-stella@users.noreply.github.com>
Co-authored-by: Karsten Knese <Karsten1987@users.noreply.github.com>
  • Loading branch information
5 people authored Jun 23, 2020
1 parent fb0c044 commit 594ba20
Show file tree
Hide file tree
Showing 67 changed files with 918 additions and 558 deletions.
71 changes: 3 additions & 68 deletions rviz_assimp_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,77 +52,12 @@ macro(build_assimp)
)
endmacro()

# Copy and fix the assimp config files on Ubuntu, in order to suppress a warning.
# This should be removed once upstream is updated to assimp-0.5.1, see:
# Override ON so that the following CMake logic in assimp 5.0.1 and older
# doesn't result in a CMake warning: if(ON)
# https://github.com/ros2/rviz/issues/524
# https://bugs.launchpad.net/ubuntu/+source/assimp/+bug/1869405
### BEGIN HACKS
set(IS_UBUNTU_FOCAL FALSE)
if(UNIX AND NOT APPLE)
find_program(LSB_RELEASE_EXEC lsb_release)
if(EXISTS "${LSB_RELEASE_EXEC}")
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -sr
OUTPUT_VARIABLE LSB_RELEASE_RELEASE_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(LSB_RELEASE_ID_SHORT "Unknown")
set(LSB_RELEASE_RELEASE_SHORT "Unknown")
endif()

if(${LSB_RELEASE_ID_SHORT} STREQUAL "Ubuntu" AND ${LSB_RELEASE_RELEASE_SHORT} STREQUAL "20.04")
set(IS_UBUNTU_FOCAL TRUE)
endif()
endif()

if(IS_UBUNTU_FOCAL)
file(GLOB_RECURSE assimp_target_files "/usr/lib/*/cmake/assimp-5.0/assimpTargets.cmake")
list(LENGTH assimp_target_files assimp_target_files_len)
if(assimp_target_files_len EQUAL 0)
message(FATAL_ERROR "failed to find assimpTargets.cmake as expected")
endif()
if(NOT assimp_target_files_len EQUAL 1)
message(FATAL_ERROR "found multiple assimpTargets.cmake files, unexpectedly")
endif()
list(GET assimp_target_files 0 assimp_target_file)
set(ON 1)

get_filename_component(assimp_target_dir "${assimp_target_file}" DIRECTORY)
set(new_assimp_target_dir "${CMAKE_CURRENT_BINARY_DIR}/assimp-0.5")

file(READ "${assimp_target_dir}/assimpTargets.cmake" assimp_targets_content)
string(REPLACE
"if(ON)"
"set(WORKAROUND ON)\nif(WORKAROUND)"
assimp_targets_content
${assimp_targets_content})
file(WRITE "${new_assimp_target_dir}/assimpTargets.cmake" "${assimp_targets_content}")
file(READ "${assimp_target_dir}/assimpTargets-release.cmake" assimp_targets_content)
string(REPLACE
"if(ON)"
"set(WORKAROUND ON)\nif(WORKAROUND)"
assimp_targets_content
${assimp_targets_content})
file(WRITE "${new_assimp_target_dir}/assimpTargets-release.cmake" "${assimp_targets_content}")
file(
COPY "${assimp_target_dir}/assimp-config.cmake"
DESTINATION "${new_assimp_target_dir}")
file(
COPY "${assimp_target_dir}/assimp-config-version.cmake"
DESTINATION "${new_assimp_target_dir}")
set(assimp_DIR "${new_assimp_target_dir}")

install(
DIRECTORY
${new_assimp_target_dir}/
DESTINATION
${CMAKE_INSTALL_PREFIX}/opt/rviz_assimp_vendor_custom_config
)
endif()
### END HACKS
find_package(assimp QUIET)

if(NOT assimp_FOUND OR "${assimp_VERSION}" VERSION_LESS 4.1.0)
Expand Down
27 changes: 3 additions & 24 deletions rviz_assimp_vendor/rviz_assimp_vendor-extras.cmake.in
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
# Use custom CMake config files for assimp on Ubuntu to work around a cmake warning.
# This should be removed once upstream is updated to assimp-0.5.1, see:
# Override ON so that the following CMake logic in assimp 5.0.1 and older
# doesn't result in a CMake warning: if(ON)
# https://github.com/ros2/rviz/issues/524
# https://bugs.launchpad.net/ubuntu/+source/assimp/+bug/1869405
### BEGIN HACKS
set(IS_UBUNTU FALSE)
if(UNIX AND NOT APPLE)
find_program(LSB_RELEASE_EXEC lsb_release)
if(EXISTS "${LSB_RELEASE_EXEC}")
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(LSB_RELEASE_ID_SHORT "Unknown")
endif()

if(${LSB_RELEASE_ID_SHORT} STREQUAL "Ubuntu")
set(IS_UBUNTU TRUE)
endif()
endif()

if(IS_UBUNTU)
set(assimp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/rviz_assimp_vendor_custom_config")
endif()
### END HACKS
set(ON 1)

find_package(assimp QUIET)

Expand Down
8 changes: 4 additions & 4 deletions rviz_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ find_package(rviz_ogre_vendor REQUIRED)

find_package(Qt5 REQUIRED COMPONENTS Widgets)

find_package(pluginlib REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
find_package(resource_retriever REQUIRED)
find_package(rviz_assimp_vendor REQUIRED)
Expand Down Expand Up @@ -70,7 +70,6 @@ configure_file(src/rviz_common/env_config.cpp.in ${ENV_CONFIG_CPP} @ONLY)

# These need to be added in the add_library() call
set(rviz_common_headers_to_moc
${ENV_CONFIG_HPP}
src/rviz_common/add_display_dialog.hpp
src/rviz_common/help_panel.hpp
include/rviz_common/properties/enum_property.hpp
Expand Down Expand Up @@ -206,7 +205,6 @@ set(rviz_common_source_files
src/rviz_common/interaction/selection_renderer.cpp
src/rviz_common/interaction/view_picker.cpp
src/rviz_common/splash_screen.cpp
# src/rviz_common/time_panel.cpp
src/rviz_common/transformation/identity_frame_transformer.cpp
src/rviz_common/tool_manager.cpp
src/rviz_common/tool_properties_panel.cpp
Expand Down Expand Up @@ -272,8 +270,8 @@ target_compile_definitions(rviz_common PRIVATE "RVIZ_COMMON_BUILDING_LIBRARY")
ament_export_targets(rviz_common)
ament_export_dependencies(
rviz_rendering
pluginlib
geometry_msgs
pluginlib
rclcpp
sensor_msgs
std_msgs
Expand Down Expand Up @@ -412,6 +410,7 @@ if(BUILD_TESTING)
test/interaction/mock_selection_renderer.hpp
test/interaction/selection_test_fixture.hpp
test/display_context_fixture.cpp
test/ogre_testing_environment.cpp
${SKIP_DISPLAY_TESTS})
if(TARGET selection_manager_test)
target_link_libraries(selection_manager_test
Expand All @@ -425,6 +424,7 @@ if(BUILD_TESTING)
test/interaction/selection_handler_test.cpp
test/interaction/selection_test_fixture.hpp
test/display_context_fixture.cpp
test/ogre_testing_environment.cpp
${SKIP_DISPLAY_TESTS})
if(TARGET selection_handler_test)
target_link_libraries(selection_handler_test
Expand Down
4 changes: 2 additions & 2 deletions rviz_common/test/display_context_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

void DisplayContextFixture::SetUpTestCase()
{
testing_environment_ = std::make_shared<rviz_rendering::OgreTestingEnvironment>();
testing_environment_ = std::make_shared<rviz_common::OgreTestingEnvironment>();
testing_environment_->setUpOgreTestEnvironment();

scene_manager_ = Ogre::Root::getSingletonPtr()->createSceneManager();
Expand Down Expand Up @@ -66,5 +66,5 @@ void DisplayContextFixture::TearDownTestCase()
}

Ogre::SceneManager * DisplayContextFixture::scene_manager_ = nullptr;
std::shared_ptr<rviz_rendering::OgreTestingEnvironment>
std::shared_ptr<rviz_common::OgreTestingEnvironment>
DisplayContextFixture::testing_environment_ = nullptr;
4 changes: 2 additions & 2 deletions rviz_common/test/display_context_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

#include "rclcpp/clock.hpp"

#include "test/rviz_rendering/ogre_testing_environment.hpp"
#include "ogre_testing_environment.hpp"

#include "mock_display_context.hpp"
#include "mock_window_manager_interface.hpp"
Expand All @@ -59,7 +59,7 @@ class DisplayContextFixture : public testing::Test

static void TearDownTestCase();

static std::shared_ptr<rviz_rendering::OgreTestingEnvironment> testing_environment_;
static std::shared_ptr<rviz_common::OgreTestingEnvironment> testing_environment_;
static Ogre::SceneManager * scene_manager_;

std::shared_ptr<MockDisplayContext> context_;
Expand Down
56 changes: 56 additions & 0 deletions rviz_common/test/ogre_testing_environment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2017, Bosch Software Innovations GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "ogre_testing_environment.hpp"

#include <string>

#include <OgreLogManager.h>

#include "rviz_rendering/render_system.hpp"

namespace rviz_common
{

void OgreTestingEnvironment::setUpOgreTestEnvironment(bool debug)
{
if (!debug) {
const std::string & name = "";
auto lm = new Ogre::LogManager();
lm->createLog(name, false, debug, true);
}
setUpRenderSystem();
}

void OgreTestingEnvironment::setUpRenderSystem()
{
rviz_rendering::RenderSystem::get();
}

} // end namespace rviz_common
51 changes: 51 additions & 0 deletions rviz_common/test/ogre_testing_environment.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2017, Bosch Software Innovations GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef OGRE_TESTING_ENVIRONMENT_HPP_
#define OGRE_TESTING_ENVIRONMENT_HPP_

namespace rviz_common
{
class OgreTestingEnvironment
{
public:
/**
* Set up a testing environment to run tests needing Ogre.
*
* @param: bool debug, if true, all logging of Ogre is send to std::out, if false no logging
* occurs. Since the logging pollutes the test output, it defaults to false
*/
void setUpOgreTestEnvironment(bool debug = false);

void setUpRenderSystem();
};

} // namespace rviz_common

#endif // OGRE_TESTING_ENVIRONMENT_HPP_
Loading

0 comments on commit 594ba20

Please sign in to comment.