Skip to content

Commit

Permalink
Merge pull request #158 from j-rivero/jrivero/ros2-merge
Browse files Browse the repository at this point in the history
Unify master and ros2 branches (merge ros2 into master)
  • Loading branch information
clalancette authored Sep 24, 2021
2 parents 99c6f58 + 85fc714 commit 36be7f8
Show file tree
Hide file tree
Showing 17 changed files with 325 additions and 118 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ros1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: urdfdom ROS1 CI

on:
push:
pull_request:

jobs:
build_ros1:
name: ROS1 CI
runs-on: ubuntu-18.04
steps:
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: melodic
- uses: ros-tooling/[email protected]
with:
package-name: urdfdom
target-ros1-distro: melodic
20 changes: 20 additions & 0 deletions .github/workflows/ros2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: urdfdom ROS2 CI

on:
push:
pull_request:

jobs:

build_ros2:
name: ROS2 CI
runs-on: ubuntu-20.04
steps:
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: galactic
- uses: ros-tooling/[email protected]
with:
package-name: urdfdom
target-ros2-distro: galactic
69 changes: 69 additions & 0 deletions .github/workflows/system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: urdfdom system CI

on:
push:
pull_request:

jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC",
os: ubuntu-latest,
build_type: "Release",
cc: "gcc",
cxx: "g++",
}
- {
name: "Ubuntu Latest GCC",
os: ubuntu-latest,
build_type: "Debug",
cc: "gcc",
cxx: "g++",
}
- {
name: "Ubuntu Bionic GCC",
os: ubuntu-18.04,
build_type: "Release",
cc: "gcc",
cxx: "g++",
}
steps:
- uses: actions/checkout@v2

- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'Ubuntu')
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
cmake --version
gcc --version
- name: Configure
shell: bash
run: |
mkdir build
cmake \
-S . \
-B build \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
- name: Build
shell: bash
run: cmake --build build --config ${{ matrix.config.build_type }}

- name: Run tests on Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu')
shell: bash
run: |
cd build
make test ARGS="-VV"
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .travis/build

This file was deleted.

50 changes: 31 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project (urdfdom CXX C)

set (URDF_MAJOR_VERSION 1)
Expand All @@ -24,6 +24,10 @@ if (HAS_VISIBILITY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# This shouldn't be necessary, but there has been trouble
# with MSVC being set off, but MSVCXX ON.
if(MSVC OR MSVC90 OR MSVC10)
Expand All @@ -32,23 +36,23 @@ endif (MSVC OR MSVC90 OR MSVC10)

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

find_package(TinyXML REQUIRED)
include_directories(SYSTEM ${TinyXML_INCLUDE_DIRS})

find_package(urdfdom_headers 1.0.3 REQUIRED)
include_directories(SYSTEM ${urdfdom_headers_INCLUDE_DIRS})
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
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()

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)
include_directories(SYSTEM ${console_bridge_INCLUDE_DIRS})
link_directories(${console_bridge_LIBRARY_DIRS})

#In Visual Studio a special postfix for
#libraries compiled in debug is used
#In Visual Studio a special postfix for libraries compiled in debug is used
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_DEBUG_POSTFIX "d")
endif(MSVC)

# Control where libraries and executables are placed during the build
Expand All @@ -58,19 +62,23 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"

enable_testing()

add_subdirectory(urdf_parser)

if(WIN32 AND NOT CYGWIN)
set(CMAKE_CONFIG_INSTALL_DIR CMake)
else()
set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}/cmake/)
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}")

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_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)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
install(FILES ${CMAKE_BINARY_DIR}/${cmake_conf_file}
DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} COMPONENT cmake)

Expand All @@ -85,10 +93,14 @@ if (NOT MSVC)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ COMPONENT pkgconfig)
endif()


# Add uninstall target
# Ref: http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
configure_file("${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake.in" "${PROJECT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/uninstall.cmake")
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${PROJECT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/uninstall.cmake")

message(STATUS "Configuration successful. Type make to compile urdfdom")

Expand Down
2 changes: 1 addition & 1 deletion cmake/pkgconfig/urdfdom.pc.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was generated by CMake for @PROJECT_NAME@
prefix=@CMAKE_INSTALL_PREFIX@
prefix=${pcfiledir}/../@RELATIVE_PATH_LIBDIR_TO_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/include
Expand Down
30 changes: 23 additions & 7 deletions cmake/urdfdom-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,41 @@ if (@PKG_NAME@_CONFIG_INCLUDED)
endif()
set(@PKG_NAME@_CONFIG_INCLUDED TRUE)

set(@PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include" "@TinyXML_INCLUDE_DIRS@")
set(@PKG_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/include" "@TinyXML_INCLUDE_DIRS@")

foreach(lib @PKG_LIBRARIES@)
set(onelib "${lib}-NOTFOUND")
set(onelibd "${lib}-NOTFOUND")
find_library(onelib ${lib}
PATHS "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@"
NO_DEFAULT_PATH
)
if(NOT onelib)
PATHS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_LIBDIR@"
NO_DEFAULT_PATH)
find_library(onelibd ${lib}@CMAKE_DEBUG_POSTFIX@
PATHS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_LIBDIR@"
NO_DEFAULT_PATH)
if(onelib-NOTFOUND AND onelibd-NOTFOUND)
message(FATAL_ERROR "Library '${lib}' in package @PKG_NAME@ is not installed properly")
endif()
list(APPEND @PKG_NAME@_LIBRARIES ${onelib})
if(onelib AND onelibd)
list(APPEND @PKG_NAME@_LIBRARIES $<$<NOT:$<CONFIG:Debug>>:${onelib}>)
list(APPEND @PKG_NAME@_LIBRARIES $<$<CONFIG:Debug>:${onelibd}>)
else()
if(onelib)
list(APPEND @PKG_NAME@_LIBRARIES ${onelib})
else()
list(APPEND @PKG_NAME@_LIBRARIES ${onelibd})
endif()
endif()
list(APPEND @PKG_NAME@_TARGETS @PROJECT_NAME@::${lib})
endforeach()


foreach(dep @PKG_DEPENDS@)
if(NOT ${dep}_FOUND)
find_package(${dep})
endif()
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${${dep}_LIBRARIES})
endforeach()

foreach(exp @PKG_EXPORTS@)
include(${@PROJECT_NAME@_DIR}/${exp}Export.cmake)
endforeach()
31 changes: 31 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<package format="2">
<name>urdfdom</name>
<version>2.3.5</version>
<description>A library to access URDFs using the DOM model.</description>
<maintainer email="[email protected]">Steven! Ragnarök</maintainer>

<license>BSD</license>

<author>Wim Meeussen</author>
<author>John Hsu</author>
<author>Ioan Sucan</author>

<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 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 version_gte="0.2.3">urdfdom_headers</exec_depend>

<export>
<build_type>cmake</build_type>
</export>
</package>
Loading

0 comments on commit 36be7f8

Please sign in to comment.