Conversation
This reverts commit 2884900.
* find debug libraries correctly * cleanup cmake file. remove messages * set optimized/debug keywords correctly in place * style
We're shadowing this key for r2b2 since upstream is out of date but we should use the rosdep key so we can eventually target upstream. ros2/robot_model#1
* Change debug / optimized for generator expressions Signed-off-by: Luca Della Vedova <luca@openrobotics.org> * Fixed brackets and variable name Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
* Use CMake targets instead of variables Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Use TinyXML_INCLUDE_DIRS :( Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Put back urdf_world building everyting for Windows Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
This is so we can use older urdfdom_headers 1.0.4 that doesn't export the modern CMake targets (i.e. on ROS 1). Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
sloretz
left a comment
There was a problem hiding this comment.
Looks pretty reasonable to me. I have nitpicks that probably fit better as follow up PRs since they've been on the ros2 branch for a whlie. What should the next version number for the version released from master be?
|
|
||
| foreach(lib @PKG_LIBRARIES@) | ||
| set(onelib "${lib}-NOTFOUND") | ||
| set(onelibd "${lib}-NOTFOUND") |
There was a problem hiding this comment.
nit, I think find_library() will set this to ...-NOTFOUND already, no need to initialize it.
|
|
||
| # Default to C++14 | ||
| if(NOT CMAKE_CXX_STANDARD) | ||
| set(CMAKE_CXX_STANDARD 14) |
There was a problem hiding this comment.
If the CMake version is bumped a bit (Bionic supports 3.10 which is good enough) then the targets in this package can use
target_compile_features(target_name PUBLIC cxx_std_14)
This has the advantage that if C++ 14 is used in the headers then downstream targets will also get the C++ 14 flags.
|
|
||
| include(CTest) | ||
| if(BUILD_TESTING) | ||
| add_subdirectory(test) |
There was a problem hiding this comment.
nit, there's a use of include_directories() in test/CMakeLists.txt
urdfdom/urdf_parser/test/CMakeLists.txt
Line 14 in e24f47e
| if(MSVC) | ||
| set(CMAKE_DEBUG_POSTFIX "d") | ||
| # Export symbols on Windows by default | ||
| add_definitions(-DURDFDOM_EXPORTS) |
There was a problem hiding this comment.
nit
target_compile_definitions(target_name PRIVATE URDFDOM_EXPORTS)
and no need to make it conditional on MSVC, the visibility header looks like defining it would be fine on other platforms too.
There was a problem hiding this comment.
Observation that may be ignored for now, if this PR is just to bring ros2 changes on master and not to fix all possible problems in ros2 branch: as URDFDOM_EXPORTS should not be defined if the library is compiled as static, this definition is tipically added automatically by CMake via the DEFINE_SYMBOL property. As in this case the default naming of the DEFINE_SYMBOL is not the correct one, it is possible to simply redefine it as necessary, i.e. add after the add_library calls:
set_target_properties(urdfdom_world PROPERTIES DEFINE_SYMBOL URDFDOM_EXPORTS)
set_target_properties(urdfdom_model PROPERTIES DEFINE_SYMBOL URDFDOM_EXPORTS)
Note that the need for setting DEFINE_SYMBOL two times is a consequence of the fact that urdfdom contains two libraries (urdf_model and urdf_world) that contains exactly the same public symbols (as exportWorld and parseWorld are not defined in public headers).
(especially because we have the peculiar case of two libraries,
| set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake) | ||
| endif() | ||
| string(REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_CMAKE_DIR_TO_PREFIX "${CMAKE_CONFIG_INSTALL_DIR}") | ||
| string(REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_LIBDIR_TO_PREFIX "${CMAKE_INSTALL_LIBDIR}") |
There was a problem hiding this comment.
As for https://github.com/ros/urdfdom/pull/157/files#r665928610, this comment can be safely ignored if the goal of this PR is not to fix all the problems of ros2 branch, but rather to align master and ros2 as fast as possible.
Note that if you need to compute the relative path between two directories, you can use the file(RELATIVE_PATH [..] [..]) CMake command, see for example https://github.com/dartsim/dart/blob/31fb4ea3897cf26788aa16facda4e90f3fbab473/CMakeLists.txt#L409 .
|
Thanks @clalancette for this attempt to cleanup history and sync ROS1 and ROS2 branches. What about the release strategy? As far as I remember, ROS1 relies on the system package released via the Debian release process (which was cumbersome). However, ROS2 releases the package via the ROS release process, right? |
Ever since we merged the ROS 2 version of urdfdom into this repository, there has been something of a split-brain here. This repository is really meant to be ROS-agnostic, but the stuff on the
ros2branch here clearly was not. This is a problem for downstream packagers because the latest tag on the master branch is 1.0.4, but the latest tag overall on this repository is on theros2branch (2.3.3). One bug that mentions this is #156 , but there have been others.This PR is an attempt to solve these problems. What this PR does is to rebase the
ros2branch onto master, making a few changes along the way. By getting the changes from theros2branch onto master, it resolves the above ambiguity and also brings some of the latest development onto the master branch. The changes are necessary so that the code from theros2branch is not ROS 2 specific.The changes on this branch can be summarized in the following:
parseCamera,parseRay,parseSensor, andparseModelStateto the public API. Since those functions are already implemented internally, here is no ABI change here at all. In some sense this change gets us further away from our goal of removing TinyXML, but I didn't want to do too many things in this PR, so I left it as-is.include_directories), global link directives (link_directories), custom setting of the CXX_STANDARD, etc. It also includes creating modern exported interfaces for the libraries in this package. One place where we could not use modern CMake was finding the include directories forurdfdom_headers. That's because the modern interfaces forurdfdom_headersis not available in the version released in Ubuntu 20.04, so we can't rely on it.I've tested this PR by building it standalone (
mkdir build ; cd build ; cmake .. ; make -j10), building it withcatkin_make_isolatedin a ROS 1 overlay, and by building it withcolconin a ROS 2 workspace (on Linux and Windows), and it seems to work in all of those circumstances.If we merge this, this will obsolete #146 .