diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index aba4c38d..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(xacro) - -find_package(ament_cmake REQUIRED) - -install(FILES scripts/completion.bash DESTINATION share/${PROJECT_NAME}/environment) - -## The following manually installs the python package and the entry-point script -## Using ament_cmake, we cannot actually use setup.py to install these... - -# install xacro python package -ament_python_install_package(xacro) -# install main script -install(PROGRAMS scripts/xacro DESTINATION bin) -install(PROGRAMS scripts/xacro DESTINATION lib/${PROJECT_NAME}) - -if(BUILD_TESTING) - ## run linters as defined in package.xml - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - - ## add tests for xacro's cmake functions - add_subdirectory(test) -endif() - -ament_package( - CONFIG_EXTRAS cmake/xacro-extras.cmake -) diff --git a/cmake/xacro-extras.cmake b/cmake/xacro-extras.cmake deleted file mode 100644 index cd17f770..00000000 --- a/cmake/xacro-extras.cmake +++ /dev/null @@ -1,146 +0,0 @@ -## xacro_add_xacro_file( [] [REMAP ...] -## [OUTPUT ] DEPENDS ) -## -## Creates a command to run xacro on like so: -## xacro -o [] -## -## If was not specified, it is determined from removing the suffix .xacro -## The absolute output file name is returned in variable , which defaults to -## XACRO_OUTPUT_FILE. -## -## In order to actually build and install, you need to provide a custom target: -## foreach(xacro_file ${MY_XACRO_FILES}) -## xacro_add_xacro_file(${xacro_file} REMAP bar:=foo foo:=bar) -## list(APPEND xacro_outputs ${XACRO_OUTPUT_FILE}) -## endforeach() -## xacro_install(xacro_target ${xacro_outputs} DESTINATION xml) -## -## Alternatively to xacro_install, you can call -## install(xacro_target ${xacro_outputs} DESTINATION share/${PROJECT_NAME}/xml) -## -## For conveniency, you might want to use xacro_add_files(), which does the same: -## xacro_add_files(${MY_XACRO_FILES} REMAP bar:=foo foo:=bar -## TARGET xacro_target INSTALL DESTINATION xml) -function(xacro_add_xacro_file input) - # parse arguments - set(options) - set(oneValueArgs OUTPUT) - set(multiValueArgs REMAP DEPENDS) - cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - ## process arguments - # retrieve output file name - if(_XACRO_UNPARSED_ARGUMENTS) - # output file explicitly specified - list(GET _XACRO_UNPARSED_ARGUMENTS 0 output) - list(REMOVE_AT _XACRO_UNPARSED_ARGUMENTS 0) - # any remaining unparsed args? - if(_XACRO_UNPARSED_ARGUMENTS) - message(WARNING "unknown arguments: ${_XACRO_UNPARSED_ARGUMENTS}") - endif(_XACRO_UNPARSED_ARGUMENTS) - else() - # implicitly determine output file from input - if(${input} MATCHES "(.*)[.]xacro$") - set(output ${CMAKE_MATCH_1}) - else() - message(FATAL_ERROR "no specified for: " ${input}) - endif() - endif() - # message(STATUS "output: ${output}") - - ## determine absolute output target location - if(IS_ABSOLUTE ${output}) - set(abs_output ${output}) - else() - set(abs_output ${CMAKE_CURRENT_BINARY_DIR}/${output}) - endif() - # message(STATUS "abs_output: ${abs_output}") - - ## export abs_output to parent scope in variable ${_XACRO_OUTPUT} - if(NOT _XACRO_OUTPUT) - set(_XACRO_OUTPUT XACRO_OUTPUT_FILE) - endif() - set(${_XACRO_OUTPUT} ${abs_output} PARENT_SCOPE) - - ## Call out to xacro to determine dependencies - message(STATUS "xacro: determining deps for: " ${input} " ...") - execute_process(COMMAND xacro --deps ${input} ${_XACRO_REMAP} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE _xacro_result - ERROR_VARIABLE _xacro_err - OUTPUT_VARIABLE _xacro_deps_result - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(_xacro_result) - message(WARNING "failed to determine deps for: ${input} -${_xacro_err}") - endif(_xacro_result) - - separate_arguments(_xacro_deps_result) - - ## command to actually call xacro - add_custom_command(OUTPUT ${output} - COMMAND xacro -o ${abs_output} ${input} ${_XACRO_REMAP} - DEPENDS ${input} ${_xacro_deps_result} ${_XACRO_DEPENDS} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "xacro: generating ${output} from ${input}" - ) -endfunction(xacro_add_xacro_file) - - -## xacro_install( [ ...] DESTINATION ) -## -## installs xacro-generated files into share// -function(xacro_install target) - # parse arguments - set(oneValueArgs DESTINATION) - cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(outputs ${_XACRO_UNPARSED_ARGUMENTS}) - - ## normal install - install(FILES ${outputs} DESTINATION share/${PROJECT_NAME}/${_XACRO_DESTINATION}) -endfunction(xacro_install) - - -## xacro_add_files( [ ...] [REMAP ...] [DEPENDS ] -## [TARGET ] [INSTALL [DESTINATION ]]) -## -## create make to generate xacro files and optionally install to share// -function(xacro_add_files) - # parse arguments - set(options INSTALL) - set(oneValueArgs OUTPUT TARGET DESTINATION) - set(multiValueArgs REMAP DEPENDS) - cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - ## process arguments - # prepare REMAP args (prepending REMAP) - if(_XACRO_REMAP) - set(_XACRO_REMAP REMAP ${_XACRO_REMAP}) - endif() - # prepare DEPENDS args (prepending DEPENDS) - if(_XACRO_DEPENDS) - set(_XACRO_DEPENDS DEPENDS ${_XACRO_DEPENDS}) - endif() - - # have INSTALL option, but no TARGET: fallback to default target - if(_XACRO_INSTALL AND NOT _XACRO_TARGET) - # message(STATUS "xacro: no TARGET specified, using default") - set(_XACRO_TARGET _xacro_auto_generate) - endif() - - foreach(input ${_XACRO_UNPARSED_ARGUMENTS}) - # call to main function - xacro_add_xacro_file(${input} ${_XACRO_OUTPUT} ${_XACRO_REMAP} ${_XACRO_DEPENDS}) - list(APPEND outputs ${XACRO_OUTPUT_FILE}) - endforeach() - - if(outputs) - # link to target - add_custom_target(${PROJECT_NAME}_${_XACRO_TARGET} ALL DEPENDS ${outputs}) - - # install? - if(_XACRO_INSTALL) - xacro_install(${_XACRO_TARGET} ${outputs} DESTINATION ${_XACRO_DESTINATION}) - endif(_XACRO_INSTALL) - endif() -endfunction(xacro_add_files) diff --git a/package.xml b/package.xml index 1378222f..887fec96 100644 --- a/package.xml +++ b/package.xml @@ -19,13 +19,12 @@ William Woodall Robert Haschke - ament_cmake ament_index_python python3-yaml ament_lint_auto ament_cmake_pytest - ament_cmake + ament_python diff --git a/scripts/xacro b/scripts/xacro deleted file mode 100755 index c0e08895..00000000 --- a/scripts/xacro +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env python3 -# Copyright (c) 2013, Willow Garage, Inc. -# 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. - -# Author: Stuart Glaser -# Maintainer: William Woodall - -import xacro -xacro.main() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..3b58ec92 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/xacro +[install] +install_scripts=$base/lib/xacro