Skip to content

Commit

Permalink
Merge branch 'master' into movespecification
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Jan 20, 2024
2 parents b63f715 + 29426ec commit efb57e6
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 402 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ros1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
jobs:
build_ros1:
name: ROS1 CI
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: ros-tooling/setup-ros@v0.2
- uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: melodic
- uses: ros-tooling/action-ros-ci@v0.2
required-ros-distributions: noetic
- uses: ros-tooling/action-ros-ci@v0.3
with:
package-name: urdfdom
target-ros1-distro: melodic
target-ros1-distro: noetic
14 changes: 7 additions & 7 deletions .github/workflows/ros2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: urdfdom ROS2 CI
name: urdfdom ROS 2 CI

on:
push:
Expand All @@ -8,13 +8,13 @@ on:
jobs:

build_ros2:
name: ROS2 CI
runs-on: ubuntu-20.04
name: ROS 2 CI
runs-on: ubuntu-22.04
steps:
- uses: ros-tooling/setup-ros@v0.2
- uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: galactic
- uses: ros-tooling/action-ros-ci@v0.2
required-ros-distributions: rolling
- uses: ros-tooling/action-ros-ci@v0.3
with:
package-name: urdfdom
target-ros2-distro: galactic
target-ros2-distro: rolling
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
cxx: "g++",
}
- {
name: "Ubuntu Bionic GCC",
os: ubuntu-18.04,
name: "Ubuntu Focal GCC",
os: ubuntu-20.04,
build_type: "Release",
cc: "gcc",
cxx: "g++",
Expand All @@ -44,7 +44,7 @@ jobs:
run: |
sudo apt-get -qq update
sudo apt-get -qq upgrade -y
sudo apt-get -qq install -y build-essential cmake libconsole-bridge-dev liburdfdom-headers-dev libtinyxml-dev
sudo apt-get -qq install -y build-essential cmake libconsole-bridge-dev liburdfdom-headers-dev libtinyxml2-dev
cmake --version
gcc --version
Expand Down
53 changes: 27 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project (urdfdom CXX C)

set (URDF_MAJOR_VERSION 3)
set (URDF_MAJOR_VERSION 4)
set (URDF_MINOR_VERSION 0)
set (URDF_PATCH_VERSION 2)
set (URDF_PATCH_VERSION 0)

set (URDF_VERSION ${URDF_MAJOR_VERSION}.${URDF_MINOR_VERSION}.${URDF_PATCH_VERSION})
set (URDF_MAJOR_MINOR_VERSION ${URDF_MAJOR_VERSION}.${URDF_MINOR_VERSION})
Expand Down Expand Up @@ -43,18 +43,11 @@ if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
endif (MSVC OR MSVC90 OR MSVC10)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(tinyxml_vendor QUIET)
find_package(TinyXML)
# bionic has not cmake module, workaround
if (NOT TinyXML_FOUND AND UNIX)
include(FindPkgConfig)
pkg_check_modules (TinyXML tinyxml)
else()
# Make it fail in platforms without pkgconfig
find_package(TinyXML REQUIRED) # bionic has not cmake module
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(tinyxml2_vendor QUIET)
find_package(TinyXML2 REQUIRED)

find_package(urdfdom_headers 1.0 REQUIRED)
find_package(console_bridge_vendor QUIET) # Provides console_bridge 0.4.0 on platforms without it.
find_package(console_bridge REQUIRED)
Expand All @@ -66,37 +59,45 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"

enable_testing()

if(WIN32 AND NOT CYGWIN)
set(CMAKE_CONFIG_INSTALL_DIR CMake)
else()
set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake)
endif()
set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake)
string(REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_CMAKE_DIR_TO_PREFIX "${CMAKE_CONFIG_INSTALL_DIR}")
string(REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_LIBDIR_TO_PREFIX "${CMAKE_INSTALL_LIBDIR}")

add_subdirectory(urdf_parser)

set(PKG_NAME ${PROJECT_NAME})
set(PKG_LIBRARIES urdfdom_sensor urdfdom_model_state urdfdom_model urdfdom_world)
set(PKG_DEPENDS urdfdom_headers console_bridge)
set(PKG_DEPENDS urdfdom_headers)
set(PKG_EXPORTS urdfdom)
set(cmake_conf_file "cmake/urdfdom-config.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${cmake_conf_file}.in" "${CMAKE_BINARY_DIR}/${cmake_conf_file}" @ONLY)
set(cmake_conf_file "cmake/urdfdom-config")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}Version.cmake"
VERSION ${URDF_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_package_config_file("${cmake_conf_file}.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}.cmake"
INSTALL_DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}Version.cmake"
DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}
)

install(FILES package.xml DESTINATION share/${PROJECT_NAME})
install(FILES ${CMAKE_BINARY_DIR}/${cmake_conf_file}
DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} COMPONENT cmake)

# Make the package config file
set(PKG_DESC "Unified Robot Description Format")
set(PKG_DEPENDS "urdfdom_headers console_bridge") # make the list separated by spaces instead of ;
set(PKG_DEPENDS "urdfdom_headers") # make the list separated by spaces instead of ;
set(PKG_URDF_LIBS "-lurdfdom_sensor -lurdfdom_model_state -lurdfdom_model -lurdfdom_world")
set(pkg_conf_file "cmake/pkgconfig/urdfdom.pc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/${pkg_conf_file}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ COMPONENT pkgconfig)



# Add uninstall target
# Ref: http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
configure_file(
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ The URDF (U-Robot Description Format) library provides core data structures and

The details of the URDF specifications reside in the [specification folder](specification) in this repo.

### Build Status
[![Build Status](https://travis-ci.org/ros/urdfdom.png)](https://travis-ci.org/ros/urdfdom)

### Using with ROS

Expand Down
74 changes: 0 additions & 74 deletions cmake/FindTinyXML.cmake

This file was deleted.

78 changes: 78 additions & 0 deletions cmake/FindTinyXML2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# TinyXML2_FOUND
# TinyXML2_INCLUDE_DIRS
# TinyXML2_LIBRARIES

# try to find the CMake config file for TinyXML2 first
if(NOT TinyXML2_FOUND)
find_package(TinyXML2 CONFIG QUIET)
endif()
if(TinyXML2_FOUND)
message(STATUS "Found TinyXML2 via Config file: ${TinyXML2_DIR}")
if(NOT TINYXML2_LIBRARY)
# in this case, we're probably using TinyXML2 version 5.0.0 or greater
# in which case tinyxml2 is an exported target and we should use that
if(TARGET tinyxml2)
set(TINYXML2_LIBRARY tinyxml2)
elseif(TARGET tinyxml2::tinyxml2)
set(TINYXML2_LIBRARY tinyxml2::tinyxml2)
elseif(TinyXML2_FIND_REQUIRED)
message(FATAL_ERROR "Unable to determine target for TinyXML2")
endif()
list(APPEND TinyXML2_TARGETS ${TINYXML2_LIBRARY})
else()
# Only perform that logic once
if(NOT TARGET tinyxml2::tinyxml2)
# TINYXML2_LIBRARY is composed of debug;<path\to\debug.lib>;optimized;<path\to\release.lib>
# we have to extract the appropriate component based on the current configuration.
list(LENGTH TINYXML2_LIBRARY TINYXML_LIBRARY_LIST_LENGTH)
if(NOT ${TINYXML_LIBRARY_LIST_LENGTH} EQUAL 4)
message(FATAL_ERROR "Unable to extract the library file path from ${TINYXML2_LIBRARY}")
endif()
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
list(GET TINYXML2_LIBRARY 0 ASSERT_DEBUG)
if(NOT ${ASSERT_DEBUG} STREQUAL "debug")
message(FATAL_ERROR "could not parse debug library path from ${TINYXML2_LIBRARY}")
endif()
list(GET TINYXML2_LIBRARY 1 TINYXML2_LIBRARY_PATH)
else()
list(GET TINYXML2_LIBRARY 2 ASSERT_OPTIMIZED)
if(NOT ${ASSERT_OPTIMIZED} STREQUAL "optimized")
message(FATAL_ERROR "could not parse library path from ${TINYXML2_LIBRARY}")
endif()
list(GET TINYXML2_LIBRARY 3 TINYXML2_LIBRARY_PATH)
endif()
if(NOT EXISTS ${TINYXML2_LIBRARY_PATH})
message(FATAL_ERROR "library file path ${TINYXML2_LIBRARY_PATH} does not exist")
endif()

add_library(tinyxml2::tinyxml2 UNKNOWN IMPORTED)
set_property(TARGET tinyxml2::tinyxml2 PROPERTY IMPORTED_LOCATION ${TINYXML2_LIBRARY_PATH})
set_property(TARGET tinyxml2::tinyxml2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TINYXML2_INCLUDE_DIR})
list(APPEND TinyXML2_TARGETS tinyxml2::tinyxml2)
endif()
endif()
else()
find_path(TINYXML2_INCLUDE_DIR NAMES tinyxml2.h)

find_library(TINYXML2_LIBRARY tinyxml2)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR)

mark_as_advanced(TINYXML2_INCLUDE_DIR TINYXML2_LIBRARY)

if(NOT TARGET tinyxml2::tinyxml2)
add_library(tinyxml2::tinyxml2 UNKNOWN IMPORTED)
set_property(TARGET tinyxml2::tinyxml2 PROPERTY IMPORTED_LOCATION ${TINYXML2_LIBRARY})
set_property(TARGET tinyxml2::tinyxml2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TINYXML2_INCLUDE_DIR})
list(APPEND TinyXML2_TARGETS tinyxml2::tinyxml2)
endif()
endif()

# Set mixed case INCLUDE_DIRS and LIBRARY variables from upper case ones.
if(NOT TinyXML2_INCLUDE_DIRS)
set(TinyXML2_INCLUDE_DIRS ${TINYXML2_INCLUDE_DIR})
endif()
if(NOT TinyXML2_LIBRARIES)
set(TinyXML2_LIBRARIES ${TINYXML2_LIBRARY})
endif()
10 changes: 9 additions & 1 deletion cmake/urdfdom-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
@PACKAGE_INIT@

if (@PKG_NAME@_CONFIG_INCLUDED)
return()
endif()
set(@PKG_NAME@_CONFIG_INCLUDED TRUE)

set(@PKG_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "@TinyXML_INCLUDE_DIRS@")
set(CMAKE_MODULE_PATH_BACKUP_URDFDOM ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH "${@PROJECT_NAME@_DIR}")

set(@PKG_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")

foreach(lib @PKG_LIBRARIES@)
set(onelib "${lib}-NOTFOUND")
Expand All @@ -30,6 +35,7 @@ foreach(lib @PKG_LIBRARIES@)
list(APPEND @PKG_NAME@_TARGETS @PROJECT_NAME@::${lib})
endforeach()

find_package(tinyxml2_vendor QUIET)
foreach(dep @PKG_DEPENDS@)
if(NOT ${dep}_FOUND)
find_package(${dep})
Expand All @@ -41,3 +47,5 @@ endforeach()
foreach(exp @PKG_EXPORTS@)
include(${@PROJECT_NAME@_DIR}/${exp}Export.cmake)
endforeach()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_BACKUP_URDFDOM})
14 changes: 7 additions & 7 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>urdfdom</name>
<version>3.1.1</version>
<version>4.0.0</version>
<description>A library to access URDFs using the DOM model.</description>

<maintainer email="[email protected]">Chris Lalancette</maintainer>
Expand All @@ -17,20 +17,20 @@

<build_depend>console_bridge_vendor</build_depend>
<build_depend>libconsole-bridge-dev</build_depend>
<build_depend>tinyxml</build_depend>
<build_depend>tinyxml_vendor</build_depend>
<build_depend>tinyxml2</build_depend>
<build_depend>tinyxml2_vendor</build_depend>
<build_depend version_gte="0.2.3">urdfdom_headers</build_depend>

<buildtool_depend>cmake</buildtool_depend>

<exec_depend>console_bridge_vendor</exec_depend>
<exec_depend>libconsole-bridge-dev</exec_depend>
<exec_depend>tinyxml</exec_depend>
<exec_depend>tinyxml_vendor</exec_depend>
<exec_depend>tinyxml2</exec_depend>
<exec_depend>tinyxml2_vendor</exec_depend>
<exec_depend version_gte="0.2.3">urdfdom_headers</exec_depend>

<test_depend>python3</test_depend>

<export>
<build_type>cmake</build_type>
</export>
Expand Down
Loading

0 comments on commit efb57e6

Please sign in to comment.