├── .gitignore ├── .travis.yml ├── CHANGELOG.rst ├── CMakeLists.txt ├── LICENSE ├── README.rst ├── bin ├── .gitignore ├── catkin_find ├── catkin_init_workspace ├── catkin_make ├── catkin_make_isolated ├── catkin_test_results └── catkin_topological_order ├── cmake ├── all.cmake ├── assert.cmake ├── atomic_configure_file.cmake ├── catkinConfig.cmake.in ├── catkin_add_env_hooks.cmake ├── catkin_destinations.cmake ├── catkin_download.cmake ├── catkin_generate_environment.cmake ├── catkin_install_python.cmake ├── catkin_libraries.cmake ├── catkin_metapackage.cmake ├── catkin_package.cmake ├── catkin_package_xml.cmake ├── catkin_python_setup.cmake ├── catkin_symlink_install.cmake ├── catkin_workspace.cmake ├── custom_install.cmake ├── debug_message.cmake ├── em │ ├── order_packages.cmake.em │ └── pkg.pc.em ├── em_expand.cmake ├── empy.cmake ├── env-hooks │ ├── 05.catkin_make.bash │ └── 05.catkin_make_isolated.bash ├── find_program_required.cmake ├── interrogate_setup_dot_py.py ├── legacy.cmake ├── list_append_deduplicate.cmake ├── list_append_unique.cmake ├── list_insert_in_workspace_order.cmake ├── order_paths.py ├── parse_package_xml.py ├── platform │ ├── lsb.cmake │ ├── ubuntu.cmake │ └── windows.cmake ├── python.cmake ├── safe_execute_process.cmake ├── shell.cmake ├── stamp.cmake ├── string_starts_with.cmake ├── symlink_install │ ├── catkin_install_logic.cmake │ ├── catkin_symlink_install.cmake.in │ ├── catkin_symlink_install_append_install_code.cmake │ ├── catkin_symlink_install_directory.cmake │ ├── catkin_symlink_install_files.cmake │ ├── catkin_symlink_install_programs.cmake │ ├── catkin_symlink_install_targets.cmake │ └── install.cmake ├── templates │ ├── Doxyfile.in │ ├── __init__.py.in │ ├── _setup_util.py.in │ ├── cfg-extras.context.py.in │ ├── env-hook.context.py.in │ ├── env.bat.in │ ├── env.sh.in │ ├── generate_cached_setup.py.in │ ├── local_setup.bash.in │ ├── local_setup.bat.in │ ├── local_setup.fish.in │ ├── local_setup.sh.in │ ├── local_setup.zsh.in │ ├── order_packages.context.py.in │ ├── pkg.context.pc.in │ ├── pkgConfig-version.cmake.in │ ├── pkgConfig.cmake.in │ ├── python_distutils_install.bat.in │ ├── python_distutils_install.sh.in │ ├── python_win32_wrapper.cpp.in │ ├── relay.py.in │ ├── rosinstall.in │ ├── safe_execute_install.cmake.in │ ├── script.bash.in │ ├── script.bat.in │ ├── script.in │ ├── script.py.in │ ├── script.sh.in │ ├── setup.bash.in │ ├── setup.bat.in │ ├── setup.fish.in │ ├── setup.sh.in │ └── setup.zsh.in ├── test │ ├── catkin_download_test_data.cmake │ ├── download_checkmd5.py │ ├── gtest.cmake │ ├── nosetests.cmake │ ├── remove_test_results.py │ ├── run_tests.py │ └── tests.cmake ├── tools │ ├── bz2.cmake │ ├── doxygen.cmake │ ├── libraries.cmake │ ├── rt.cmake │ └── threads.cmake └── toplevel.cmake ├── doc ├── .gitignore ├── Makefile ├── adv_user_guide │ ├── adv_user_guide.rst │ ├── builddocs.rst │ ├── catkin_migration.rst │ └── catkin_migration_indigo.rst ├── conf.py ├── dependencies.dot ├── dev_guide │ ├── api │ │ ├── catkin.rst │ │ ├── index.rst │ │ ├── interrogate_setup_dot_py.rst │ │ └── parse_package_xml.rst │ ├── code_generation.rst │ ├── dev_guide.rst │ ├── generated_cmake_api.rst │ ├── layout.rst │ ├── maintainer.rst │ └── sketch.rst ├── generate_cmake_rst.py ├── howto │ ├── format1 │ │ ├── building_executables.rst │ │ ├── building_libraries.rst │ │ ├── building_msgs.rst │ │ ├── catkin_library_dependencies.rst │ │ ├── catkin_overview.rst │ │ ├── cpp_msg_dependencies.rst │ │ ├── downloading_test_data.rst │ │ ├── dynamic_reconfiguration.rst │ │ ├── gtest_configuration.rst │ │ ├── index.rst │ │ ├── installing_cmake.rst │ │ ├── installing_other.rst │ │ ├── installing_python.rst │ │ ├── python_module_dependencies.rst │ │ ├── python_nose_configuration.rst │ │ ├── rostest_configuration.rst │ │ ├── run_tests.rst │ │ └── system_library_dependencies.rst │ ├── format2 │ │ ├── building_executables.rst │ │ ├── building_libraries.rst │ │ ├── building_msgs.rst │ │ ├── catkin_library_dependencies.rst │ │ ├── catkin_overview.rst │ │ ├── cpp_msg_dependencies.rst │ │ ├── downloading_test_data.rst │ │ ├── dynamic_reconfiguration.rst │ │ ├── gtest_configuration.rst │ │ ├── index.rst │ │ ├── installing_cmake.rst │ │ ├── installing_other.rst │ │ ├── installing_python.rst │ │ ├── migrating_from_format_1.rst │ │ ├── python_module_dependencies.rst │ │ ├── python_nose_configuration.rst │ │ ├── rostest_configuration.rst │ │ ├── run_tests.rst │ │ └── system_library_dependencies.rst │ └── index.rst ├── index.rst ├── ros.png └── user_guide │ ├── environment.rst │ ├── find_package.rst │ ├── glossary.rst │ ├── installation.rst │ ├── setup_dot_py.rst │ ├── standards.rst │ ├── user_guide.rst │ └── variables.rst ├── package.xml ├── python └── catkin │ ├── __init__.py │ ├── builder.py │ ├── cmake.py │ ├── environment_cache.py │ ├── find_in_workspaces.py │ ├── init_workspace.py │ ├── package_version.py │ ├── terminal_color.py │ ├── test_results.py │ ├── tidy_xml.py │ ├── workspace.py │ └── workspace_vcs.py ├── rosdoc.yaml ├── setup.py └── test ├── .gitignore ├── README.rst ├── __init__.py ├── checks ├── README.rst ├── catkin-test.sh ├── fuerte │ ├── distro-to-install.py │ └── fuerte.rosinstall ├── full.rosinstall ├── incremental_by_stack_build.sh ├── make_enmasse_dscs.sh ├── make_packages.sh ├── make_quick.sh ├── release_repos.yaml ├── test-nocatkin.rosinstall └── unstable │ ├── desktop-overlay.rosinstall │ └── extras.rosinstall ├── local_tests ├── __init.py └── test_with_mock_workspace.py ├── mock_resources ├── src-fail │ ├── .gitignore │ ├── badly_specified_changelog │ │ ├── CMakeLists.txt │ │ └── package.xml │ └── noproject │ │ ├── CMakeLists.txt │ │ └── package.xml └── src │ ├── .gitignore │ ├── catkin_test │ ├── .gitignore │ ├── CMakeLists.txt │ ├── README │ ├── a │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── a │ │ │ │ └── foo.hpp │ │ ├── lib.cpp │ │ ├── msg │ │ │ └── AMsg.msg │ │ ├── package.xml │ │ └── src │ │ │ └── a │ │ │ └── __init__.py │ ├── b │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── b │ │ │ │ └── foo.hpp │ │ ├── lib.cpp │ │ ├── msg │ │ │ └── BMsg.msg │ │ ├── package.xml │ │ └── src │ │ │ └── b │ │ │ └── __init__.py │ ├── c │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── c │ │ │ │ └── foo.hpp │ │ ├── lib.cpp │ │ ├── msg │ │ │ └── CMsg.msg │ │ ├── package.xml │ │ └── src │ │ │ └── c │ │ │ └── __init__.py │ ├── catkin_test │ │ └── package.xml │ ├── changelog.em │ ├── d │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── d │ │ │ │ └── foo.hpp │ │ ├── lib.cpp │ │ ├── msg │ │ │ └── DMsg.msg │ │ ├── package.xml │ │ └── src │ │ │ └── d │ │ │ └── __init__.py │ ├── quux_msgs │ │ ├── CMakeLists.txt │ │ ├── msg │ │ │ └── QuuxString.msg │ │ └── package.xml │ ├── quux_user │ │ ├── CMakeLists.txt │ │ ├── package.xml │ │ └── src │ │ │ ├── main.cpp │ │ │ └── srv_test.cpp │ ├── rules.em │ └── stack.yaml │ ├── linker_options │ └── src │ │ ├── leaf_pkg │ │ ├── CMakeLists.txt │ │ ├── leaf.cpp │ │ └── package.xml │ │ └── root_pkg │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── root_pkg │ │ │ └── root.hpp │ │ ├── package.xml │ │ └── root.cpp │ ├── nolangs │ ├── CMakeLists.txt │ ├── main.cpp │ └── package.xml │ ├── python_test_a │ ├── msg │ │ └── A.msg │ ├── package.xml │ └── src │ │ └── a_uses_std_msgs.py │ └── ros_user │ ├── main.cpp │ └── package.xml ├── network_tests ├── __init__.py ├── network_test_utils.py ├── test.rosinstall └── test_unstable.py ├── unit_tests ├── __init__.py ├── test_builder.py ├── test_catkin_find.py ├── test_catkin_make_isolated.py ├── test_download_md5.py ├── test_environment_cache.py ├── test_find_in_workspace.py ├── test_init_workspace.py ├── test_interrogate_setup.py ├── test_order_packages_cmake_em.py ├── test_order_paths.py ├── test_parse_package_xml.py ├── test_run_tests.py ├── test_setup_util.py ├── test_test_results.py ├── test_tidy_xml.py └── test_workspace.py └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | ._* 3 | .\#* 4 | \#*\# 5 | doc/build 6 | *.pyc 7 | .rosinstall 8 | .project 9 | .pydevproject 10 | *~ 11 | *.orig 12 | *~ 13 | bin/.tmp 14 | .tmp 15 | 16 | bin/catkin_make_isolatedc 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "2.7" 4 | - "3.5" 5 | virtualenv: 6 | system_site_packages: true 7 | # command to install dependencies 8 | install: 9 | - pip install argparse catkin-pkg empy mock nose 10 | # command to run tests 11 | script: 12 | - nosetests test/unit_tests test/local_tests 13 | notifications: 14 | email: false 15 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | 3 | set(catkin_EXTRAS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 4 | 5 | project(catkin) 6 | 7 | if(NOT DEFINED CATKIN_TOPLEVEL) 8 | include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) 9 | endif() 10 | 11 | catkin_package() 12 | 13 | install(FILES LICENSE 14 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 15 | ) 16 | 17 | # install cmake files for catkin (except some files only used at build time of catkin) 18 | install(DIRECTORY cmake 19 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 20 | USE_SOURCE_PERMISSIONS 21 | PATTERN "catkinConfig.cmake.in" EXCLUDE) 22 | 23 | catkin_python_setup() 24 | 25 | if(CATKIN_ENABLE_TESTING) 26 | catkin_add_nosetests(test/local_tests) 27 | catkin_add_nosetests(test/unit_tests) 28 | endif() 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer in the documentation and/or other materials provided 10 | with the distribution. 11 | * Neither the name of copyright holder nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. image:: https://www.gravatar.com/avatar/ebfbbd6f16ce1f0dc30fc7c82c38d688 2 | :width: 100px 3 | 4 | Archived - ROS 1 End-of-life 5 | ============================ 6 | 7 | This repository contains ROS 1 packages. 8 | The last supported ROS 1 release, ROS Noetic, `officially reached end of life on May 31st, 2025 `_. 9 | 10 | catkin 11 | ====== 12 | 13 | Catkin is a collection of cmake macros and associated python code used 14 | to build some parts of `ROS `_ 15 | 16 | Documentation 17 | ------------- 18 | 19 | http://ros.org/doc/api/catkin/html/ 20 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | catkin_findc 2 | catkin_prepare_releasec 3 | -------------------------------------------------------------------------------- /bin/catkin_init_workspace: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import argparse 6 | import os 7 | import sys 8 | 9 | # find the import relatively if available to work before installing catkin or overlaying installed version 10 | if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): 11 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) 12 | from catkin.init_workspace import init_workspace # noqa: E402 13 | 14 | 15 | def main(): 16 | parser = argparse.ArgumentParser(description='Initializes a catkin workspace by creating a top-level CMakeLists.txt.') 17 | parser.add_argument('workspace', nargs='?', default='.', help='The path to an existing folder (default: .)') 18 | args = parser.parse_args() 19 | 20 | # verify that workspace folder exists 21 | workspace = os.path.abspath(args.workspace) 22 | if not os.path.isdir(workspace): 23 | parser.error('Workspace "%s" does not exist' % workspace) 24 | 25 | try: 26 | init_workspace(workspace) 27 | except Exception as e: 28 | sys.stderr.write(str(e)) 29 | sys.exit(2) 30 | 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /bin/catkin_test_results: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import argparse 6 | import os 7 | import sys 8 | 9 | # find the import relatively if available to work before installing catkin or overlaying installed version 10 | if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): 11 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) 12 | from catkin.test_results import aggregate_results # noqa: E402 13 | from catkin.test_results import print_summary2 # noqa: E402 14 | from catkin.test_results import test_results2 # noqa: E402 15 | 16 | 17 | def main(): 18 | parser = argparse.ArgumentParser(description='Outputs a summary of the test results. If there are any test errors or failures the scripts return code is 1.') 19 | parser.add_argument('test_results_dir', nargs='?', default=os.curdir, help='The path to the test results') 20 | parser.add_argument('--all', action='store_true', default=False, help='Show all test results even the ones without errors/failures as well as skipped xml files') 21 | parser.add_argument('--verbose', action='store_true', default=False, help='Show all tests which have errors or failed') 22 | args = parser.parse_args() 23 | 24 | # verify that workspace folder exists 25 | test_results_dir = os.path.abspath(args.test_results_dir) 26 | if not os.path.isdir(test_results_dir): 27 | sys.exit('Test results directory "%s" does not exist' % test_results_dir) 28 | 29 | try: 30 | results = test_results2( 31 | test_results_dir, show_verbose=args.verbose, show_all=args.all) 32 | _, sum_errors, sum_failures = aggregate_results(results) 33 | print_summary2(results, show_stable=args.all) 34 | # Skipped tests alone should not count as a failure 35 | if sum_errors or sum_failures: 36 | sys.exit(1) 37 | except Exception as e: 38 | sys.stderr.write(str(e)) 39 | sys.exit(2) 40 | 41 | 42 | if __name__ == '__main__': 43 | main() 44 | -------------------------------------------------------------------------------- /bin/catkin_topological_order: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import argparse 6 | import os 7 | import sys 8 | 9 | # find the import relatively if available to work before installing catkin or overlaying installed version 10 | if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): 11 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) 12 | try: 13 | from catkin_pkg.topological_order import topological_order 14 | except ImportError as e: 15 | sys.exit('ImportError: "from catkin_pkg.topological_order import topological_order" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) 16 | 17 | 18 | def main(): 19 | parser = argparse.ArgumentParser(description='Outputs the catkin projects of a workspace in topological order.') 20 | parser.add_argument('workspace', nargs='?', default='.', help='The path to a workspace (default: .)') 21 | parser.add_argument('--underlay-workspaces', nargs='*', default=[], help='The paths to underlay workspaces which are only used to resolve dependencies') 22 | parser.add_argument('--only-folders', action='store_true', help='Only output the project folders') 23 | parser.add_argument('--only-names', action='store_true', help='Only output the project names') 24 | args = parser.parse_args() 25 | 26 | # verify reasonable argument combination 27 | if args.only_folders and args.only_names: 28 | parser.error('Use either "--only-folders" or "--only-names" but not both') 29 | 30 | # verify that workspace folder exists 31 | workspace = os.path.abspath(args.workspace) 32 | if not os.path.isdir(workspace): 33 | sys.exit('Workspace "%s" does not exist' % workspace) 34 | 35 | ordered_projects = topological_order(workspace, underlay_workspaces=args.underlay_workspaces) 36 | if not ordered_projects: 37 | sys.stderr.write('Workspace "%s" seems to not contain any projects.' 38 | ' Have you passed the correct path to a ' 39 | 'catkin workspace?' % workspace) 40 | sys.exit(3) 41 | 42 | for (path, package) in ordered_projects: 43 | if path is None: 44 | sys.exit('The workspace contains packages with a circular dependency: %s' % package) 45 | 46 | if args.only_folders: 47 | print('%s' % path) 48 | elif args.only_names: 49 | print('%s' % package.name) 50 | else: 51 | print('%s %s' % (package.name, path)) 52 | 53 | 54 | if __name__ == '__main__': 55 | main() 56 | -------------------------------------------------------------------------------- /cmake/assert.cmake: -------------------------------------------------------------------------------- 1 | function(assert VAR) 2 | if(NOT ${VAR}) 3 | message(FATAL_ERROR "\nAssertion failed: ${VAR} (value is '${${VAR}}')\n") 4 | endif() 5 | debug_message(3 "assert(${VAR}) passed (${VAR} = ${${VAR}})") 6 | endfunction() 7 | 8 | function(assert_unset VAR) 9 | if(${VAR}) 10 | message(FATAL_ERROR "\nAssertion failed: '${VAR}' is set but should not be (value is '${${VAR}}')\n") 11 | endif() 12 | debug_message(3 "assert_unset(${VAR}) passed") 13 | endfunction() 14 | 15 | function(assert_file_exists FILENAME MESSAGE) 16 | if(NOT FILENAME) 17 | message(FATAL_ERROR "\nAssertion failed: check for file existence, but filename (${FILENAME}) unset. Message: ${MESSAGE}\n") 18 | endif() 19 | if(NOT EXISTS ${FILENAME}) 20 | message(FATAL_ERROR "\nAssertion failed: file '${FILENAME}' does not exist. Message: ${MESSAGE}\n") 21 | endif() 22 | endfunction() 23 | -------------------------------------------------------------------------------- /cmake/atomic_configure_file.cmake: -------------------------------------------------------------------------------- 1 | function(atomic_configure_file input output) 2 | string(RANDOM random_id) 3 | get_filename_component(output_file_name ${output} NAME) 4 | get_filename_component(atomic_file ${output} NAME) 5 | set(atomic_file "${CMAKE_BINARY_DIR}/atomic_configure/${atomic_file}.${random_id}") 6 | configure_file("${input}" "${atomic_file}" ${ARGN}) 7 | get_filename_component(output_path ${output} PATH) 8 | file(COPY "${atomic_file}" DESTINATION "${output_path}") 9 | file(RENAME "${output_path}/${output_file_name}.${random_id}" "${output_path}/${output_file_name}") 10 | endfunction() 11 | -------------------------------------------------------------------------------- /cmake/catkin_download.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Download a file containing data from a URL. 3 | # 4 | # It is commonly used to download larger data files which should not be 5 | # stored in the repository. 6 | # 7 | # .. note:: It is not recommended to rely on downloaded data during 8 | # a configure / make cycle since this prevents building the package 9 | # when no network connectivity is available. 10 | # 11 | # .. note:: The target will be registered as a dependency 12 | # of the "download_extra_data" target. 13 | # 14 | # :param target: the target name 15 | # :type target: string 16 | # :param url: the url to download 17 | # :type url: string 18 | # 19 | # :param DESTINATION: the directory where the file is downloaded to 20 | # (default: ${PROJECT_BINARY_DIR}) 21 | # :type DESTINATION: string 22 | # :param FILENAME: the filename of the downloaded file 23 | # (default: the basename of the url) 24 | # :type FILENAME: string 25 | # :param MD5: the expected md5 hash to compare against 26 | # (default: empty, skipping the check) 27 | # :type MD5: string 28 | # 29 | # Additionally, options EXCLUDE_FROM_ALL and REQUIRED can be specified. 30 | # 31 | # @public 32 | function(catkin_download target url) 33 | cmake_parse_arguments(ARG 34 | "EXCLUDE_FROM_ALL;REQUIRED" "DESTINATION;FILENAME;MD5" "" ${ARGN}) 35 | if(ARG_UNPARSED_ARGUMENTS) 36 | message(FATAL_ERROR 37 | "catkin_download() called with unused arguments: ${ARG_UNPARSED_ARGUMENTS}") 38 | endif() 39 | 40 | if(NOT ARG_DESTINATION) 41 | set(ARG_DESTINATION ${PROJECT_BINARY_DIR}) 42 | endif() 43 | 44 | if(NOT ARG_FILENAME) 45 | get_filename_component(ARG_FILENAME ${url} NAME) 46 | endif() 47 | 48 | set(required "") 49 | if(NOT ARG_REQUIRED) 50 | set(required "--ignore-error") 51 | endif() 52 | 53 | set(output "${ARG_DESTINATION}/${ARG_FILENAME}") 54 | 55 | # With this, the command is always called, even when the output is up to date. 56 | # this is because we want to check the md5 sum if it's given, and redownload 57 | # the target if the md5 sum does not match. 58 | add_custom_target(${target} 59 | COMMAND ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/test/download_checkmd5.py ${url} ${output} ${ARG_MD5} ${required} 60 | VERBATIM) 61 | 62 | if(ARG_EXCLUDE_FROM_ALL) 63 | set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL TRUE) 64 | endif() 65 | 66 | if(TARGET download_extra_data) 67 | add_dependencies(download_extra_data ${target}) 68 | endif() 69 | endfunction() 70 | 71 | if(NOT TARGET download_extra_data) 72 | add_custom_target(download_extra_data) 73 | endif() 74 | -------------------------------------------------------------------------------- /cmake/catkin_metapackage.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # It installs the package.xml file of a metapackage. 3 | # 4 | # .. note:: It must be called once for each metapackage. Best 5 | # practice is to call this macro early in your root CMakeLists.txt, 6 | # immediately after calling ``project()`` and 7 | # ``find_package(catkin REQUIRED)``. 8 | # 9 | # :param DIRECTORY: the path to the package.xml file if not in the same 10 | # location as the CMakeLists.txt file 11 | # :type DIRECTORY: string 12 | # 13 | # @public 14 | # 15 | function(catkin_metapackage) 16 | cmake_parse_arguments(ARG "" "DIRECTORY" "" ${ARGN}) 17 | if(ARG_UNPARSED_ARGUMENTS) 18 | message(FATAL_ERROR "catkin_metapackage() called with unused arguments: ${ARG_UNPARSED_ARGUMENTS}") 19 | endif() 20 | 21 | # verify that project() has been called before 22 | if(NOT PROJECT_NAME) 23 | message(FATAL_ERROR "catkin_metapackage() PROJECT_NAME is not set. You must call project() before calling catkin_metapackage().") 24 | endif() 25 | if(PROJECT_NAME STREQUAL "Project") 26 | message(FATAL_ERROR "catkin_metapackage() PROJECT_NAME is set to 'Project', which is not a valid project name. You must call project() before calling catkin_metapackage().") 27 | endif() 28 | 29 | debug_message(10 "catkin_metapackage() called in file ${CMAKE_CURRENT_LIST_FILE}") 30 | 31 | if(NOT ARG_DIRECTORY) 32 | if(${CMAKE_CURRENT_LIST_FILE} STREQUAL ${CMAKE_BINARY_DIR}/catkin_generated/metapackages/${PROJECT_NAME}/CMakeLists.txt) 33 | set(ARG_DIRECTORY ${CMAKE_SOURCE_DIR}/${path}) 34 | else() 35 | set(ARG_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 36 | endif() 37 | endif() 38 | 39 | catkin_package_xml(DIRECTORY ${ARG_DIRECTORY}) 40 | 41 | # install package.xml 42 | install(FILES ${ARG_DIRECTORY}/package.xml 43 | DESTINATION share/${PROJECT_NAME} 44 | ) 45 | endfunction() 46 | -------------------------------------------------------------------------------- /cmake/catkin_symlink_install.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2018 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | option(CATKIN_SYMLINK_INSTALL 16 | "Replace the CMake install command with a custom implementation using symlinks instead of copying resources" 17 | OFF) 18 | 19 | if(CATKIN_SYMLINK_INSTALL) 20 | message(STATUS "Override CMake install command with custom implementation " 21 | "using symlinks instead of copying resources") 22 | 23 | include( 24 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_append_install_code.cmake") 25 | include( 26 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_directory.cmake") 27 | include( 28 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_files.cmake") 29 | include( 30 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_programs.cmake") 31 | include( 32 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_targets.cmake") 33 | include("${catkin_EXTRAS_DIR}/symlink_install/catkin_install_logic.cmake") 34 | 35 | # register custom install logic 36 | _use_custom_install() 37 | set(_CATKIN_CUSTOM_INSTALL_RULES "${catkin_EXTRAS_DIR}/symlink_install/install.cmake") 38 | 39 | # create the install script from the template 40 | # catkin/cmake/symlink_install/catkin_symlink_install.cmake.in 41 | set(CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT 42 | "${CMAKE_CURRENT_BINARY_DIR}/catkin_symlink_install/catkin_symlink_install.cmake") 43 | configure_file( 44 | "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install.cmake.in" 45 | "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" 46 | @ONLY 47 | ) 48 | # register script for being executed at install time 49 | install(SCRIPT "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}") 50 | endif() 51 | -------------------------------------------------------------------------------- /cmake/custom_install.cmake: -------------------------------------------------------------------------------- 1 | function(_use_custom_install) 2 | # only redefine install function once 3 | if(NOT _CATKIN_USE_CUSTOM_INSTALL) 4 | set(_CATKIN_USE_CUSTOM_INSTALL TRUE PARENT_SCOPE) 5 | 6 | function(install) 7 | if(_CATKIN_SKIP_INSTALL_RULES) 8 | return() 9 | endif() 10 | if(_CATKIN_CUSTOM_INSTALL_RULES) 11 | include("${_CATKIN_CUSTOM_INSTALL_RULES}") 12 | else() 13 | _install(${ARGN}) 14 | endif() 15 | endfunction() 16 | endif() 17 | endfunction() 18 | -------------------------------------------------------------------------------- /cmake/debug_message.cmake: -------------------------------------------------------------------------------- 1 | # Log levels 2 | # 0 Normal use 3 | # 1 Catkin developer use (Stuff being developed) 4 | # 2 Catkin developer use (Stuff working) 5 | # 3 Also Print True Assert Statements 6 | 7 | function(debug_message level) 8 | set(loglevel ${CATKIN_LOG}) 9 | if(NOT loglevel) 10 | set(loglevel 0) 11 | endif() 12 | 13 | if(NOT ${level} GREATER ${loglevel}) 14 | message(STATUS " ${ARGN}") 15 | endif() 16 | endfunction() 17 | -------------------------------------------------------------------------------- /cmake/em/pkg.pc.em: -------------------------------------------------------------------------------- 1 | prefix=@PROJECT_SPACE_DIR 2 | 3 | Name: @(CATKIN_PACKAGE_PREFIX + PROJECT_NAME) 4 | Description: Description of @PROJECT_NAME 5 | Version: @PROJECT_VERSION 6 | Cflags: @(' '.join(['-I%s' % include for include in PROJECT_PKG_CONFIG_INCLUDE_DIRS])) 7 | Libs: -L${prefix}/lib @(' '.join(PKG_CONFIG_LIBRARIES_WITH_PREFIX)) 8 | Requires: @(PROJECT_CATKIN_DEPENDS) 9 | -------------------------------------------------------------------------------- /cmake/em_expand.cmake: -------------------------------------------------------------------------------- 1 | function(em_expand context_in context_out em_file_in file_out) 2 | assert_file_exists("${context_in}" "input file for context missing") 3 | assert_file_exists("${em_file_in}" "template file missing") 4 | debug_message(2 "configure_file(${context_in}, ${context_out})") 5 | configure_file(${context_in} ${context_out} @ONLY) 6 | assert_file_exists("${context_out}" "context file was not generated correctly") 7 | 8 | stamp(${em_file_in}) 9 | 10 | # create directory if necessary 11 | get_filename_component(_folder_out ${file_out} PATH) 12 | if(NOT IS_DIRECTORY ${_folder_out}) 13 | file(MAKE_DIRECTORY ${_folder_out}) 14 | endif() 15 | 16 | debug_message(2 "Evaluate template '${em_file_in}' to '${file_out}' (with context from '${context_out}')") 17 | assert(EMPY_SCRIPT) 18 | # since empy contains a specific python version in its shebang line 19 | # override the used python version by invoking it explicitly 20 | set(command "${PYTHON_EXECUTABLE};${EMPY_SCRIPT}") 21 | # prepend environment if set 22 | if(CATKIN_ENV) 23 | set(command ${CATKIN_ENV} ${command}) 24 | endif() 25 | safe_execute_process(COMMAND 26 | ${command} 27 | --raw-errors 28 | -F ${context_out} 29 | -o ${file_out} 30 | ${em_file_in}) 31 | endfunction() 32 | -------------------------------------------------------------------------------- /cmake/empy.cmake: -------------------------------------------------------------------------------- 1 | function(find_python_module module) 2 | # cribbed from http://www.cmake.org/pipermail/cmake/2011-January/041666.html 3 | string(TOUPPER ${module} module_upper) 4 | if(NOT PY_${module_upper}) 5 | if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED") 6 | set(${module}_FIND_REQUIRED TRUE) 7 | endif() 8 | # A module's location is usually a directory, but for 9 | # binary modules 10 | # it's a .so file. 11 | execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))" 12 | RESULT_VARIABLE _${module}_status 13 | OUTPUT_VARIABLE _${module}_location 14 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 15 | if(NOT _${module}_status) 16 | set(PY_${module_upper} ${_${module}_location} CACHE STRING "Location of Python module ${module}") 17 | endif(NOT _${module}_status) 18 | endif(NOT PY_${module_upper}) 19 | include(FindPackageHandleStandardArgs) 20 | set(FPHSA_NAME_MISMATCHED TRUE) 21 | find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper}) 22 | endfunction(find_python_module) 23 | 24 | if(NOT EMPY_SCRIPT) 25 | find_program(EMPY_EXECUTABLE empy) 26 | if(NOT EMPY_EXECUTABLE) 27 | # On OSX, there's an em.py, but not an executable empy script 28 | find_python_module(em) 29 | if(NOT PY_EM) 30 | message(FATAL_ERROR "Unable to find either executable 'empy' or Python module 'em'... try installing the package 'python3-empy'") 31 | endif() 32 | # ensure to use cmake-style path separators on Windows 33 | file(TO_CMAKE_PATH "${PY_EM}" EMPY_SCRIPT) 34 | else() 35 | # ensure to use cmake-style path separators on Windows 36 | file(TO_CMAKE_PATH "${EMPY_EXECUTABLE}" EMPY_SCRIPT) 37 | endif() 38 | set(EMPY_SCRIPT "${EMPY_SCRIPT}" CACHE STRING "Empy script" FORCE) 39 | endif() 40 | message(STATUS "Using empy: ${EMPY_SCRIPT}") 41 | -------------------------------------------------------------------------------- /cmake/find_program_required.cmake: -------------------------------------------------------------------------------- 1 | function(find_program_required ARG_VAR ARG_PROGRAM_NAME) 2 | cmake_parse_arguments(ARG "NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH" "" "PATHS" ${ARGN}) 3 | find_program(${ARG_VAR} ${ARG_PROGRAM_NAME} PATHS ${ARG_PATHS} ${ARG_NO_DEFAULT_PATH} ${ARG_NO_CMAKE_FIND_ROOT_PATH}) 4 | if(NOT ${ARG_VAR}) 5 | message(FATAL_ERROR "${ARG_PROGRAM_NAME} not found") 6 | else() 7 | debug_message(1 "${ARG_PROGRAM_NAME} was found at ${${ARG_VAR}}") 8 | endif() 9 | endfunction() 10 | -------------------------------------------------------------------------------- /cmake/legacy.cmake: -------------------------------------------------------------------------------- 1 | function(catkin_stack) 2 | message(FATAL_ERROR "catkin_stack() is not supported by catkin as of groovy. Please update the package to the latest catkin version.") 3 | endfunction() 4 | -------------------------------------------------------------------------------- /cmake/list_append_deduplicate.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Append elements to a list and remove existing duplicates from the list. 3 | # 4 | # .. note:: Using CMake's ``list(APPEND ..)`` and 5 | # ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its 6 | # implementation uses a set internally which makes the operation 7 | # unstable. 8 | # 9 | macro(list_append_deduplicate listname) 10 | if(NOT "${ARGN}" STREQUAL "") 11 | if(${listname}) 12 | list(REMOVE_ITEM ${listname} ${ARGN}) 13 | endif() 14 | list(APPEND ${listname} ${ARGN}) 15 | endif() 16 | endmacro() 17 | -------------------------------------------------------------------------------- /cmake/list_append_unique.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Append elements to a list if they are not already in the list. 3 | # 4 | # .. note:: Using CMake's ``list(APPEND ..)`` and 5 | # ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its 6 | # implementation uses a set internally which makes the operation 7 | # unstable. 8 | # 9 | macro(list_append_unique listname) 10 | foreach(_item ${ARGN}) 11 | list(FIND ${listname} ${_item} _index) 12 | if(_index EQUAL -1) 13 | list(APPEND ${listname} ${_item}) 14 | endif() 15 | endforeach() 16 | endmacro() 17 | -------------------------------------------------------------------------------- /cmake/list_insert_in_workspace_order.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Insert elements to a list in the same order as the chained catkin workspaces. 3 | # 4 | set(CATKIN_ORDERED_SPACES "") 5 | foreach(_space ${CATKIN_DEVEL_PREFIX} ${CATKIN_WORKSPACES}) 6 | list(APPEND CATKIN_ORDERED_SPACES ${_space}) 7 | if(NOT EXISTS "${_space}/.catkin") 8 | message(FATAL_ERROR "The path '${_space}' is in CATKIN_WORKSPACES but does not have a .catkin file") 9 | endif() 10 | endforeach() 11 | 12 | debug_message(10 "CATKIN_ORDERED_SPACES ${CATKIN_ORDERED_SPACES}") 13 | 14 | function(list_insert_in_workspace_order listname) 15 | if(NOT "${ARGN}" STREQUAL "") 16 | assert(CATKIN_ENV) 17 | assert(PYTHON_EXECUTABLE) 18 | set(cmd 19 | ${CATKIN_ENV} ${PYTHON_EXECUTABLE} 20 | ${catkin_EXTRAS_DIR}/order_paths.py 21 | ${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/ordered_paths.cmake 22 | --paths-to-order ${ARGN} 23 | --prefixes ${CATKIN_ORDERED_SPACES} 24 | ) 25 | debug_message(10 "list_insert_in_workspace_order() in project '{PROJECT_NAME}' executes: ${cmd}") 26 | safe_execute_process(COMMAND ${cmd}) 27 | include(${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/ordered_paths.cmake) 28 | set(${listname} ${ORDERED_PATHS} PARENT_SCOPE) 29 | else() 30 | set(${listname} "" PARENT_SCOPE) 31 | endif() 32 | endfunction() 33 | -------------------------------------------------------------------------------- /cmake/order_paths.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import os 4 | import sys 5 | from argparse import ArgumentParser 6 | 7 | try: 8 | from catkin_pkg.workspaces import get_spaces 9 | except ImportError as e: 10 | sys.exit('ImportError: "catkin_pkg.workspaces import get_spaces" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) 11 | try: 12 | from catkin_pkg.workspaces import order_paths 13 | except ImportError as e: 14 | sys.exit('ImportError: "from catkin_pkg.workspaces import order_paths" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) 15 | 16 | 17 | def main(): 18 | """Order a list of paths according to a list of prefixes which define the order.""" 19 | parser = ArgumentParser(description='Utility to order a list of paths according to a list of prefixes. Creates a file with CMake set command setting a variable.') 20 | parser.add_argument('outfile', help='The filename of the generated CMake file') 21 | parser.add_argument('--paths-to-order', nargs='*', help='The semicolon-separated paths to order') 22 | parser.add_argument('--prefixes', nargs='*', help='The semicolon-separated prefixes defining the order') 23 | args = parser.parse_args() 24 | 25 | # resolve the source space if any 26 | spaces = [] 27 | for prefix in args.prefixes: 28 | spaces.append(prefix) 29 | spaces += get_spaces([prefix]) 30 | 31 | ordered_paths = order_paths(args.paths_to_order, spaces) 32 | 33 | # create directory if necessary 34 | outdir = os.path.dirname(args.outfile) 35 | if not os.path.exists(outdir): 36 | os.makedirs(outdir) 37 | 38 | with open(args.outfile, 'w') as fh: 39 | fh.write('set(ORDERED_PATHS "%s")' % ';'.join(ordered_paths)) 40 | 41 | 42 | if __name__ == '__main__': 43 | main() 44 | -------------------------------------------------------------------------------- /cmake/platform/lsb.cmake: -------------------------------------------------------------------------------- 1 | find_program(LSB_RELEASE_EXECUTABLE lsb_release) 2 | 3 | if(LSB_RELEASE_EXECUTABLE) 4 | set(LSB_FOUND TRUE CACHE BOOL "lsb_release executable was found") 5 | execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si 6 | OUTPUT_VARIABLE LSB_DISTRIB_ID 7 | OUTPUT_STRIP_TRAILING_WHITESPACE) 8 | string(TOUPPER ${LSB_DISTRIB_ID} v) 9 | set(${v} TRUE CACHE BOOL "LSB Distrib tag") 10 | 11 | execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sd 12 | OUTPUT_VARIABLE LSB_DESCRIPTION 13 | OUTPUT_STRIP_TRAILING_WHITESPACE) 14 | execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sr 15 | OUTPUT_VARIABLE LSB_RELEASE 16 | OUTPUT_STRIP_TRAILING_WHITESPACE) 17 | execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sc 18 | OUTPUT_VARIABLE LSB_CODENAME 19 | OUTPUT_STRIP_TRAILING_WHITESPACE) 20 | 21 | string(TOUPPER ${LSB_DISTRIB_ID} v) 22 | set(${v} TRUE CACHE BOOL "LSB Distribution") 23 | #message(STATUS "${v} is on") 24 | 25 | string(TOUPPER ${LSB_DISTRIB_ID}_${LSB_CODENAME} v) 26 | set(${v} TRUE CACHE BOOL "LSB Distrib - codename tag") 27 | #message(STATUS "${v} is on") 28 | endif() 29 | -------------------------------------------------------------------------------- /cmake/platform/ubuntu.cmake: -------------------------------------------------------------------------------- 1 | # requires lsb to be included first 2 | if(UBUNTU) 3 | # ubuntu-specifics go here 4 | endif() 5 | -------------------------------------------------------------------------------- /cmake/python.cmake: -------------------------------------------------------------------------------- 1 | # the CMake variable PYTHON_INSTALL_DIR has the same value as the Python function catkin.builder.get_python_install_dir() 2 | 3 | set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Python version to use ('major.minor' or 'major')") 4 | find_package(PythonInterp ${PYTHON_VERSION} REQUIRED) 5 | 6 | message(STATUS "Using PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}") 7 | 8 | set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") 9 | 10 | set(enable_setuptools_deb_layout OFF) 11 | if(EXISTS "/etc/debian_version") 12 | set(enable_setuptools_deb_layout ON) 13 | endif() 14 | option(SETUPTOOLS_DEB_LAYOUT "Enable debian style python package layout" ${enable_setuptools_deb_layout}) 15 | 16 | if(SETUPTOOLS_DEB_LAYOUT) 17 | message(STATUS "Using Debian Python package layout") 18 | set(PYTHON_PACKAGES_DIR dist-packages) 19 | set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb") 20 | # use major version only when installing 3.x with debian layout 21 | if("${PYTHON_VERSION_MAJOR}" STREQUAL "3") 22 | set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}") 23 | endif() 24 | else() 25 | message(STATUS "Using default Python package layout") 26 | set(PYTHON_PACKAGES_DIR site-packages) 27 | # setuptools is fussy about windows paths, make sure the install prefix is in native format 28 | file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" SETUPTOOLS_INSTALL_PREFIX) 29 | endif() 30 | 31 | if(NOT WIN32) 32 | set(PYTHON_INSTALL_DIR lib/python${_PYTHON_PATH_VERSION_SUFFIX}/${PYTHON_PACKAGES_DIR} 33 | CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called. And it needs to match. But setuptools won't tell us where it will install things.") 34 | else() 35 | # Windows setuptools installs to lib/site-packages not lib/python2.7/site-packages 36 | set(PYTHON_INSTALL_DIR lib/${PYTHON_PACKAGES_DIR} 37 | CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called. And it needs to match. But setuptools won't tell us where it will install things.") 38 | endif() 39 | -------------------------------------------------------------------------------- /cmake/safe_execute_process.cmake: -------------------------------------------------------------------------------- 1 | function(safe_execute_process cmd_keyword arg1) 2 | set(_cmd ${arg1}) 3 | foreach(_arg ${ARGN}) 4 | set(_cmd "${_cmd} \"${_arg}\"") 5 | endforeach() 6 | 7 | debug_message(2 "execute_process(${_cmd})") 8 | execute_process(${ARGV} RESULT_VARIABLE _res) 9 | 10 | if(NOT _res EQUAL 0) 11 | message(FATAL_ERROR "execute_process(${_cmd}) returned error code ${_res}") 12 | endif() 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/shell.cmake: -------------------------------------------------------------------------------- 1 | function(shell arg1) 2 | set(cmd ${arg1}) 3 | foreach(arg ${ARGN}) 4 | set(cmd "${cmd} ${arg}") 5 | endforeach() 6 | 7 | execute_process(COMMAND ${arg1} ${ARGN} 8 | RESULT_VARIABLE res 9 | OUTPUT_VARIABLE out 10 | ERROR_VARIABLE out) 11 | 12 | if(res EQUAL 0) 13 | debug_message(2 "execute_process(${cmd}) succeeded returning: ${out}") 14 | else() 15 | message(FATAL_ERROR "execute_process(${cmd})\n***FAILED with ERROR:***\n${out}") 16 | endif() 17 | endfunction() 18 | -------------------------------------------------------------------------------- /cmake/stamp.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # :param path: file name 3 | # 4 | # Uses ``configure_file`` to generate a file ``filepath.stamp`` hidden 5 | # somewhere in the build tree. This will cause cmake to rebuild its 6 | # cache when ``filepath`` is modified. 7 | # 8 | function(stamp path) 9 | get_filename_component(filename "${path}" NAME) 10 | configure_file(${path} 11 | ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/stamps/${PROJECT_NAME}/${filename}.stamp 12 | COPYONLY) 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/string_starts_with.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Check if a string starts with a prefix. 3 | # 4 | # :param str: the string 5 | # :type str: string 6 | # :param prefix: the prefix 7 | # :type prefix: string 8 | # :param var: the output variable name 9 | # :type var: bool 10 | # 11 | function(string_starts_with str prefix var) 12 | string(LENGTH "${str}" str_length) 13 | string(LENGTH "${prefix}" prefix_length) 14 | set(value FALSE) 15 | if(NOT ${str_length} LESS ${prefix_length}) 16 | string(SUBSTRING "${str}" 0 ${prefix_length} str_prefix) 17 | if("${str_prefix}" STREQUAL "${prefix}") 18 | set(value TRUE) 19 | endif() 20 | endif() 21 | set(${var} ${value} PARENT_SCOPE) 22 | endfunction() 23 | -------------------------------------------------------------------------------- /cmake/symlink_install/catkin_install_logic.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2018 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # Custom CMake install logic to use symlinks instead of copying resources. 17 | # 18 | # :param ARGN: the same arguments as the CMake install command. 19 | # :type ARGN: various 20 | # 21 | function(catkin_install_logic signature) 22 | string(TOUPPER "${signature}" signature) 23 | 24 | if(signature STREQUAL "DIRECTORY") 25 | catkin_symlink_install_directory(DIRECTORY ${ARGN}) 26 | return() 27 | elseif(signature STREQUAL "FILES") 28 | catkin_symlink_install_files(FILES ${ARGN}) 29 | return() 30 | elseif(signature STREQUAL "PROGRAMS") 31 | catkin_symlink_install_programs(PROGRAMS ${ARGN}) 32 | return() 33 | elseif(signature STREQUAL "TARGETS") 34 | catkin_symlink_install_targets(TARGETS ${ARGN}) 35 | return() 36 | endif() 37 | 38 | # fall back to CMake install() command 39 | # if the arguments haven't been handled before 40 | _install(${signature} ${ARGN}) 41 | endfunction() 42 | -------------------------------------------------------------------------------- /cmake/symlink_install/catkin_symlink_install_append_install_code.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # Register a CMake script for execution at install time. 17 | # 18 | # :param ARGN: the list of CMake code lines 19 | # :type ARGN: list of strings 20 | # :param COMMENTS: an optional list of comments 21 | # :type COMMENTS: list of strings 22 | # 23 | function(catkin_symlink_install_append_install_code) 24 | cmake_parse_arguments(ARG "" "" "COMMENTS" ${ARGN}) 25 | 26 | # append code to install script 27 | if(ARG_COMMENTS) 28 | file(APPEND "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" 29 | "\n# ${ARG_COMMENTS}\n") 30 | endif() 31 | foreach(code ${ARG_UNPARSED_ARGUMENTS}) 32 | file(APPEND "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" "${code}\n") 33 | endforeach() 34 | endfunction() 35 | -------------------------------------------------------------------------------- /cmake/symlink_install/catkin_symlink_install_directory.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # Reimplement CMake install(DIRECTORY) command to use symlinks instead of 17 | # copying resources. 18 | # 19 | # :param ARGN: the same arguments as the CMake install command. 20 | # :type ARGN: various 21 | # 22 | function(catkin_symlink_install_directory directory_keyword) 23 | if(NOT directory_keyword STREQUAL "DIRECTORY") 24 | message(FATAL_ERROR "catkin_symlink_install_directory() first " 25 | "argument must be 'DIRECTORY', not '${directory_keyword}'") 26 | endif() 27 | 28 | set(unsupported_keywords 29 | "FILE_PERMISSIONS" 30 | "DIRECTORY_PERMISSIONS" 31 | "USE_SOURCE_PERMISSIONS" 32 | "CONFIGURATIONS" 33 | "COMPONENT" 34 | "FILES_MATCHING" 35 | "REGEX" 36 | "PERMISSIONS" 37 | ) 38 | foreach(unsupported_keyword ${unsupported_keywords}) 39 | list(FIND ARGN "${unsupported_keyword}" index) 40 | if(NOT index EQUAL -1) 41 | # fall back to CMake install() command 42 | # if the arguments can't be handled 43 | _install(DIRECTORY ${ARGN}) 44 | break() 45 | endif() 46 | endforeach() 47 | 48 | if(index EQUAL -1) 49 | # merge 'PATTERN "xxx" EXCLUDE' arguments to 'PATTERN_EXCLUDE "xxx"' 50 | set(argn ${ARGN}) 51 | list(LENGTH argn length) 52 | set(i 0) 53 | while(i LESS length) 54 | list(GET argn ${i} arg) 55 | if(arg STREQUAL "PATTERN") 56 | math(EXPR j "${i} + 2") 57 | if(j LESS length) 58 | list(GET argn ${j} arg) 59 | if(arg STREQUAL "EXCLUDE") 60 | # replace "PATTERN" with "PATTERN_EXCLUDE" 61 | list(REMOVE_AT argn ${i}) 62 | list(INSERT argn ${i} "PATTERN_EXCLUDE") 63 | # remove "EXCLUDE" 64 | list(REMOVE_AT argn ${j}) 65 | # get changed length 66 | list(LENGTH argn length) 67 | endif() 68 | endif() 69 | endif() 70 | math(EXPR i "${i} + 1") 71 | endwhile() 72 | 73 | string(REPLACE ";" "\" \"" argn_quoted "\"${argn}\"") 74 | catkin_symlink_install_append_install_code( 75 | "catkin_symlink_install_directory(CURRENT_SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\" DIRECTORY ${argn_quoted})" 76 | COMMENTS "install(DIRECTORY ${argn_quoted})" 77 | ) 78 | endif() 79 | endfunction() 80 | -------------------------------------------------------------------------------- /cmake/symlink_install/catkin_symlink_install_files.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | set(__CATKIN_SYMLINK_INSTALL_FILES_INDEX "0" 16 | CACHE INTERNAL "Index for unique symlink install files") 17 | 18 | # 19 | # Reimplement CMake install(FILES) command to use symlinks instead of copying 20 | # resources. 21 | # 22 | # :param ARGN: the same arguments as the CMake install command. 23 | # :type ARGN: various 24 | # 25 | function(catkin_symlink_install_files files_keyword) 26 | if(NOT files_keyword STREQUAL "FILES") 27 | message(FATAL_ERROR "catkin_symlink_install_files() first argument " 28 | "must be 'FILES', not '${files_keyword}'") 29 | endif() 30 | 31 | set(unsupported_keywords 32 | "PERMISSIONS" 33 | "CONFIGURATIONS" 34 | "COMPONENT" 35 | ) 36 | foreach(unsupported_keyword ${unsupported_keywords}) 37 | list(FIND ARGN "${unsupported_keyword}" index) 38 | if(NOT index EQUAL -1) 39 | # fall back to CMake install() command 40 | # if the arguments can't be handled 41 | _install(FILES ${ARGN}) 42 | break() 43 | endif() 44 | endforeach() 45 | 46 | if(index EQUAL -1) 47 | string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") 48 | 49 | # generate unique files 50 | set(generated_file_base 51 | "${CMAKE_CURRENT_BINARY_DIR}/catkin_symlink_install_files_${__CATKIN_SYMLINK_INSTALL_FILES_INDEX}") 52 | set(generated_file_generator_suffix "${generated_file_base}_$.cmake") 53 | set(generated_file_variable_suffix "${generated_file_base}_\${CMAKE_INSTALL_CONFIG_NAME}.cmake") 54 | math(EXPR __CATKIN_SYMLINK_INSTALL_FILES_INDEX 55 | "${__CATKIN_SYMLINK_INSTALL_FILES_INDEX} + 1") 56 | set(__CATKIN_SYMLINK_INSTALL_FILES_INDEX "${__CATKIN_SYMLINK_INSTALL_FILES_INDEX}" 57 | CACHE INTERNAL "Index for unique symlink install files") 58 | 59 | file(GENERATE OUTPUT "${generated_file_generator_suffix}" 60 | CONTENT 61 | "catkin_symlink_install_files(CURRENT_SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\" FILES ${argn_quoted})\n") 62 | catkin_symlink_install_append_install_code( 63 | "include(\"${generated_file_variable_suffix}\")" 64 | COMMENTS "install(FILES ${argn_quoted})" 65 | ) 66 | endif() 67 | endfunction() 68 | -------------------------------------------------------------------------------- /cmake/symlink_install/catkin_symlink_install_programs.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # Reimplement CMake install(PROGRAMS) command to use symlinks instead of copying 17 | # resources. 18 | # 19 | # :param ARGN: the same arguments as the CMake install command. 20 | # :type ARGN: various 21 | # 22 | function(catkin_symlink_install_programs programs_keyword) 23 | if(NOT programs_keyword STREQUAL "PROGRAMS") 24 | message(FATAL_ERROR "catkin_symlink_install_programs() first argument " 25 | "must be 'PROGRAMS', not '${programs_keyword}'") 26 | endif() 27 | 28 | set(unsupported_keywords 29 | "PERMISSIONS" 30 | "CONFIGURATIONS" 31 | "COMPONENT" 32 | "RENAME" 33 | ) 34 | foreach(unsupported_keyword ${unsupported_keywords}) 35 | list(FIND ARGN "${unsupported_keyword}" index) 36 | if(NOT index EQUAL -1) 37 | # fall back to CMake install() command 38 | # if the arguments can't be handled 39 | _install(PROGRAMS ${ARGN}) 40 | break() 41 | endif() 42 | endforeach() 43 | 44 | if(index EQUAL -1) 45 | string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") 46 | catkin_symlink_install_append_install_code( 47 | "catkin_symlink_install_programs(CURRENT_SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\" PROGRAMS ${argn_quoted})" 48 | COMMENTS "install(PROGRAMS ${argn_quoted})" 49 | ) 50 | endif() 51 | endfunction() 52 | -------------------------------------------------------------------------------- /cmake/symlink_install/install.cmake: -------------------------------------------------------------------------------- 1 | # trigger the custom install logic 2 | catkin_install_logic(${ARGN}) 3 | -------------------------------------------------------------------------------- /cmake/templates/__init__.py.in: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # generated from catkin/cmake/template/__init__.py.in 3 | # keep symbol table as clean as possible by deleting all unnecessary symbols 4 | 5 | from os import path as os_path 6 | from pkgutil import extend_path 7 | from sys import path as sys_path 8 | 9 | __extended_path = '@PACKAGE_PYTHONPATH@'.split(';') 10 | for p in reversed(__extended_path): 11 | sys_path.insert(0, p) 12 | del p 13 | del sys_path 14 | 15 | __path__ = extend_path(__path__, __name__) 16 | del extend_path 17 | 18 | __execfiles = [] 19 | for p in __extended_path: 20 | src_init_file = os_path.join(p, __name__ + '.py') 21 | if os_path.isfile(src_init_file): 22 | __execfiles.append(src_init_file) 23 | else: 24 | src_init_file = os_path.join(p, __name__, '__init__.py') 25 | if os_path.isfile(src_init_file): 26 | __execfiles.append(src_init_file) 27 | del src_init_file 28 | del p 29 | del os_path 30 | del __extended_path 31 | 32 | for __execfile in __execfiles: 33 | with open(__execfile, 'r') as __fh: 34 | exec(__fh.read()) 35 | del __fh 36 | del __execfile 37 | del __execfiles 38 | -------------------------------------------------------------------------------- /cmake/templates/cfg-extras.context.py.in: -------------------------------------------------------------------------------- 1 | # generated from catkin/cmake/template/cfg-extras.context.py.in 2 | DEVELSPACE = '@DEVELSPACE@' == 'TRUE' 3 | INSTALLSPACE = '@INSTALLSPACE@' == 'TRUE' 4 | 5 | CATKIN_DEVEL_PREFIX = '@CATKIN_DEVEL_PREFIX@' 6 | 7 | CATKIN_GLOBAL_BIN_DESTINATION = '@CATKIN_GLOBAL_BIN_DESTINATION@' 8 | CATKIN_GLOBAL_ETC_DESTINATION = '@CATKIN_GLOBAL_ETC_DESTINATION@' 9 | CATKIN_GLOBAL_INCLUDE_DESTINATION = '@CATKIN_GLOBAL_INCLUDE_DESTINATION@' 10 | CATKIN_GLOBAL_LIB_DESTINATION = '@CATKIN_GLOBAL_LIB_DESTINATION@' 11 | CATKIN_GLOBAL_LIBEXEC_DESTINATION = '@CATKIN_GLOBAL_LIBEXEC_DESTINATION@' 12 | CATKIN_GLOBAL_PYTHON_DESTINATION = '@CATKIN_GLOBAL_PYTHON_DESTINATION@' 13 | CATKIN_GLOBAL_SHARE_DESTINATION = '@CATKIN_GLOBAL_SHARE_DESTINATION@' 14 | 15 | CATKIN_PACKAGE_BIN_DESTINATION = '@CATKIN_PACKAGE_BIN_DESTINATION@' 16 | CATKIN_PACKAGE_ETC_DESTINATION = '@CATKIN_PACKAGE_ETC_DESTINATION@' 17 | CATKIN_PACKAGE_INCLUDE_DESTINATION = '@CATKIN_PACKAGE_INCLUDE_DESTINATION@' 18 | CATKIN_PACKAGE_LIB_DESTINATION = '@CATKIN_PACKAGE_LIB_DESTINATION@' 19 | CATKIN_PACKAGE_LIBEXEC_DESTINATION = '@CATKIN_PACKAGE_LIBEXEC_DESTINATION@' 20 | CATKIN_PACKAGE_PYTHON_DESTINATION = '@CATKIN_PACKAGE_PYTHON_DESTINATION@' 21 | CATKIN_PACKAGE_SHARE_DESTINATION = '@CATKIN_PACKAGE_SHARE_DESTINATION@' 22 | 23 | CMAKE_BINARY_DIR = '@CMAKE_BINARY_DIR@' 24 | CMAKE_CURRENT_BINARY_DIR = '@CMAKE_CURRENT_BINARY_DIR@' 25 | CMAKE_CURRENT_SOURCE_DIR = '@CMAKE_CURRENT_SOURCE_DIR@' 26 | CMAKE_INSTALL_PREFIX = '@CMAKE_INSTALL_PREFIX@' 27 | CMAKE_SOURCE_DIR = '@CMAKE_SOURCE_DIR@' 28 | 29 | PKG_CMAKE_DIR = '@PKG_CMAKE_DIR@' 30 | 31 | PROJECT_NAME = '@PROJECT_NAME@' 32 | PROJECT_BINARY_DIR = '@PROJECT_BINARY_DIR@' 33 | PROJECT_SOURCE_DIR = '@PROJECT_SOURCE_DIR@' 34 | -------------------------------------------------------------------------------- /cmake/templates/env-hook.context.py.in: -------------------------------------------------------------------------------- 1 | # generated from catkin/cmake/template/env-hook.context.py.in 2 | DEVELSPACE = @DEVELSPACE@ 3 | INSTALLSPACE = @INSTALLSPACE@ 4 | 5 | CATKIN_DEVEL_PREFIX = '@CATKIN_DEVEL_PREFIX@' 6 | 7 | CATKIN_GLOBAL_BIN_DESTINATION = '@CATKIN_GLOBAL_BIN_DESTINATION@' 8 | CATKIN_GLOBAL_ETC_DESTINATION = '@CATKIN_GLOBAL_ETC_DESTINATION@' 9 | CATKIN_GLOBAL_INCLUDE_DESTINATION = '@CATKIN_GLOBAL_INCLUDE_DESTINATION@' 10 | CATKIN_GLOBAL_LIB_DESTINATION = '@CATKIN_GLOBAL_LIB_DESTINATION@' 11 | CATKIN_GLOBAL_LIBEXEC_DESTINATION = '@CATKIN_GLOBAL_LIBEXEC_DESTINATION@' 12 | CATKIN_GLOBAL_PYTHON_DESTINATION = '@CATKIN_GLOBAL_PYTHON_DESTINATION@' 13 | CATKIN_GLOBAL_SHARE_DESTINATION = '@CATKIN_GLOBAL_SHARE_DESTINATION@' 14 | 15 | CATKIN_PACKAGE_BIN_DESTINATION = '@CATKIN_PACKAGE_BIN_DESTINATION@' 16 | CATKIN_PACKAGE_ETC_DESTINATION = '@CATKIN_PACKAGE_ETC_DESTINATION@' 17 | CATKIN_PACKAGE_INCLUDE_DESTINATION = '@CATKIN_PACKAGE_INCLUDE_DESTINATION@' 18 | CATKIN_PACKAGE_LIB_DESTINATION = '@CATKIN_PACKAGE_LIB_DESTINATION@' 19 | CATKIN_PACKAGE_LIBEXEC_DESTINATION = '@CATKIN_PACKAGE_LIBEXEC_DESTINATION@' 20 | CATKIN_PACKAGE_PYTHON_DESTINATION = '@CATKIN_PACKAGE_PYTHON_DESTINATION@' 21 | CATKIN_PACKAGE_SHARE_DESTINATION = '@CATKIN_PACKAGE_SHARE_DESTINATION@' 22 | 23 | CMAKE_BINARY_DIR = '@CMAKE_BINARY_DIR@' 24 | CMAKE_CURRENT_BINARY_DIR = '@CMAKE_CURRENT_BINARY_DIR@' 25 | CMAKE_CURRENT_SOURCE_DIR = '@CMAKE_CURRENT_SOURCE_DIR@' 26 | CMAKE_INSTALL_PREFIX = '@CMAKE_INSTALL_PREFIX@' 27 | CMAKE_SOURCE_DIR = '@CMAKE_SOURCE_DIR@' 28 | 29 | PROJECT_NAME = '@PROJECT_NAME@' 30 | PROJECT_BINARY_DIR = '@PROJECT_BINARY_DIR@' 31 | PROJECT_SOURCE_DIR = '@PROJECT_SOURCE_DIR@' 32 | 33 | PYTHON_EXECUTABLE = '@PYTHON_EXECUTABLE@' 34 | -------------------------------------------------------------------------------- /cmake/templates/env.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM generated from catkin/cmake/templates/env.bat.in 3 | 4 | if "%1"=="" ( 5 | echo "Usage: env.bat COMMANDS" 6 | echo "Calling env.bat without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually." 7 | exit 1 8 | ) else ( 9 | call "@SETUP_DIR@/@SETUP_FILENAME@.bat" 10 | %* 11 | ) 12 | -------------------------------------------------------------------------------- /cmake/templates/env.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # generated from catkin/cmake/templates/env.sh.in 3 | 4 | if [ $# -eq 0 ] ; then 5 | /bin/echo "Usage: env.sh COMMANDS" 6 | /bin/echo "Calling env.sh without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually." 7 | exit 1 8 | fi 9 | 10 | # ensure to not use different shell type which was set before 11 | CATKIN_SHELL=sh 12 | 13 | # source @SETUP_FILENAME@.sh from same directory as this file 14 | _CATKIN_SETUP_DIR=$(cd "`dirname "$0"`" > /dev/null && pwd) 15 | . "$_CATKIN_SETUP_DIR/@SETUP_FILENAME@.sh" 16 | exec "$@" 17 | -------------------------------------------------------------------------------- /cmake/templates/generate_cached_setup.py.in: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function 3 | 4 | import os 5 | import stat 6 | import sys 7 | 8 | # find the import for catkin's python package - either from source space or from an installed underlay 9 | if os.path.exists(os.path.join('@catkin_EXTRAS_DIR@', 'catkinConfig.cmake.in')): 10 | sys.path.insert(0, os.path.join('@catkin_EXTRAS_DIR@', '..', 'python')) 11 | try: 12 | from catkin.environment_cache import generate_environment_script 13 | except ImportError: 14 | # search for catkin package in all workspaces and prepend to path 15 | for workspace in '@CATKIN_WORKSPACES@'.split(';'): 16 | python_path = os.path.join(workspace, '@CATKIN_GLOBAL_PYTHON_DESTINATION@') 17 | if os.path.isdir(os.path.join(python_path, 'catkin')): 18 | sys.path.insert(0, python_path) 19 | break 20 | from catkin.environment_cache import generate_environment_script 21 | 22 | code = generate_environment_script('@CATKIN_DEVEL_PREFIX@/env.@script_ext@') 23 | 24 | output_filename = '@SETUP_DIR@/@SETUP_FILENAME@.@script_ext@' 25 | with open(output_filename, 'w') as f: 26 | # print('Generate script for cached setup "%s"' % output_filename) 27 | f.write('\n'.join(code)) 28 | 29 | mode = os.stat(output_filename).st_mode 30 | os.chmod(output_filename, mode | stat.S_IXUSR) 31 | -------------------------------------------------------------------------------- /cmake/templates/local_setup.bash.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # generated from catkin/cmake/templates/local_setup.bash.in 3 | 4 | CATKIN_SHELL=bash 5 | 6 | # source setup.sh from same directory as this file 7 | _CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd) 8 | . "$_CATKIN_SETUP_DIR/setup.sh" --extend --local 9 | -------------------------------------------------------------------------------- /cmake/templates/local_setup.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM generated from catkin/cmake/template/local_setup.bat.in 3 | 4 | set _CATKIN_SETUP_DIR=@SETUP_DIR@ 5 | call %_CATKIN_SETUP_DIR%/setup.bat --extend --local 6 | set _CATKIN_SETUP_DIR= 7 | -------------------------------------------------------------------------------- /cmake/templates/local_setup.fish.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env fish 2 | # generated from catkin/cmake/template/local_setup.fish.in 3 | 4 | # since this file is sourced either use the provided _CATKIN_SETUP_DIR 5 | # or fall back to the destination set at configure time 6 | 7 | if test -z $_CATKIN_SETUP_DIR 8 | set _CATKIN_SETUP_DIR @SETUP_DIR@ 9 | end 10 | 11 | set CATKIN_SETUP_UTIL_ARGS "--extend --local" 12 | source "$_CATKIN_SETUP_DIR/setup.fish" 13 | 14 | set -e CATKIN_SETUP_UTIL_ARGS 15 | -------------------------------------------------------------------------------- /cmake/templates/local_setup.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # generated from catkin/cmake/template/local_setup.sh.in 3 | 4 | # since this file is sourced either use the provided _CATKIN_SETUP_DIR 5 | # or fall back to the destination set at configure time 6 | : ${_CATKIN_SETUP_DIR:=@SETUP_DIR@} 7 | CATKIN_SETUP_UTIL_ARGS="--extend --local" 8 | . "$_CATKIN_SETUP_DIR/setup.sh" 9 | unset CATKIN_SETUP_UTIL_ARGS 10 | -------------------------------------------------------------------------------- /cmake/templates/local_setup.zsh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # generated from catkin/cmake/templates/local_setup.zsh.in 3 | 4 | CATKIN_SHELL=zsh 5 | 6 | # source setup.sh from same directory as this file 7 | _CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd) 8 | emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh" --extend --local' 9 | -------------------------------------------------------------------------------- /cmake/templates/order_packages.context.py.in: -------------------------------------------------------------------------------- 1 | # generated from catkin/cmake/template/order_packages.context.py.in 2 | source_root_dir = '@CMAKE_CURRENT_SOURCE_DIR@' 3 | whitelisted_packages = '@CATKIN_WHITELIST_PACKAGES@'.split(';') if '@CATKIN_WHITELIST_PACKAGES@' != '' else [] 4 | blacklisted_packages = '@CATKIN_BLACKLIST_PACKAGES@'.split(';') if '@CATKIN_BLACKLIST_PACKAGES@' != '' else [] 5 | underlay_workspaces = '@CATKIN_WORKSPACES@'.split(';') if '@CATKIN_WORKSPACES@' != '' else [] 6 | -------------------------------------------------------------------------------- /cmake/templates/pkg.context.pc.in: -------------------------------------------------------------------------------- 1 | # generated from catkin/cmake/template/pkg.context.pc.in 2 | CATKIN_PACKAGE_PREFIX = "@CATKIN_PACKAGE_PREFIX@" 3 | PROJECT_PKG_CONFIG_INCLUDE_DIRS = "@PROJECT_PKG_CONFIG_INCLUDE_DIRS@".split(';') if "@PROJECT_PKG_CONFIG_INCLUDE_DIRS@" != "" else [] 4 | PROJECT_CATKIN_DEPENDS = "@_PROJECT_CATKIN_DEPENDS@".replace(';', ' ') 5 | PKG_CONFIG_LIBRARIES_WITH_PREFIX = "@PKG_CONFIG_LIBRARIES_WITH_PREFIX@".split(';') if "@PKG_CONFIG_LIBRARIES_WITH_PREFIX@" != "" else [] 6 | PROJECT_NAME = "@PROJECT_NAME@" 7 | PROJECT_SPACE_DIR = "@PROJECT_SPACE_DIR@" 8 | PROJECT_VERSION = "@PROJECT_VERSION@" 9 | -------------------------------------------------------------------------------- /cmake/templates/pkgConfig-version.cmake.in: -------------------------------------------------------------------------------- 1 | # generated from catkin/cmake/template/pkgConfig-version.cmake.in 2 | set(PACKAGE_VERSION "@PROJECT_VERSION@") 3 | 4 | set(PACKAGE_VERSION_EXACT False) 5 | set(PACKAGE_VERSION_COMPATIBLE False) 6 | 7 | if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") 8 | set(PACKAGE_VERSION_EXACT True) 9 | set(PACKAGE_VERSION_COMPATIBLE True) 10 | endif() 11 | 12 | if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}") 13 | set(PACKAGE_VERSION_COMPATIBLE True) 14 | endif() 15 | -------------------------------------------------------------------------------- /cmake/templates/python_distutils_install.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if DEFINED DESTDIR ( 4 | echo "Destdir.............%DESTDIR%" 5 | set DESTDIR_ARG="--root=%DESTDIR%" 6 | ) 7 | 8 | cd "@INSTALL_CMD_WORKING_DIRECTORY@" 9 | 10 | if NOT EXIST "@SETUPTOOLS_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@\" ( 11 | mkdir "@SETUPTOOLS_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@" 12 | ) 13 | 14 | set "PYTHONPATH=@SETUPTOOLS_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@;@CMAKE_BINARY_DIR@\@PYTHON_INSTALL_DIR@" 15 | set "CATKIN_BINARY_DIR=@CMAKE_BINARY_DIR@" 16 | for /f "usebackq tokens=*" %%a in ('@SETUPTOOLS_INSTALL_PREFIX@') do ( 17 | set _SETUPTOOLS_INSTALL_PATH=%%~pna 18 | set _SETUPTOOLS_INSTALL_ROOT=%%~da 19 | ) 20 | 21 | "@PYTHON_EXECUTABLE@" ^ 22 | "@CMAKE_CURRENT_SOURCE_DIR@\setup.py" ^ 23 | build --build-base "@CMAKE_CURRENT_BINARY_DIR@" ^ 24 | install %DESTDIR_ARG% @SETUPTOOLS_ARG_EXTRA@ ^ 25 | --prefix="%_SETUPTOOLS_INSTALL_PATH%" ^ 26 | --install-scripts="%_SETUPTOOLS_INSTALL_PATH%\@CATKIN_GLOBAL_BIN_DESTINATION@" ^ 27 | --root=%_SETUPTOOLS_INSTALL_ROOT%\ 28 | -------------------------------------------------------------------------------- /cmake/templates/python_distutils_install.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -n "$DESTDIR" ] ; then 4 | case $DESTDIR in 5 | /*) # ok 6 | ;; 7 | *) 8 | /bin/echo "DESTDIR argument must be absolute... " 9 | /bin/echo "otherwise python's distutils will bork things." 10 | exit 1 11 | esac 12 | fi 13 | 14 | echo_and_run() { echo "+ $@" ; "$@" ; } 15 | 16 | echo_and_run cd "@INSTALL_CMD_WORKING_DIRECTORY@" 17 | 18 | # ensure that Python install destination exists 19 | echo_and_run mkdir -p "$DESTDIR@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@" 20 | 21 | # Note that PYTHONPATH is pulled from the environment to support installing 22 | # into one location when some dependencies were installed in another 23 | # location, #123. 24 | echo_and_run /usr/bin/env \ 25 | PYTHONPATH="@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@:@CMAKE_BINARY_DIR@/@PYTHON_INSTALL_DIR@:$PYTHONPATH" \ 26 | CATKIN_BINARY_DIR="@CMAKE_BINARY_DIR@" \ 27 | "@PYTHON_EXECUTABLE@" \ 28 | "@CMAKE_CURRENT_SOURCE_DIR@/setup.py" \ 29 | @SETUPTOOLS_EGG_INFO@ \ 30 | build --build-base "@CMAKE_CURRENT_BINARY_DIR@" \ 31 | install \ 32 | --root="${DESTDIR-/}" \ 33 | @SETUPTOOLS_ARG_EXTRA@ --prefix="@CMAKE_INSTALL_PREFIX@" --install-scripts="@CMAKE_INSTALL_PREFIX@/@CATKIN_GLOBAL_BIN_DESTINATION@" 34 | -------------------------------------------------------------------------------- /cmake/templates/relay.py.in: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # generated from catkin/cmake/template/relay.py.in 3 | # creates a relay to a python script source file, acting as that file. 4 | # The purpose is that of a symlink 5 | python_script = '@PYTHON_SCRIPT@' 6 | with open(python_script, 'r') as fh: 7 | context = { 8 | '__builtins__': __builtins__, 9 | '__doc__': None, 10 | '__file__': python_script, 11 | '__name__': __name__, 12 | '__package__': None, 13 | } 14 | exec(compile(fh.read(), python_script, 'exec'), context) 15 | -------------------------------------------------------------------------------- /cmake/templates/rosinstall.in: -------------------------------------------------------------------------------- 1 | - setup-file: 2 | local-name: @SETUP_DIR@/setup.sh 3 | -------------------------------------------------------------------------------- /cmake/templates/safe_execute_install.cmake.in: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND "@INSTALL_SCRIPT@" RESULT_VARIABLE res) 2 | 3 | if(NOT res EQUAL 0) 4 | message(FATAL_ERROR "execute_process(@INSTALL_SCRIPT@) returned error code ${res}") 5 | endif() 6 | -------------------------------------------------------------------------------- /cmake/templates/script.bash.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # generated from catkin/cmake/templates/script.bash.in 3 | 4 | "@BASH_SCRIPT@" "$@" 5 | -------------------------------------------------------------------------------- /cmake/templates/script.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM generated from catkin/cmake/templates/script.bat.in 3 | 4 | call "@BAT_SCRIPT@" %* 5 | -------------------------------------------------------------------------------- /cmake/templates/script.in: -------------------------------------------------------------------------------- 1 | @SCRIPT@ 2 | -------------------------------------------------------------------------------- /cmake/templates/script.py.in: -------------------------------------------------------------------------------- 1 | #!@PYTHON_EXECUTABLE@ 2 | # -*- coding: utf-8 -*- 3 | # generated from catkin/cmake/template/script.py.in 4 | # creates a relay to a python script source file, acting as that file. 5 | # The purpose is that of a symlink 6 | python_script = '@PYTHON_SCRIPT@' 7 | with open(python_script, 'r') as fh: 8 | context = { 9 | '__builtins__': __builtins__, 10 | '__doc__': None, 11 | '__file__': python_script, 12 | '__name__': __name__, 13 | '__package__': None, 14 | } 15 | exec(compile(fh.read(), python_script, 'exec'), context) 16 | -------------------------------------------------------------------------------- /cmake/templates/script.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # generated from catkin/cmake/templates/script.sh.in 3 | 4 | "@EXECUTABLE@" "$@" 5 | -------------------------------------------------------------------------------- /cmake/templates/setup.bash.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # generated from catkin/cmake/templates/setup.bash.in 3 | 4 | CATKIN_SHELL=bash 5 | 6 | # source setup.sh from same directory as this file 7 | _CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd) 8 | . "$_CATKIN_SETUP_DIR/setup.sh" 9 | -------------------------------------------------------------------------------- /cmake/templates/setup.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM generated from catkin/cmake/template/setup.bat.in 3 | 4 | REM Sets various environment variables and sources additional environment hooks. 5 | REM It tries it's best to undo changes from a previously sourced setup file before. 6 | REM Supported command line options: 7 | REM --extend: skips the undoing of changes from a previously sourced setup file 8 | REM --local: only considers this workspace but not the chained ones 9 | 10 | set _SETUP_UTIL=@SETUP_DIR@/_setup_util.py 11 | 12 | if NOT EXIST "%_SETUP_UTIL%" ( 13 | echo "Missing Python script: %_SETUP_UTIL%" 14 | exit 22 15 | ) 16 | 17 | REM set the Python executable 18 | set _PYTHON="@PYTHON_EXECUTABLE@" 19 | 20 | REM compute Python home and normalize Python executable path 21 | set PYTHONHOME= 22 | set _PYTHONEXE= 23 | for /f "usebackq tokens=*" %%a in ('%_PYTHON%') do ( 24 | set PYTHONHOME=%%~dpa 25 | set _PYTHONEXE=%%~nxa 26 | set _PYTHON="%%~dpa%%~nxa" 27 | ) 28 | 29 | REM add Python home to PATH if necessary to avoid using the wrong Python executable 30 | setlocal enabledelayedexpansion 31 | set _PYTHON_FOUND= 32 | for %%i in (%_PYTHONEXE%) do ( 33 | set _PYTHON_FOUND="%%~$PATH:i" 34 | ) 35 | 36 | REM delayed expansion is needed since there could be special characters in the PATH variable 37 | if not "!_PYTHON_FOUND!" == "!_PYTHON!" ( 38 | set PATH=%PYTHONHOME%;%PYTHONHOME%Scripts;!PATH! 39 | ) 40 | endlocal & set PATH=%PATH% 41 | 42 | REM invoke Python script to generate necessary exports of environment variables 43 | FOR /F "delims=" %%i IN ('^"%_PYTHON% "%_SETUP_UTIL%" %*^"') DO call %%i 44 | 45 | REM source all environment hooks 46 | set _HOOK_COUNT=0 47 | :hook_loop 48 | if %_HOOK_COUNT% LSS %_CATKIN_ENVIRONMENT_HOOKS_COUNT% ( 49 | REM set workspace for environment hook 50 | call set CATKIN_ENV_HOOK_WORKSPACE=%%_CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%_WORKSPACE%% 51 | set _CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%_WORKSPACE= 52 | 53 | REM call environment hook 54 | call %%_CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%%% 55 | set _CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%= 56 | 57 | set CATKIN_ENV_HOOK_WORKSPACE= 58 | 59 | set /a _HOOK_COUNT=%_HOOK_COUNT%+1 60 | goto :hook_loop 61 | ) 62 | 63 | REM unset temporary variables 64 | set _SETUP_UTIL= 65 | set _PYTHON= 66 | set _PYTHONEXE= 67 | set _PYTHON_FOUND= 68 | set _CATKIN_ENVIRONMENT_HOOKS_COUNT= 69 | set _HOOK_COUNT= 70 | -------------------------------------------------------------------------------- /cmake/templates/setup.zsh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # generated from catkin/cmake/templates/setup.zsh.in 3 | 4 | CATKIN_SHELL=zsh 5 | 6 | # source setup.sh from same directory as this file 7 | _CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd) 8 | emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh"' 9 | -------------------------------------------------------------------------------- /cmake/test/catkin_download_test_data.cmake: -------------------------------------------------------------------------------- 1 | _generate_function_if_testing_is_disabled("catkin_download_test_data") 2 | 3 | # 4 | # Download a file containing test data from a URL. 5 | # 6 | # It is commonly used to download larger data files for unit tests 7 | # which should not be stored in the repository. 8 | # 9 | # .. note:: It is not recommended to rely on downloaded data during 10 | # a configure / make cycle since this prevents building the package 11 | # when no network connectivity is available. 12 | # 13 | # .. note:: The target will be registered as a dependency 14 | # of the "tests" and "download_extra_data" targets, but not of "all" target. 15 | # 16 | # .. note:: If the tests should be run on the ROS buildfarm the URL 17 | # must be publically and reliably accessible. 18 | # 19 | # :param target: the target name 20 | # :type target: string 21 | # :param url: the url to download 22 | # :type url: string 23 | 24 | # :param DESTINATION: the directory where the file is downloaded to 25 | # (default: ${PROJECT_BINARY_DIR}) 26 | # :type DESTINATION: string 27 | # :param FILENAME: the filename of the downloaded file 28 | # (default: the basename of the url) 29 | # :type FILENAME: string 30 | # :param MD5: the expected md5 hash to compare against 31 | # (default: empty, skipping the check) 32 | # :type MD5: string 33 | # 34 | # Additionally, option REQUIRED can be specified. 35 | # 36 | # @public 37 | function(catkin_download_test_data target url) 38 | _warn_if_skip_testing("catkin_download_test_data") 39 | 40 | catkin_download("${target}" "${url}" ${ARGN} EXCLUDE_FROM_ALL) 41 | 42 | if(TARGET tests) 43 | add_dependencies(tests ${target}) 44 | endif() 45 | endfunction() 46 | -------------------------------------------------------------------------------- /cmake/test/remove_test_results.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import argparse 4 | import os 5 | import sys 6 | 7 | 8 | def main(argv=sys.argv[1:]): 9 | parser = argparse.ArgumentParser( 10 | description='Remove all test result files found within a given path.') 11 | parser.add_argument('path', help='The path to recursively process') 12 | args = parser.parse_args(argv) 13 | 14 | print("Removing test result files from '%s'" % os.path.abspath(args.path)) 15 | if not os.path.exists(args.path): 16 | return 0 17 | 18 | for dirpath, dirnames, filenames in os.walk(args.path): 19 | # do not recurse into folders starting with a dot 20 | dirnames[:] = [d for d in dirnames if not d.startswith('.')] 21 | for filename in [f for f in filenames if f.endswith('.xml')]: 22 | filename_abs = os.path.join(dirpath, filename) 23 | print("- removing '%s'" % filename_abs) 24 | os.remove(filename_abs) 25 | 26 | return 0 27 | 28 | 29 | if __name__ == '__main__': 30 | sys.exit(main()) 31 | -------------------------------------------------------------------------------- /cmake/test/run_tests.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import argparse 4 | import subprocess 5 | import sys 6 | 7 | from catkin.test_results import ensure_junit_result_exist, remove_junit_result 8 | 9 | 10 | def main(argv=sys.argv[1:]): 11 | parser = argparse.ArgumentParser(description='Runs the test command passed as an argument and verifies that the expected result file has been generated.') 12 | parser.add_argument('results', help='The path to the xunit result file') 13 | parser.add_argument('command', nargs='+', help='The test command to execute') 14 | parser.add_argument('--working-dir', nargs='?', help='The working directory for the executed command') 15 | parser.add_argument('--return-code', action='store_true', default=False, help='Set the return code based on the success of the test command') 16 | args = parser.parse_args(argv) 17 | 18 | remove_junit_result(args.results) 19 | 20 | work_dir_msg = ' with working directory "%s"' % args.working_dir if args.working_dir is not None else '' 21 | cmds_msg = ''.join(['\n %s' % cmd for cmd in args.command]) 22 | print('-- run_tests.py: execute commands%s%s' % (work_dir_msg, cmds_msg)) 23 | 24 | rc = 0 25 | for cmd in args.command: 26 | rc = subprocess.call(cmd, cwd=args.working_dir, shell=True) 27 | if rc: 28 | break 29 | 30 | print('-- run_tests.py: verify result "%s"' % args.results) 31 | no_errors = ensure_junit_result_exist(args.results) 32 | if not no_errors: 33 | rc = 1 34 | 35 | if args.return_code: 36 | return rc 37 | return 0 38 | 39 | 40 | if __name__ == '__main__': 41 | sys.exit(main()) 42 | -------------------------------------------------------------------------------- /cmake/tools/bz2.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011, Willow Garage, Inc. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Willow Garage, Inc. nor the names of its 13 | # contributors may be used to endorse or promote products derived from 14 | # this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | find_package(Bzip2) 30 | -------------------------------------------------------------------------------- /cmake/tools/doxygen.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011, Willow Garage, Inc. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Willow Garage, Inc. nor the names of its 13 | # contributors may be used to endorse or promote products derived from 14 | # this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | ## 30 | # doxygen( ) 31 | # TARGET_NAME -> The cmake target to create. 32 | # SEARCH_DIRS -> a CMake List of directories to search for doxygenated files. 33 | # 34 | find_program(DOXYGEN_EXECUTABLE doxygen) 35 | 36 | if (DOXYGEN_EXECUTABLE) 37 | set(DOXYGEN_FOUND TRUE CACHE BOOL "Doxygen found") 38 | endif() 39 | 40 | if(NOT TARGET doxygen) 41 | add_custom_target(doxygen) 42 | endif() 43 | 44 | function(catkin_doxygen TARGET_NAME SEARCH_DIRS) 45 | foreach(dir ${SEARCH_DIRS}) 46 | file(GLOB_RECURSE _doc_sources ${dir}/*) 47 | list(APPEND doc_sources ${_doc_sources}) 48 | endforeach() 49 | 50 | string(REPLACE ";" " " doc_sources "${doc_sources}") 51 | 52 | configure_file(${catkin_EXTRAS_DIR}/templates/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) 53 | 54 | add_custom_target(${TARGET_NAME} 55 | COMMENT "Generating API documentation with Doxygen" VERBATIM 56 | ) 57 | 58 | add_custom_command(TARGET ${TARGET_NAME} 59 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 60 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 61 | ) 62 | add_dependencies(doxygen ${TARGET_NAME}) 63 | 64 | endfunction() 65 | -------------------------------------------------------------------------------- /cmake/tools/libraries.cmake: -------------------------------------------------------------------------------- 1 | # BUILD_SHARED_LIBS is a global cmake variable (usually defaults to on) 2 | # that determines the build type of libraries: 3 | # http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS 4 | # It defaults to shared. 5 | # 6 | # Our only current major use case for static libraries is 7 | # via the mingw cross compiler, though embedded builds 8 | # could be feasibly built this way also (largely untested). 9 | 10 | # Make sure this is already defined as a cached variable (@sa platform/windows.cmake) 11 | if(NOT DEFINED BUILD_SHARED_LIBS) 12 | option(BUILD_SHARED_LIBS "Build dynamically-linked binaries" ON) 13 | endif() 14 | 15 | function(configure_shared_library_build_settings) 16 | if(BUILD_SHARED_LIBS) 17 | message(STATUS "BUILD_SHARED_LIBS is on") 18 | add_definitions(-DROS_BUILD_SHARED_LIBS=1) 19 | else() 20 | message(STATUS "BUILD_SHARED_LIBS is off") 21 | endif() 22 | endfunction() 23 | -------------------------------------------------------------------------------- /cmake/tools/rt.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011, Willow Garage, Inc. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Willow Garage, Inc. nor the names of its 13 | # contributors may be used to endorse or promote products derived from 14 | # this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # message("CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}") 30 | # message("CMAKE_LIBRARY_ARCHITECTURE: ${CMAKE_LIBRARY_ARCHITECTURE}") 31 | # message("CMAKE_SYSTEM_LIBRARY_PATH: ${CMAKE_SYSTEM_LIBRARY_PATH}") 32 | # message("CMAKE_VERSION=${CMAKE_VERSION}") 33 | 34 | get_property(ENABLED_LANGUAGES_LIST GLOBAL PROPERTY ENABLED_LANGUAGES) 35 | list(FIND ENABLED_LANGUAGES_LIST "CXX" _cxx_index) 36 | if(NOT (APPLE OR WIN32 OR MINGW OR ANDROID) AND "${_cxx_index}" GREATER -1) 37 | if (${CMAKE_VERSION} VERSION_LESS 2.8.4) 38 | # cmake later than 2.8.0 appears to have a better find_library 39 | # that knows about the ABI of the compiler. For lucid we just 40 | # depend on the linker to find it for us. 41 | set(RT_LIBRARY rt CACHE FILEPATH "Hacked find of rt for cmake < 2.8.4") 42 | else() 43 | find_library(RT_LIBRARY rt) 44 | assert_file_exists(${RT_LIBRARY} "RT Library") 45 | endif() 46 | #message(STATUS "RT_LIBRARY: ${RT_LIBRARY}") 47 | endif() 48 | -------------------------------------------------------------------------------- /cmake/tools/threads.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011, Willow Garage, Inc. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Willow Garage, Inc. nor the names of its 13 | # contributors may be used to endorse or promote products derived from 14 | # this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | find_package(Threads) 30 | set(THREADS_LIBRARY ${CMAKE_THREAD_LIBS_INIT} CACHE FILEPATH "Threads library") 31 | -------------------------------------------------------------------------------- /cmake/toplevel.cmake: -------------------------------------------------------------------------------- 1 | # toplevel CMakeLists.txt for a catkin workspace 2 | # catkin/cmake/toplevel.cmake 3 | 4 | cmake_minimum_required(VERSION 3.0.2) 5 | 6 | project(Project) 7 | 8 | set(CATKIN_TOPLEVEL TRUE) 9 | 10 | # search for catkin within the workspace 11 | set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") 12 | execute_process(COMMAND ${_cmd} 13 | RESULT_VARIABLE _res 14 | OUTPUT_VARIABLE _out 15 | ERROR_VARIABLE _err 16 | OUTPUT_STRIP_TRAILING_WHITESPACE 17 | ERROR_STRIP_TRAILING_WHITESPACE 18 | ) 19 | if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) 20 | # searching for catkin resulted in an error 21 | string(REPLACE ";" " " _cmd_str "${_cmd}") 22 | message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") 23 | endif() 24 | 25 | # include catkin from workspace or via find_package() 26 | if(_res EQUAL 0) 27 | set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") 28 | # include all.cmake without add_subdirectory to let it operate in same scope 29 | include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) 30 | add_subdirectory("${_out}") 31 | 32 | else() 33 | # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument 34 | # or CMAKE_PREFIX_PATH from the environment 35 | if(NOT DEFINED CMAKE_PREFIX_PATH) 36 | if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") 37 | if(NOT WIN32) 38 | string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 39 | else() 40 | set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 41 | endif() 42 | endif() 43 | endif() 44 | 45 | # list of catkin workspaces 46 | set(catkin_search_path "") 47 | foreach(path ${CMAKE_PREFIX_PATH}) 48 | if(EXISTS "${path}/.catkin") 49 | list(FIND catkin_search_path ${path} _index) 50 | if(_index EQUAL -1) 51 | list(APPEND catkin_search_path ${path}) 52 | endif() 53 | endif() 54 | endforeach() 55 | 56 | # search for catkin in all workspaces 57 | set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) 58 | find_package(catkin QUIET 59 | NO_POLICY_SCOPE 60 | PATHS ${catkin_search_path} 61 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) 62 | unset(CATKIN_TOPLEVEL_FIND_PACKAGE) 63 | 64 | if(NOT catkin_FOUND) 65 | message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") 66 | endif() 67 | endif() 68 | 69 | catkin_workspace() 70 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /doc/adv_user_guide/adv_user_guide.rst: -------------------------------------------------------------------------------- 1 | Advanced Users Guide 2 | ==================== 3 | 4 | This section of the documentation is provided for advanced users. 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | catkin_migration_indigo 10 | catkin_migration 11 | builddocs 12 | -------------------------------------------------------------------------------- /doc/adv_user_guide/builddocs.rst: -------------------------------------------------------------------------------- 1 | How to build the docs 2 | ===================== 3 | 4 | catkin provides (and uses) some plugins to `Sphinx 5 | `_ to build documentation. These plugins can 6 | be used to provide a common look and feel to the generated documentation. 7 | 8 | The first time you want to build catkin-controlled documentation (including 9 | catkin's own documentation), you'll need to setup your environment. 10 | 11 | Setup 12 | ----- 13 | 14 | #. Install ``python-catkin-sphinx`` via apt-get:: 15 | 16 | sudo apt-get install python-catkin-sphinx 17 | 18 | #. Alternatively the package is also available via PyPi for non-Debian platforms. 19 | 20 | Now you can build documentation for projects that use the ``ros-theme``. For 21 | example, to build catkin's documentation:: 22 | 23 | git clone git://github.com/ros/catkin.git 24 | cd catkin/doc 25 | make html 26 | 27 | Usage 28 | ----- 29 | 30 | Ros theme 31 | ^^^^^^^^^ 32 | 33 | To use the ``ros-theme`` in your own project's documentation, add the 34 | following line to your ``conf.py``:: 35 | 36 | import catkin_sphinx 37 | html_theme_path.append(os.path.join(os.path.dirname(catkin_sphinx.__file__), 38 | 'theme')) 39 | 40 | # Use ROS theme 41 | html_theme = 'ros-theme' 42 | 43 | Shell prompts 44 | ^^^^^^^^^^^^^ 45 | 46 | If you want to document shell prompts (e.g. install instructions), use:: 47 | 48 | extensions = extensions + ['catkin_sphinx.ShLexer'] 49 | 50 | and document your snippets using:: 51 | 52 | .. code-block:: catkin-sh 53 | 54 | $ sudo pip install mystuff 55 | 56 | Cmake macro documentation 57 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 58 | 59 | If you also want to generate docs for cmake files, add:: 60 | 61 | extensions = extensions + ['catkin_sphinx.cmake'] 62 | 63 | this will enable the sphinx "``.. cmake:macro::``" directive. 64 | -------------------------------------------------------------------------------- /doc/adv_user_guide/catkin_migration_indigo.rst: -------------------------------------------------------------------------------- 1 | Updating a catkin package for Indigo 2 | ==================================== 3 | 4 | If your catkin package is working in Groovy/Hydro it should be easy 5 | to get it working in Indigo too. 6 | 7 | Removed deprecated functions 8 | ---------------------------- 9 | 10 | The following CMake functions and macros which were deprecated before 11 | have been removed from catkin in Indigo. Please replace them with 12 | their replacement: 13 | 14 | * ``add_gtest(..)`` => ``catkin_add_gtest(..)`` 15 | * ``add_nosetests(..)`` => ``catkin_add_nosetests(..)`` 16 | * ``download_test_data(url md5)`` => ``catkin_download_test_data(target url MD5 md5)`` 17 | * ``parse_arguments(..)`` => ``cmake_parse_arguments(..)`` 18 | 19 | Removed Eigen CMake config file 20 | ------------------------------- 21 | 22 | The previously provided CMake config file for Eigen has been removed. 23 | Instead you might want to use the CMake module provided by the 24 | `cmake_modules `_ package. 25 | -------------------------------------------------------------------------------- /doc/dependencies.dot: -------------------------------------------------------------------------------- 1 | digraph G 2 | { 3 | graph [ rankdir=BT, nodesep=2 ]; 4 | catkin->python; 5 | catkin->cmake; 6 | genmsg->catkin; 7 | langs [ 8 | label = " languages | {gencpp | genpy | ... | genlisp}" 9 | shape = "record" 10 | ]; 11 | 12 | 13 | langs:all ->genmsg; 14 | 15 | 16 | std_msgs -> langs:all 17 | common_msgs -> langs:all 18 | roscpp_core [ label = " roscpp_core | {rostime | cpp_common | roscpp_serialization | roscpp_traits}" 19 | shape = "record" 20 | ] 21 | ros_comm [ label = " ros_comm | { rosgraph_msgs | xmlrpcpp | rosconsole | roscpp }" 22 | shape = "record" ] 23 | ros_comm:stack -> catkin 24 | ros_comm:stack -> roscpp_core:stack 25 | ros_comm:stack -> langs:all 26 | roscpp_core:stack -> catkin 27 | } 28 | 29 | -------------------------------------------------------------------------------- /doc/dev_guide/api/catkin.rst: -------------------------------------------------------------------------------- 1 | catkin Package 2 | ============== 3 | 4 | :mod:`find_in_workspaces` Module 5 | -------------------------------- 6 | 7 | .. automodule:: catkin.find_in_workspaces 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | :mod:`init_workspace` Module 13 | ---------------------------- 14 | 15 | .. automodule:: catkin.init_workspace 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | :mod:`package_version` Module 21 | ----------------------------- 22 | 23 | .. automodule:: catkin.package_version 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | 28 | :mod:`test_results` Module 29 | -------------------------- 30 | 31 | .. automodule:: catkin.test_results 32 | :members: 33 | :undoc-members: 34 | :show-inheritance: 35 | 36 | :mod:`tidy_xml` Module 37 | ---------------------- 38 | 39 | .. automodule:: catkin.tidy_xml 40 | :members: 41 | :undoc-members: 42 | :show-inheritance: 43 | 44 | :mod:`workspace` Module 45 | ----------------------- 46 | 47 | .. automodule:: catkin.workspace 48 | :members: 49 | :undoc-members: 50 | :show-inheritance: 51 | 52 | :mod:`workspace_vcs` Module 53 | --------------------------- 54 | 55 | .. automodule:: catkin.workspace_vcs 56 | :members: 57 | :undoc-members: 58 | :show-inheritance: 59 | 60 | -------------------------------------------------------------------------------- /doc/dev_guide/api/index.rst: -------------------------------------------------------------------------------- 1 | Catkin Python API 2 | ================= 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | catkin 10 | 11 | Scripts used by cmake macros: 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | interrogate_setup_dot_py 17 | parse_package_xml 18 | 19 | 20 | Indices and tables 21 | ------------------ 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /doc/dev_guide/api/interrogate_setup_dot_py.rst: -------------------------------------------------------------------------------- 1 | interrogate_setup_dot_py Module 2 | =============================== 3 | 4 | .. automodule:: interrogate_setup_dot_py 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /doc/dev_guide/api/parse_package_xml.rst: -------------------------------------------------------------------------------- 1 | parse_package_xml Module 2 | ======================== 3 | 4 | .. automodule:: parse_package_xml 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /doc/dev_guide/code_generation.rst: -------------------------------------------------------------------------------- 1 | Code Generation 2 | =============== 3 | 4 | ROS messages 5 | ------------ 6 | 7 | An example for code generation is the generation of language bindings 8 | for ROS messages. Catkin parses ``package.xml`` files for declarations 9 | of message-generators. Those will be build first by catkin. 10 | 11 | Other than that, it is up to packages to use genmsg by including it in 12 | the ``CMakeLists.txt`` and calling the cmake macros defined in genmsg. 13 | 14 | See project :ref:`genmsg `. 15 | -------------------------------------------------------------------------------- /doc/dev_guide/dev_guide.rst: -------------------------------------------------------------------------------- 1 | Developers Guide 2 | ================ 3 | 4 | This section of the documentation is provided for developers of 5 | catkin itself. 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | sketch 11 | layout 12 | code_generation 13 | generated_cmake_api 14 | maintainer 15 | api/index 16 | -------------------------------------------------------------------------------- /doc/dev_guide/maintainer.rst: -------------------------------------------------------------------------------- 1 | Catkin Maintainers guide 2 | ------------------------ 3 | 4 | This information is useful for maintainers of catkin itself only. 5 | 6 | Upload catkin documentation 7 | --------------------------- 8 | 9 | To build and upload a new version of catkin's documentation to `ros.org 10 | `_, (this is specific 11 | to catkin itself, and requires that you have appropriate credentials 12 | configured):: 13 | 14 | git clone git://github.com/ros/catkin.git 15 | cd catkin/doc 16 | make html 17 | make upload 18 | -------------------------------------------------------------------------------- /doc/howto/format1/building_executables.rst: -------------------------------------------------------------------------------- 1 | .. _building_executables_1: 2 | 3 | Building and installing C++ executables 4 | --------------------------------------- 5 | 6 | For this example, suppose you have an executable build target named 7 | ``your_node``. 8 | 9 | Headers 10 | ::::::: 11 | 12 | Before compiling, collect all the header paths for your build 13 | dependencies:: 14 | 15 | include_directories(include 16 | ${catkin_INCLUDE_DIRS} 17 | ${Boost_INCLUDE_DIRS} 18 | ${GSTREAMER_INCLUDE_DIRS}) 19 | 20 | These parameters are just examples. The ``include`` parameter is 21 | needed only if that subdirectory of your source package contains 22 | headers used to compile your programs. All your catkin package header 23 | dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. 24 | 25 | Other :ref:`how_to_do_common_tasks_1` pages describe how to resolve 26 | header dependencies in more detail. 27 | 28 | Building 29 | :::::::: 30 | 31 | To build ``your_node``, add this command to your ``CMakeLists.txt``, 32 | listing all required C++ source files, but not the headers:: 33 | 34 | add_executable(your_node src1.cpp src2.cpp src_etc.cpp) 35 | 36 | If the list of files is long, a CMake variable can help:: 37 | 38 | set(YOUR_NODE_SOURCES 39 | src/file1.cpp 40 | src/file2.cpp 41 | src/file3.cpp 42 | src/file4.cpp 43 | src/file5.cpp 44 | src/file6.cpp 45 | src/file_etc.cpp) 46 | add_executable(your_node ${YOUR_NODE_SOURCES}) 47 | 48 | If your program depends on libraries provided by other catkin 49 | packages, add this:: 50 | 51 | add_executable(your_node ${YOUR_NODE_SOURCES}) 52 | target_link_libraries(your_node ${catkin_LIBRARIES}) 53 | 54 | If your program depends on additional non-catkin system libraries, 55 | include them in the ``target_link_libraries()``:: 56 | 57 | add_executable(your_node ${YOUR_NODE_SOURCES}) 58 | target_link_libraries(your_node 59 | ${catkin_LIBRARIES} 60 | ${Boost_LIBRARIES} 61 | ${GSTREAMER_LIBRARIES}) 62 | 63 | If the list of libraries is lengthy, you can similarly define a CMake 64 | variable for them. 65 | 66 | Installing 67 | :::::::::: 68 | 69 | ROS executables are installed in a per-package directory, not the 70 | distributions's global ``bin/`` directory. There, they are accessible 71 | to rosrun_ and roslaunch_, without cluttering up the shell's 72 | ``$PATH``, and their names only need to be unique within each package. 73 | There are only a few core ROS commands like ``rosrun`` and 74 | ``roslaunch`` that install in the global ``bin/`` directory. 75 | 76 | List all your executables as TARGETS on an install command like this:: 77 | 78 | install(TARGETS your_node 79 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) 80 | 81 | .. _roslaunch: http://ros.org/wiki/roslaunch 82 | .. _rosrun: http://ros.org/wiki/rosrun 83 | -------------------------------------------------------------------------------- /doc/howto/format1/cpp_msg_dependencies.rst: -------------------------------------------------------------------------------- 1 | .. _cpp_msg_dependencies_1: 2 | 3 | C++ message or service dependencies 4 | ----------------------------------- 5 | 6 | When your C++ programs depend on ROS messages or services, they must 7 | be defined by catkin packages like std_msgs_ and sensor_msgs_, which 8 | are used in the examples below. 9 | 10 | There are several kinds of dependencies which must be declared in your 11 | ``package.xml`` and ``CMakeLists.txt`` files to resolve message 12 | references. 13 | 14 | 15 | package.xml 16 | ::::::::::: 17 | 18 | For each C++ message dependency, ``package.xml`` should provide both 19 | ```` and ```` tags with the ROS package 20 | name:: 21 | 22 | std_msgs 23 | std_msgs 24 | 25 | sensor_msgs 26 | sensor_msgs 27 | 28 | 29 | CMakeLists.txt 30 | :::::::::::::: 31 | 32 | For C++ access to ROS messages, CMake needs to find the message or 33 | service headers:: 34 | 35 | find_package(catkin REQUIRED COMPONENTS std_msgs sensor_msgs) 36 | include_directories(include ${catkin_INCLUDE_DIRS}) 37 | 38 | The ``include`` parameter is needed only if that subdirectory of your 39 | package contains headers also needed to compile your programs. 40 | 41 | Since you presumably have build targets using the message or service 42 | headers, add this to ensure all their headers get built before any 43 | targets that need them:: 44 | 45 | add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) 46 | add_dependencies(your_library ${catkin_EXPORTED_TARGETS}) 47 | 48 | .. _sensor_msgs: http://www.ros.org/wiki/sensor_msgs 49 | .. _std_msgs: http://www.ros.org/wiki/std_msgs 50 | -------------------------------------------------------------------------------- /doc/howto/format1/downloading_test_data.rst: -------------------------------------------------------------------------------- 1 | .. _downloading_test_data: 2 | 3 | Downloading test data 4 | --------------------- 5 | 6 | When unit tests require large data files, it is better to download 7 | them from the web than include them in your source repository. This 8 | should only happen in a conditional block when testing is enabled. 9 | 10 | Each of these files declares a target name. Running ``"make tests"`` 11 | or ``"make run_tests"`` will automatically download them all. 12 | Individual test targets do *not* depend on the ``tests`` target, but 13 | you can use it to download them before running one:: 14 | 15 | $ make tests run_tests_your_package 16 | 17 | Catkin provides a convenient command, used like this:: 18 | 19 | if (CATKIN_ENABLE_TESTING) 20 | catkin_download_test_data( 21 | ${PROJECT_NAME}_32e.pcap 22 | http://download.ros.org/data/velodyne/32e.pcap 23 | MD5 e41d02aac34f0967c03a5597e1d554a9) 24 | endif() 25 | 26 | The first parameter is the target name, which should normally include 27 | your project name to avoid conflicts with other packages. 28 | 29 | The second parameter is the URL to read. If you release your package 30 | to the ROS build farm, make sure this URL is available reliably. 31 | Otherwise, tests will fail randomly, annoying everyone. Contact 32 | ``ros-release@lists.ros.org`` if you need to host some data near the 33 | build servers. 34 | 35 | The MD5 argument is a good way to avoid testing with corrupted data. 36 | 37 | The default destination for the file downloaded above is within your 38 | package's build directory. The file name is the base name of the URL. 39 | You can use the DESTINATION argument to put it somewhere else. 40 | 41 | For example, sometimes a rostest_ script wants to use ``$(find 42 | your_package)`` to access the test data. Here is how to put the file 43 | in devel-space, where roslaunch_ can resolve it:: 44 | 45 | if (CATKIN_ENABLE_TESTING) 46 | catkin_download_test_data( 47 | ${PROJECT_NAME}_32e.pcap 48 | http://download.ros.org/data/velodyne/32e.pcap 49 | DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests 50 | MD5 e41d02aac34f0967c03a5597e1d554a9) 51 | endif() 52 | 53 | Then, the test script can pass it as a parameter, like this:: 54 | 55 | 56 | 57 | 58 | 59 | 60 | .. _roslaunch: http://ros.org/wiki/roslaunch/XML#substitution_args 61 | .. _rostest: http://ros.org/wiki/rostest 62 | -------------------------------------------------------------------------------- /doc/howto/format1/dynamic_reconfiguration.rst: -------------------------------------------------------------------------------- 1 | .. _dynamic_reconfiguration_1: 2 | 3 | Dynamic reconfiguration 4 | ----------------------- 5 | 6 | Configure script 7 | :::::::::::::::: 8 | 9 | Dynamic reconfiguration requires you to provide one or more simple 10 | Python scripts that declare the names, types, values, and ranges of 11 | the parameters you wish to configure dynamically. See the tutorials_ 12 | for details. 13 | 14 | Catkin configure scripts differ from the earlier rosbuild interface. 15 | First, remove any reference to roslib_, which is not needed with 16 | catkin:: 17 | 18 | import roslib; roslib.load_manifest(PACKAGE) 19 | 20 | Then, be sure to use the catkin version of the parameter generator:: 21 | 22 | from dynamic_reconfigure.parameter_generator_catkin import * 23 | 24 | The remainder of your scripts need not change. 25 | 26 | package.xml 27 | ::::::::::: 28 | 29 | You need to declare both build and run-time dependencies on 30 | dynamic_reconfigure_:: 31 | 32 | dynamic_reconfigure 33 | dynamic_reconfigure 34 | 35 | CMakeLists.txt 36 | :::::::::::::: 37 | 38 | Be sure to include dynamic_reconfigure_ among your catkin package 39 | components:: 40 | 41 | find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure ...) 42 | 43 | Generate the reconfigure options, listing all your node's ``.cfg`` 44 | scripts:: 45 | 46 | generate_dynamic_reconfigure_options(cfg/YourNode.cfg) 47 | 48 | If this is a C++ package and you have build targets using the 49 | generated header, add this to ensure it gets built before any 50 | targets needing them (this prevents "file not found" errors when 51 | trying to ``#include`` the generated header):: 52 | 53 | add_dependencies(your_program ${your_package_EXPORTED_TARGETS}) 54 | add_dependencies(your_library ${your_package_EXPORTED_TARGETS}) 55 | 56 | Finally, include dynamic_reconfigure_ in the CATKIN_DEPENDS exports 57 | list for your package:: 58 | 59 | catkin_package(CATKIN_DEPENDS dynamic_reconfigure ...) 60 | 61 | .. _dynamic_reconfigure: http://ros.org/wiki/dynamic_reconfigure 62 | .. _roslib: http://ros.org/wiki/roslib 63 | .. _tutorials: http://ros.org/wiki/dynamic_reconfigure/Tutorials 64 | -------------------------------------------------------------------------------- /doc/howto/format1/gtest_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _gtest_configuration: 2 | 3 | Configuring gtest for C++ 4 | ------------------------- 5 | 6 | Gtest_ is the Google framework for running C++ unit tests. It is a 7 | pure C++ framework. No ROS environment is available. See: 8 | :ref:`rostest_configuration` if your tests need a running roscore_. 9 | 10 | 11 | CMakeLists.txt 12 | :::::::::::::: 13 | 14 | Declare each gtest like this:: 15 | 16 | if (CATKIN_ENABLE_TESTING) 17 | catkin_add_gtest(test_your_node tests/test_your_node.cpp) 18 | target_link_libraries(test_your_node ${catkin_LIBRARIES}) 19 | endif() 20 | 21 | This example assumes your tests are defined in the ``tests/`` 22 | subdirectory in your source tree. 23 | 24 | If other libraries are needed to compile your test program, see 25 | :ref:`building_executables_1` for details. 26 | 27 | .. _Gtest: http://www.ros.org/wiki/gtest 28 | .. _roscore: http://www.ros.org/wiki/roscore 29 | -------------------------------------------------------------------------------- /doc/howto/format1/index.rst: -------------------------------------------------------------------------------- 1 | .. _how_to_do_common_tasks_1: 2 | 3 | Package format 1 (legacy) 4 | ========================= 5 | 6 | When writing a ROS package several tasks often need to be done. These 7 | pages give examples of how to handle most of the common ones. 8 | 9 | .. note:: 10 | 11 | These instructions are for the original ````. 12 | 13 | If you are making small changes to a format 1 package, use these 14 | instructions. If you are ready to upgrade your package to format 15 | 2, see: :ref:`migrating_from_format1_to_format2`. 16 | 17 | Overview 18 | -------- 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | 23 | catkin_overview 24 | 25 | Resolving dependencies 26 | ---------------------- 27 | 28 | Packages almost always use features provided by other packages. 29 | Describe all your direct dependencies. Their transitive dependencies 30 | on other packages are handled automatically by catkin. 31 | 32 | .. toctree:: 33 | :maxdepth: 1 34 | 35 | catkin_library_dependencies 36 | system_library_dependencies 37 | cpp_msg_dependencies 38 | python_module_dependencies 39 | 40 | 41 | Building and installing targets 42 | ------------------------------- 43 | 44 | *Build targets* are generated binaries, shared libraries, message 45 | headers, and other objects. Various targets require special handling. 46 | 47 | .. toctree:: 48 | :maxdepth: 1 49 | 50 | building_executables 51 | building_libraries 52 | building_msgs 53 | dynamic_reconfiguration 54 | installing_python 55 | installing_cmake 56 | installing_other 57 | 58 | 59 | Configuring and running unit tests 60 | ---------------------------------- 61 | 62 | All configuration steps related to testing should be only done 63 | conditionally if ``CATKIN_ENABLE_TESTING`` is set (which is true by 64 | default). Passing ``-DCATKIN_ENABLE_TESTING=0`` to CMake enables to 65 | configure and build packages without any testing overhead. 66 | 67 | If the CMake configuration of packages fails because they use test 68 | functions without checking this flag before the option 69 | ``-DCATKIN_SKIP_TESTING=1`` can be passed to CMake to disable testing 70 | but providing mock functions in order to not break the build. 71 | 72 | .. toctree:: 73 | :maxdepth: 1 74 | 75 | downloading_test_data 76 | gtest_configuration 77 | python_nose_configuration 78 | rostest_configuration 79 | run_tests 80 | -------------------------------------------------------------------------------- /doc/howto/format1/installing_cmake.rst: -------------------------------------------------------------------------------- 1 | .. _installing_cmake_1: 2 | 3 | Installing CMake files 4 | ---------------------- 5 | 6 | Sometimes your package needs to install CMake files for use by other 7 | packages. For that to work, your ``catkin_package()`` command must 8 | include a ``CFG_EXTRAS`` parameter, where you list the CMake files you 9 | want to export:: 10 | 11 | catkin_package(CFG_EXTRAS your_macros.cmake your_modules.cmake) 12 | 13 | When another package uses ``find_package()`` on this package, the listed 14 | CMake files are automatically included. 15 | 16 | Since these data are platform-independent, they should be installed in 17 | your package's **share/** subtree. This example assumes your CMake 18 | sources are in the customary **cmake/** subdirectory:: 19 | 20 | install(FILES cmake/your_macros.cmake cmake/your_modules.cmake 21 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake) 22 | 23 | To install everything in your **cmake/** subdirectory:: 24 | 25 | install(DIRECTORY cmake 26 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 27 | PATTERN ".svn" EXCLUDE) 28 | 29 | The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ 30 | repository. For other types of repositories, it can be omitted. 31 | 32 | .. _`roslaunch scripts`: http://ros.org/wiki/roslaunch/XML 33 | .. _Subversion: http://subversion.apache.org/ 34 | -------------------------------------------------------------------------------- /doc/howto/format1/installing_other.rst: -------------------------------------------------------------------------------- 1 | .. _installing_other_1: 2 | 3 | Installing other files 4 | ---------------------- 5 | 6 | Sometimes your package needs to install additional files, like 7 | `roslaunch scripts`_ or parameter settings. 8 | 9 | In most cases these data are platform-independent, so install them 10 | within your package's share directory:: 11 | 12 | install(FILES your_data your_parameters 13 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) 14 | 15 | This example installs everything in your **launch/** subdirectory:: 16 | 17 | install(DIRECTORY launch/ 18 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch 19 | PATTERN ".svn" EXCLUDE) 20 | 21 | The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ 22 | repository. For other types of repositories, it can be omitted. 23 | 24 | .. _`roslaunch scripts`: http://ros.org/wiki/roslaunch/XML 25 | .. _Subversion: http://subversion.apache.org/ 26 | -------------------------------------------------------------------------------- /doc/howto/format1/python_module_dependencies.rst: -------------------------------------------------------------------------------- 1 | .. _python_module_dependencies_1: 2 | 3 | Python module dependencies 4 | -------------------------- 5 | 6 | When your Python package imports other python modules, ``package.xml`` 7 | should provide a ```` with the appropriate package name. 8 | 9 | For system dependencies, like ``python-numpy`` or ``python-yaml``, use 10 | the corresponding rosdep name:: 11 | 12 | python-numpy 13 | python-yaml 14 | 15 | These names are usually already defined in the `rosdistro 16 | repository`_. If you need a module not yet defined there, please 17 | `fork that repository and add them`_. 18 | 19 | Several ROS infrastructure modules, like ``python-rospkg`` or 20 | ``python-rosdep`` itself, apply to multiple ROS releases and are 21 | released independently of them. Resolve those module dependencies 22 | like other system packages, using the rosdep name:: 23 | 24 | python-rosdep 25 | python-rospkg 26 | 27 | When you import from another ROS Python package, like ``rospy`` or 28 | ``roslaunch``, always use the catkin package name:: 29 | 30 | roslaunch 31 | rospy 32 | 33 | ROS message or service definitions are similarly defined as modules by 34 | ROS packages like std_msgs_ and sensor_msgs_, used as examples here. 35 | For them, use both ```` and ```` tags with 36 | the ROS package name:: 37 | 38 | std_msgs 39 | std_msgs 40 | 41 | sensor_msgs 42 | sensor_msgs 43 | 44 | Your ``CMakeLists.txt`` need not specify Python-only dependencies. 45 | They are resolved automatically via ``sys.path``. 46 | 47 | .. _`fork that repository and add them`: http://ros.org/doc/independent/api/rosdep/html/contributing_rules.html 48 | .. _`rosdistro repository`: https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml 49 | .. _sensor_msgs: http://www.ros.org/wiki/sensor_msgs 50 | .. _std_msgs: http://www.ros.org/wiki/std_msgs 51 | -------------------------------------------------------------------------------- /doc/howto/format1/python_nose_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _python_nose_configuration: 2 | 3 | Configuring Python nose tests 4 | ----------------------------- 5 | 6 | Nosetest_ is the framework for running Python unit tests. No ROS 7 | environment is available. See: :ref:`rostest_configuration` if your 8 | tests need a running roscore_. 9 | 10 | 11 | CMakeLists.txt 12 | :::::::::::::: 13 | 14 | Declare each nose test like this:: 15 | 16 | if (CATKIN_ENABLE_TESTING) 17 | catkin_add_nosetests(test/test_your_node.py) 18 | endif() 19 | 20 | This example assumes your tests are defined in the ``test/`` 21 | subdirectory in your source tree. 22 | 23 | You can also let nosetest find all tests recursively:: 24 | 25 | if (CATKIN_ENABLE_TESTING) 26 | catkin_add_nosetests(test) 27 | endif() 28 | 29 | If you used a message of the current package in the nosetest, make sure to 30 | specify the nosetest like this:: 31 | 32 | catkin_add_nosetests(test/test_your_node.py 33 | DEPENDENCIES ${${PROJECT_NAME}_EXPORTED_TARGETS}) 34 | 35 | If you used messages from other packages, use:: 36 | 37 | catkin_add_nosetests(test/test_your_node.py 38 | DEPENDENCIES ${catkin_EXPORTED_TARGETS}) 39 | 40 | The test will then make sure that the messages used in the test are built 41 | before they are used. 42 | 43 | For more info, please have a look at the :ref:`API `. 44 | 45 | .. _Nosetest: http://www.ros.org/wiki/nosetest 46 | .. _roscore: http://www.ros.org/wiki/roscore 47 | .. _unittest: http://www.ros.org/wiki/unittest 48 | -------------------------------------------------------------------------------- /doc/howto/format1/rostest_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _rostest_configuration: 2 | 3 | Configuring rostest 4 | ------------------- 5 | 6 | Rostest_ is needed whenever unit tests require a roscore_ for running 7 | ROS nodes. 8 | 9 | 10 | package.xml 11 | ::::::::::: 12 | 13 | 14 | The ``rostest`` package is needed at build time, because it defines 15 | the ``add_rostest()`` CMake command:: 16 | 17 | rostest 18 | 19 | Do not declare a ````, because it will conflict with the 20 | required ````. 21 | 22 | 23 | CMakeLists.txt 24 | :::::::::::::: 25 | 26 | You must also include ``rostest`` in your ``find_package()`` 27 | components. Since these dependencies are for tests only you should 28 | find them in a second invocation inside a conditional block:: 29 | 30 | if (CATKIN_ENABLE_TESTING) 31 | find_package(catkin REQUIRED COMPONENTS rostest ...) 32 | endif() 33 | 34 | Finally, declare your rostest launch scripts:: 35 | 36 | if (CATKIN_ENABLE_TESTING) 37 | add_rostest(tests/your_first_rostest.test) 38 | add_rostest(tests/your_second_rostest.test) 39 | endif() 40 | 41 | In case you have a test that accepts arguments, you can pass them like 42 | this:: 43 | 44 | add_rostest(tests/your_rostest.test ARGS arg1:=true arg2:=false) 45 | 46 | If your rostest needs extra data in order to run, you can use the 47 | ``catkin_download_test_data()`` to download the data. 48 | Read more about :ref:`downloading_test_data_2`. 49 | Then you can add a dependency between the rostest target and the 50 | target from ``catkin_download_test_data()``, in order to download the 51 | data before the rostest runs:: 52 | 53 | if (CATKIN_ENABLE_TESTING) 54 | find_package(rostest REQUIRED) 55 | 56 | catkin_download_test_data( 57 | ${PROJECT_NAME}_32e.pcap 58 | http://download.ros.org/data/velodyne/32e.pcap 59 | MD5 e41d02aac34f0967c03a5597e1d554a9) 60 | 61 | add_rostest(tests/your_rostest.test DEPENDENCIES ${PROJECT_NAME}_32e.pcap) 62 | endif() 63 | 64 | If your rostest should contain a gtest executable you can use the 65 | following convenient function:: 66 | 67 | if (CATKIN_ENABLE_TESTING) 68 | add_rostest_gtest(your_third_rostest_target tests/your_third_rostest.test src/test/your_third_rostest.cpp [more cpp files]) 69 | target_link_libraries(your_third_rostest_target [libraries to depend on, e.g. ${catkin_LIBRARIES}]) 70 | endif() 71 | 72 | For more information how to write and run rostests please go to the 73 | Rostest_ wiki page. 74 | 75 | .. _roscore: http://www.ros.org/wiki/roscore 76 | .. _Rostest: http://ros.org/wiki/rostest 77 | -------------------------------------------------------------------------------- /doc/howto/format1/run_tests.rst: -------------------------------------------------------------------------------- 1 | .. _run_tests: 2 | 3 | Running unit tests 4 | ------------------ 5 | 6 | All unit tests can be run by invoking the ``run_tests`` target:: 7 | 8 | catkin_make run_tests 9 | 10 | It will make sure that the ``tests`` target which builds all unit 11 | tests is invoked before. 12 | 13 | 14 | Individual test targets 15 | ::::::::::::::::::::::: 16 | 17 | Besides the global ``run_tests`` target each individual `gtest` / 18 | `nosetest` / `rostest` can be triggered via its own target, e.g.:: 19 | 20 | catkin_make run_tests_packagename_gtest_mytest 21 | 22 | The list of available test targets can be explored by using the 23 | target completion of catkin_make:: 24 | 25 | catkin_make run_tests 26 | 27 | Using these target it is also possible to run all unit tests of a 28 | package or all tests from a package of a specific type:: 29 | 30 | catkin_make run_tests_packagename 31 | catkin_make run_tests_packagename_gtest 32 | 33 | 34 | Summary of unit test results 35 | :::::::::::::::::::::::::::: 36 | 37 | After running unit tests the results are by default placed into the 38 | ``test_results`` folder which is located inside the build folder. 39 | Each unit test will generate a JUnit XML result file. 40 | 41 | To get a summary of the unit test results as well as references to 42 | which tests contain errors or failed invoke:: 43 | 44 | catkin_test_results build/test_results 45 | -------------------------------------------------------------------------------- /doc/howto/format2/building_executables.rst: -------------------------------------------------------------------------------- 1 | .. _building_executables_2: 2 | 3 | Building and installing C++ executables 4 | --------------------------------------- 5 | 6 | For this example, suppose you have an executable build target named 7 | ``your_node``. 8 | 9 | Headers 10 | ::::::: 11 | 12 | Before compiling, collect all the header paths for your build 13 | dependencies:: 14 | 15 | include_directories(include 16 | ${catkin_INCLUDE_DIRS} 17 | ${Boost_INCLUDE_DIRS} 18 | ${GSTREAMER_INCLUDE_DIRS}) 19 | 20 | These parameters are just examples. The ``include`` parameter is 21 | needed only if that subdirectory of your source package contains 22 | headers used to compile your programs. All your catkin package header 23 | dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. 24 | 25 | Other :ref:`how-to pages ` describe how to 26 | resolve header dependencies in more detail. 27 | 28 | Building 29 | :::::::: 30 | 31 | To build ``your_node``, add this command to your ``CMakeLists.txt``, 32 | listing all required C++ source files, but not the headers:: 33 | 34 | add_executable(your_node src1.cpp src2.cpp src_etc.cpp) 35 | 36 | If the list of files is long, a CMake variable can help:: 37 | 38 | set(${PROJECT_NAME}_SOURCES 39 | src/file1.cpp 40 | src/file2.cpp 41 | src/file3.cpp 42 | src/file4.cpp 43 | src/file5.cpp 44 | src/file6.cpp 45 | src/file_etc.cpp) 46 | add_executable(your_node ${${PROJECT_NAME}_SOURCES}) 47 | 48 | If your program depends on libraries provided by other catkin 49 | packages, add this:: 50 | 51 | add_executable(your_node ${${PROJECT_NAME}_SOURCES}) 52 | target_link_libraries(your_node ${catkin_LIBRARIES}) 53 | 54 | If your program depends on additional non-catkin system libraries, 55 | include them in the ``target_link_libraries()``:: 56 | 57 | add_executable(your_node ${${PROJECT_NAME}_SOURCES}) 58 | target_link_libraries(your_node 59 | ${catkin_LIBRARIES} 60 | ${Boost_LIBRARIES} 61 | ${GSTREAMER_LIBRARIES}) 62 | 63 | If the list of libraries is lengthy, you can similarly define a CMake 64 | variable for them. 65 | 66 | Installing 67 | :::::::::: 68 | 69 | ROS executables are installed in a per-package directory, not the 70 | distributions's global ``bin/`` directory. There, they are accessible 71 | to rosrun_ and roslaunch_, without cluttering up the shell's 72 | ``$PATH``, and their names only need to be unique within each package. 73 | There are only a few core ROS commands like ``rosrun`` and 74 | ``roslaunch`` that install in the global ``bin/`` directory. 75 | 76 | List all your executables as TARGETS on an install command like this:: 77 | 78 | install(TARGETS your_node 79 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) 80 | 81 | .. _roslaunch: http://wiki.ros.org/roslaunch 82 | .. _rosrun: http://wiki.ros.org/rosrun 83 | -------------------------------------------------------------------------------- /doc/howto/format2/cpp_msg_dependencies.rst: -------------------------------------------------------------------------------- 1 | .. _cpp_msg_dependencies_2: 2 | 3 | C++ message or service dependencies 4 | ----------------------------------- 5 | 6 | When your C++ programs depend on ROS messages or services, they must 7 | be defined by catkin packages like std_msgs_ and sensor_msgs_, which 8 | are used in the examples below. 9 | 10 | Dependencies on these packages must be declared in your 11 | ``package.xml`` and ``CMakeLists.txt`` files to resolve message 12 | references. 13 | 14 | 15 | package.xml 16 | ::::::::::: 17 | 18 | For each C++ message dependency, ``package.xml`` should provide a 19 | ```` tag with the ROS package name:: 20 | 21 | std_msgs 22 | sensor_msgs 23 | 24 | 25 | CMakeLists.txt 26 | :::::::::::::: 27 | 28 | For C++ access to ROS messages, CMake needs to find the message or 29 | service headers:: 30 | 31 | find_package(catkin REQUIRED COMPONENTS std_msgs sensor_msgs) 32 | include_directories(include ${catkin_INCLUDE_DIRS}) 33 | 34 | The ``include`` parameter is needed only if that subdirectory of your 35 | package contains headers also needed to compile your programs. 36 | 37 | Since you presumably have build targets using the message or service 38 | headers, add this to ensure all their headers get built before any 39 | targets that need them:: 40 | 41 | add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) 42 | add_dependencies(your_library ${catkin_EXPORTED_TARGETS}) 43 | 44 | .. _sensor_msgs: http://wiki.ros.org/sensor_msgs 45 | .. _std_msgs: http://wiki.ros.org/std_msgs 46 | -------------------------------------------------------------------------------- /doc/howto/format2/downloading_test_data.rst: -------------------------------------------------------------------------------- 1 | .. _downloading_test_data_2: 2 | 3 | Downloading test data 4 | --------------------- 5 | 6 | When unit tests require large data files, it is better to download 7 | them from the web than include them in your source repository. This 8 | should only happen in a conditional block when testing is enabled. 9 | 10 | Each of these files declares a target name. Running ``"make tests"`` 11 | or ``"make run_tests"`` will automatically download them all. 12 | Individual test targets do *not* depend on the ``tests`` target, but 13 | you can use it to download them before running one:: 14 | 15 | $ make tests run_tests_your_package 16 | 17 | Catkin provides a convenient command, used like this:: 18 | 19 | if (CATKIN_ENABLE_TESTING) 20 | catkin_download_test_data( 21 | ${PROJECT_NAME}_32e.pcap 22 | http://download.ros.org/data/velodyne/32e.pcap 23 | MD5 e41d02aac34f0967c03a5597e1d554a9) 24 | endif() 25 | 26 | The first parameter is the target name, which should normally include 27 | your project name to avoid conflicts with other packages. 28 | 29 | The second parameter is the URL to read. If you release your package 30 | to the ROS build farm, make sure this URL is available reliably. 31 | Otherwise, tests will fail randomly, annoying everyone. Contact 32 | ``ros-release@lists.ros.org`` if you need to host some data near the 33 | build servers. 34 | 35 | The MD5 argument is a good way to avoid testing with corrupted data. 36 | 37 | The default destination for the file downloaded above is within your 38 | package's build directory. The file name is the base name of the URL. 39 | You can use the DESTINATION argument to put it somewhere else. 40 | 41 | For example, sometimes a rostest_ script wants to use ``$(find 42 | your_package)`` to access the test data. Here is how to put the file 43 | in devel-space, where roslaunch_ can resolve it:: 44 | 45 | if (CATKIN_ENABLE_TESTING) 46 | catkin_download_test_data( 47 | ${PROJECT_NAME}_32e.pcap 48 | http://download.ros.org/data/velodyne/32e.pcap 49 | DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests 50 | MD5 e41d02aac34f0967c03a5597e1d554a9) 51 | endif() 52 | 53 | Then, the test script can pass it as a parameter, like this:: 54 | 55 | 56 | 57 | 58 | 59 | 60 | .. _roslaunch: http://wiki.ros.org/roslaunch/XML#substitution_args 61 | .. _rostest: http://wiki.ros.org/rostest 62 | -------------------------------------------------------------------------------- /doc/howto/format2/dynamic_reconfiguration.rst: -------------------------------------------------------------------------------- 1 | .. _dynamic_reconfiguration_2: 2 | 3 | Dynamic reconfiguration 4 | ----------------------- 5 | 6 | Configure script 7 | :::::::::::::::: 8 | 9 | Dynamic reconfiguration requires you to provide one or more simple 10 | Python scripts that declare the names, types, values, and ranges of 11 | the parameters you wish to configure dynamically. See the tutorials_ 12 | for details. 13 | 14 | Catkin configure scripts differ from the earlier rosbuild interface. 15 | First, remove any reference to roslib_, which is not needed with 16 | catkin:: 17 | 18 | import roslib; roslib.load_manifest(PACKAGE) 19 | 20 | Then, be sure to use the catkin version of the parameter generator:: 21 | 22 | from dynamic_reconfigure.parameter_generator_catkin import * 23 | 24 | The remainder of your scripts need not change. 25 | 26 | package.xml 27 | ::::::::::: 28 | 29 | You need to declare your dependency on dynamic_reconfigure_:: 30 | 31 | dynamic_reconfigure 32 | 33 | CMakeLists.txt 34 | :::::::::::::: 35 | 36 | Be sure to include dynamic_reconfigure_ among your catkin package 37 | components:: 38 | 39 | find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure ...) 40 | 41 | Generate the reconfigure options, listing all your node's ``.cfg`` 42 | scripts:: 43 | 44 | generate_dynamic_reconfigure_options(cfg/YourNode.cfg) 45 | 46 | Include dynamic_reconfigure_ in the CATKIN_DEPENDS exports list for 47 | your package:: 48 | 49 | catkin_package(CATKIN_DEPENDS dynamic_reconfigure ...) 50 | 51 | If this is a C++ package and you have build targets using the 52 | generated header, add this to ensure it gets built before any 53 | targets needing them (this prevents "file not found" errors when 54 | trying to ``#include`` the generated header):: 55 | 56 | add_dependencies(your_program ${${PROJECT_NAME}_EXPORTED_TARGETS}) 57 | add_dependencies(your_library ${${PROJECT_NAME}_EXPORTED_TARGETS}) 58 | 59 | .. _dynamic_reconfigure: http://wiki.ros.org/dynamic_reconfigure 60 | .. _roslib: http://wiki.ros.org/roslib 61 | .. _tutorials: http://wiki.ros.org/dynamic_reconfigure/Tutorials 62 | -------------------------------------------------------------------------------- /doc/howto/format2/gtest_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _gtest_configuration_2: 2 | 3 | Configuring gtest for C++ 4 | ------------------------- 5 | 6 | Gtest_ is the Google framework for running C++ unit tests. It is a 7 | pure C++ framework. No ROS environment is available. See: 8 | :ref:`rostest_configuration` if your tests need a running roscore_. 9 | 10 | 11 | CMakeLists.txt 12 | :::::::::::::: 13 | 14 | Declare each gtest like this:: 15 | 16 | if (CATKIN_ENABLE_TESTING) 17 | catkin_add_gtest(test_your_node tests/test_your_node.cpp) 18 | target_link_libraries(test_your_node ${catkin_LIBRARIES}) 19 | endif() 20 | 21 | This example assumes your tests are defined in the ``tests/`` 22 | subdirectory in your source tree. 23 | 24 | If other libraries are needed to compile your test program, see 25 | :ref:`building_executables_2` for details. 26 | 27 | .. _Gtest: http://wiki.ros.org/gtest 28 | .. _roscore: http://wiki.ros.org/roscore 29 | -------------------------------------------------------------------------------- /doc/howto/format2/index.rst: -------------------------------------------------------------------------------- 1 | .. _how_to_do_common_tasks_2: 2 | 3 | Package format 2 (recommended) 4 | ============================== 5 | 6 | When writing a ROS package several tasks often need to be done. These 7 | pages give examples of how to handle most of the common ones. 8 | 9 | .. note:: 10 | 11 | These instructions are for ````. 12 | 13 | If you are making small changes to a format 1 package, please use 14 | :ref:`how_to_do_common_tasks_1` instead. If you are ready to 15 | upgrade a format 1 package to format 2, see: 16 | :ref:`migrating_from_format1_to_format2`. 17 | 18 | Overview 19 | -------- 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | catkin_overview 25 | 26 | Resolving dependencies 27 | ---------------------- 28 | 29 | Packages almost always use features provided by other packages. 30 | Describe all your direct dependencies. Their transitive dependencies 31 | on other packages are handled automatically by catkin. 32 | 33 | .. toctree:: 34 | :maxdepth: 1 35 | 36 | catkin_library_dependencies 37 | system_library_dependencies 38 | cpp_msg_dependencies 39 | python_module_dependencies 40 | 41 | 42 | Building and installing targets 43 | ------------------------------- 44 | 45 | *Build targets* are generated binaries, shared libraries, message 46 | headers, and other objects. Various targets require special handling. 47 | 48 | .. toctree:: 49 | :maxdepth: 1 50 | 51 | building_executables 52 | building_libraries 53 | building_msgs 54 | dynamic_reconfiguration 55 | installing_python 56 | installing_cmake 57 | installing_other 58 | 59 | 60 | Configuring and running unit tests 61 | ---------------------------------- 62 | 63 | All configuration steps related to testing should be only done 64 | conditionally when ``CATKIN_ENABLE_TESTING`` is set, which is true by 65 | default. Passing ``-DCATKIN_ENABLE_TESTING=0`` to CMake enables 66 | configuring and building packages without any testing overhead. 67 | 68 | .. toctree:: 69 | :maxdepth: 1 70 | 71 | downloading_test_data 72 | gtest_configuration 73 | python_nose_configuration 74 | rostest_configuration 75 | run_tests 76 | 77 | Migrating from package format 1 78 | ------------------------------- 79 | 80 | When a format 1 package is revised, it probably makes sense to upgrade 81 | its ``package.xml`` to format 2. 82 | 83 | .. toctree:: 84 | :maxdepth: 1 85 | 86 | migrating_from_format_1 87 | -------------------------------------------------------------------------------- /doc/howto/format2/installing_cmake.rst: -------------------------------------------------------------------------------- 1 | .. _installing_cmake_2: 2 | 3 | Installing CMake files 4 | ---------------------- 5 | 6 | Sometimes your package needs to install CMake files for use by other 7 | packages. For that to work, your ``catkin_package()`` command must 8 | include a ``CFG_EXTRAS`` parameter, where you list the CMake files you 9 | want to export:: 10 | 11 | catkin_package(CFG_EXTRAS your_macros.cmake your_modules.cmake) 12 | 13 | When another package uses ``find_package()`` on this package, the listed 14 | CMake files are automatically included. 15 | 16 | Since these data are platform-independent, they should be installed in 17 | your package's **share/** subtree. This example assumes your CMake 18 | sources are in the customary **cmake/** subdirectory:: 19 | 20 | install(FILES cmake/your_macros.cmake cmake/your_modules.cmake 21 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake) 22 | 23 | To install everything in your **cmake/** subdirectory:: 24 | 25 | install(DIRECTORY cmake 26 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 27 | PATTERN ".svn" EXCLUDE) 28 | 29 | The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ 30 | repository. For other types of repositories, it can be omitted. 31 | 32 | .. _`roslaunch scripts`: http://wiki.ros.org/roslaunch/XML 33 | .. _Subversion: http://subversion.apache.org/ 34 | -------------------------------------------------------------------------------- /doc/howto/format2/installing_other.rst: -------------------------------------------------------------------------------- 1 | .. _installing_other_2: 2 | 3 | Installing other files 4 | ---------------------- 5 | 6 | Sometimes your package needs to install additional files, like 7 | `roslaunch scripts`_ or parameter settings. 8 | 9 | In most cases these data are platform-independent, so install them 10 | within your package's share directory:: 11 | 12 | install(FILES your_data your_parameters 13 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) 14 | 15 | This example installs everything in your **launch/** subdirectory:: 16 | 17 | install(DIRECTORY launch/ 18 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch 19 | PATTERN ".svn" EXCLUDE) 20 | 21 | The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ 22 | repository. For other types of repositories, it can be omitted. 23 | 24 | .. _`roslaunch scripts`: http://wiki.ros.org/roslaunch/XML 25 | .. _Subversion: http://subversion.apache.org/ 26 | -------------------------------------------------------------------------------- /doc/howto/format2/python_module_dependencies.rst: -------------------------------------------------------------------------------- 1 | .. _python_module_dependencies_2: 2 | 3 | Python module dependencies 4 | -------------------------- 5 | 6 | When your Python package imports other python modules, ``package.xml`` 7 | should provide a ```` with the appropriate package name. 8 | 9 | For system dependencies, like ``python-numpy`` or ``python-yaml``, use 10 | the corresponding rosdep name:: 11 | 12 | python-numpy 13 | python-yaml 14 | 15 | These names are usually already defined in the `rosdistro 16 | repository`_. If you need a module not yet defined there, please 17 | `fork that repository and add them`_. 18 | 19 | Several ROS infrastructure modules, like ``python-rospkg`` or 20 | ``python-rosdep`` itself, apply to multiple ROS releases and are 21 | released independently of them. Resolve those module dependencies 22 | like other system packages, using the rosdep name:: 23 | 24 | python-rosdep 25 | python-rospkg 26 | 27 | When you import from another ROS Python package, like ``rospy`` or 28 | ``roslaunch``, always use the catkin package name:: 29 | 30 | roslaunch 31 | rospy 32 | 33 | ROS message or service definitions are defined as modules by ROS 34 | packages like std_msgs_ and sensor_msgs_, used as examples here. 35 | Although ```` is adequate when all references are in 36 | Python, the recommended method is using a ```` tag with the 37 | message package name:: 38 | 39 | std_msgs 40 | sensor_msgs 41 | 42 | Your ``CMakeLists.txt`` need not specify Python-only dependencies. 43 | They are resolved automatically via ``sys.path``. 44 | 45 | .. _`fork that repository and add them`: 46 | http://docs.ros.org/independent/api/rosdep/html/contributing_rules.html 47 | .. _`rosdistro repository`: 48 | https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml 49 | .. _sensor_msgs: http://wiki.ros.org/sensor_msgs 50 | .. _std_msgs: http://wiki.ros.org/std_msgs 51 | -------------------------------------------------------------------------------- /doc/howto/format2/python_nose_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _python_nose_configuration_2: 2 | 3 | Configuring Python nose tests 4 | ----------------------------- 5 | 6 | Nosetest_ is the framework for running Python unit tests. No ROS 7 | environment is available. See: :ref:`rostest_configuration` if your 8 | tests need a running roscore_. 9 | 10 | 11 | CMakeLists.txt 12 | :::::::::::::: 13 | 14 | Declare each nose test like this:: 15 | 16 | if (CATKIN_ENABLE_TESTING) 17 | catkin_add_nosetests(test/test_your_node.py) 18 | endif() 19 | 20 | This example assumes your tests are defined in the ``test/`` 21 | subdirectory in your source tree. 22 | 23 | You can also let nosetest find all tests recursively:: 24 | 25 | if (CATKIN_ENABLE_TESTING) 26 | catkin_add_nosetests(test) 27 | endif() 28 | 29 | If you used a message of the current package in the nosetest, make sure to 30 | specify the nosetest like this:: 31 | 32 | catkin_add_nosetests(test/test_your_node.py 33 | DEPENDENCIES ${${PROJECT_NAME}_EXPORTED_TARGETS}) 34 | 35 | If you used messages from other packages, use:: 36 | 37 | catkin_add_nosetests(test/test_your_node.py 38 | DEPENDENCIES ${catkin_EXPORTED_TARGETS}) 39 | 40 | The test will then make sure that the messages used in the test are built 41 | before they are used. 42 | 43 | For more info, please have a look at the :ref:`API `. 44 | 45 | .. _Nosetest: http://www.ros.org/wiki/nosetest 46 | .. _roscore: http://www.ros.org/wiki/roscore 47 | .. _unittest: http://www.ros.org/wiki/unittest 48 | -------------------------------------------------------------------------------- /doc/howto/format2/rostest_configuration.rst: -------------------------------------------------------------------------------- 1 | .. _rostest_configuration_2: 2 | 3 | Configuring rostest 4 | ------------------- 5 | 6 | Use rostest_ whenever your unit tests require a roscore_ for running 7 | ROS nodes. 8 | 9 | 10 | package.xml 11 | ::::::::::: 12 | 13 | Declare ``rostest`` as a test dependency, along with any other 14 | test-only dependencies:: 15 | 16 | rostest 17 | 18 | 19 | CMakeLists.txt 20 | :::::::::::::: 21 | 22 | You need a ``find_package()`` for ``rostest`` to define the necessary 23 | CMake commands. It is better *not* to use a second 24 | ``find_package(catkin ...)`` for test dependencies like rostest, 25 | because that would reset important catkin CMake variables, making it 26 | hard to build test programs. 27 | 28 | Place both the ``find_package()`` and your test declarations inside 29 | the conditional testing block:: 30 | 31 | if (CATKIN_ENABLE_TESTING) 32 | find_package(rostest REQUIRED) 33 | add_rostest(tests/your_first_rostest.test) 34 | add_rostest(tests/your_second_rostest.test) 35 | endif() 36 | 37 | In case you have a test that accepts arguments, you can pass them like 38 | this:: 39 | 40 | add_rostest(tests/your_rostest.test ARGS arg1:=true arg2:=false) 41 | 42 | If your rostest needs extra data in order to run, you can use the 43 | ``catkin_download_test_data()`` to download the data. 44 | Read more about :ref:`downloading_test_data_2`. 45 | Then you can add a dependency between the rostest target and the 46 | target from ``catkin_download_test_data()``, in order to download the 47 | data before the rostest runs:: 48 | 49 | if (CATKIN_ENABLE_TESTING) 50 | find_package(rostest REQUIRED) 51 | 52 | catkin_download_test_data( 53 | ${PROJECT_NAME}_32e.pcap 54 | http://download.ros.org/data/velodyne/32e.pcap 55 | MD5 e41d02aac34f0967c03a5597e1d554a9) 56 | 57 | add_rostest(tests/your_rostest.test DEPENDENCIES ${PROJECT_NAME}_32e.pcap) 58 | endif() 59 | 60 | If your rostest also uses a gtest_ executable, there is a convenience 61 | function:: 62 | 63 | if (CATKIN_ENABLE_TESTING) 64 | add_rostest_gtest(your_gtest_node 65 | tests/your_third_rostest.test 66 | tests/your_gtest_node.cpp) 67 | target_link_libraries(your_gtest_node ${catkin_LIBRARIES}) 68 | endif() 69 | 70 | Any additional library dependencies would be added to the 71 | ``target_link_libraries()``, as usual. 72 | 73 | For more details on writing and running rostests, see the rostest_ 74 | documentation. 75 | 76 | .. _gtest: http://wiki.ros.org/gtest 77 | .. _roscore: http://wiki.ros.org/roscore 78 | .. _rostest: http://wiki.ros.org/rostest 79 | -------------------------------------------------------------------------------- /doc/howto/format2/run_tests.rst: -------------------------------------------------------------------------------- 1 | .. _run_tests_2: 2 | 3 | Running unit tests 4 | ------------------ 5 | 6 | All unit tests can be run by invoking the ``run_tests`` target:: 7 | 8 | catkin_make run_tests 9 | 10 | It will make sure that the ``tests`` target which builds all unit 11 | tests is invoked before. 12 | 13 | 14 | Individual test targets 15 | ::::::::::::::::::::::: 16 | 17 | Besides the global ``run_tests`` target each individual `gtest` / 18 | `nosetest` / `rostest` can be triggered via its own target, e.g.:: 19 | 20 | catkin_make run_tests_packagename_gtest_mytest 21 | 22 | The list of available test targets can be explored by using the 23 | target completion of catkin_make:: 24 | 25 | catkin_make run_tests 26 | 27 | Using these target it is also possible to run all unit tests of a 28 | package or all tests from a package of a specific type:: 29 | 30 | catkin_make run_tests_packagename 31 | catkin_make run_tests_packagename_gtest 32 | 33 | 34 | Summary of unit test results 35 | :::::::::::::::::::::::::::: 36 | 37 | After running unit tests the results are by default placed into the 38 | ``test_results`` folder which is located inside the build folder. 39 | Each unit test will generate a JUnit XML result file. 40 | 41 | To get a summary of the unit test results as well as references to 42 | which tests contain errors or failed invoke:: 43 | 44 | catkin_test_results build/test_results 45 | -------------------------------------------------------------------------------- /doc/howto/index.rst: -------------------------------------------------------------------------------- 1 | How to do common tasks 2 | ====================== 3 | 4 | There are currently two ``package.xml`` format versions. The 5 | ```` is recommended for new development. 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | format2/index 11 | 12 | The original ```` was used for most packages 13 | released to Groovy and Hydro. It is still fully supported and 14 | maintainers need not re-release their packages merely to upgrade the 15 | package version. 16 | 17 | Use these instructions when making small changes to an existing format 18 | 1 package. Larger changes would justify migrating to format 2. Never 19 | mix versions in a single package. 20 | 21 | .. toctree:: 22 | :maxdepth: 2 23 | 24 | format1/index 25 | 26 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | Catkin 2 | ====== 3 | 4 | `Catkin `_ is a collection of CMake macros 5 | and associated code used to build packages used in `ROS 6 | `_. 7 | 8 | It was initially introduced as part of the ROS Fuerte_ release where 9 | it was used for a small set of base packages. For Groovy_ and Hydro_ 10 | it was significantly modified, and used by many more packages. All 11 | released Hydro packages were built using catkin, although existing 12 | `rosbuild `_ packages can still be built 13 | from source on top of the catkin packages. Indigo_ is very similar, 14 | except for some deprecated features that were removed. 15 | 16 | .. note:: 17 | 18 | This document covers the Indigo_ version. The Groovy_ and Hydro_ 19 | versions are `documented separately 20 | `_. 21 | 22 | .. _Fuerte: http://wiki.ros.org/fuerte 23 | .. _Groovy: http://wiki.ros.org/groovy 24 | .. _Hydro: http://wiki.ros.org/hydro 25 | .. _Indigo: http://wiki.ros.org/indigo 26 | 27 | 28 | Contents 29 | -------- 30 | 31 | .. toctree:: 32 | :maxdepth: 2 33 | 34 | howto/index 35 | user_guide/user_guide 36 | adv_user_guide/adv_user_guide 37 | dev_guide/dev_guide 38 | 39 | Code & support 40 | -------------- 41 | 42 | +--------------+-------------------------------------+ 43 | | Catkin | http://github.com/ros/catkin | 44 | +--------------+-------------------------------------+ 45 | | Issues | http://github.com/ros/catkin/issues | 46 | +--------------+-------------------------------------+ 47 | -------------------------------------------------------------------------------- /doc/ros.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/doc/ros.png -------------------------------------------------------------------------------- /doc/user_guide/environment.rst: -------------------------------------------------------------------------------- 1 | .. _envfiles: 2 | 3 | Environment files 4 | ================= 5 | 6 | Catkin creates and installs files for env-setting convenience. In the 7 | devel space there are ``setup.zsh`` and ``setup.bash``, these contain 8 | variable zsh and bash specific tweaks. They both import ``setup.sh``, 9 | which contains bourne-shell variable settings. 10 | 11 | .. _env.sh: 12 | .. _setup.sh: 13 | .. _setup.bash: 14 | .. _setup.zsh: 15 | 16 | .. index:: env.sh ; environment 17 | .. index:: setup.sh ; environment 18 | .. index:: setup.bash ; environment 19 | .. index:: setup.zsh ; environment 20 | 21 | ``env.sh``, pointed to by the CMake variable :cmake:data:`CATKIN_ENV` 22 | is special; it executes its arguments in the environment created by 23 | ``setup.sh`` and returns. Any custom commands executed by CMake 24 | should do so via this script. 25 | 26 | .. rubric:: Environment hooks 27 | 28 | Projects can, via the :cmake:macro:`catkin_add_env_hooks` macro, add 29 | sh code to be executed by ``setup.sh`` (and by extension 30 | ``setup.bash`` and friends). If you need to add things to the 31 | environment, this is probably the place to do it. Don't get fancy: 32 | the contents of these scripts must be interpretable by all members of 33 | the bourne shell family. Be safe and ensure that ``/bin/dash`` is 34 | okay with them. 35 | 36 | You should avoid putting absolute paths into these environment hook 37 | ( at least in the install space). Instead use the variable 38 | ``$CATKIN_ENV_HOOK_WORKSPACE`` to point to workspace relative 39 | resources. 40 | 41 | **NOTE**: These environment hooks are only for variable settings, 42 | shell aliases and functions. 43 | -------------------------------------------------------------------------------- /doc/user_guide/find_package.rst: -------------------------------------------------------------------------------- 1 | .. _find_package_internals: 2 | 3 | Finding required packages 4 | ========================= 5 | 6 | Recommended method 7 | ------------------ 8 | 9 | If you want to specify a dependency on several catkin components 10 | simultaneously, use 11 | ``find_package(catkin [XX.YY] REQUIRED COMPONENTS comp1 comp2)``, e.g.:: 12 | 13 | find_package(catkin REQUIRED COMPONENTS 14 | cpp_common rostime roscpp_traits 15 | roscpp_serialization sensor_msgs) 16 | include_directories(${catkin_INCLUDE_DIRS}) 17 | 18 | add_executable(myexec ...) 19 | target_link_libraries(myexec ${catkin_LIBRARIES}) 20 | 21 | You can also reference the variables of each component individually:: 22 | 23 | target_link_libraries(myexec ${rostime_LIBRARIES}) 24 | 25 | See the CMake documentation for ``find_package()`` for more details. 26 | Your ``CMAKE_PREFIX_PATH`` will need to point to a catkin installation. 27 | 28 | 29 | find_package() config mode 30 | -------------------------- 31 | 32 | CMake's ``find_package`` is the preferred method for packages to 33 | communicate to CMake (and thereby to catkin) the libraries, include 34 | directories and such that packages should use. 35 | 36 | There are a couple of modes of operation of find_package (see the 37 | CMake documentation), "module" mode and "config" mode. "module" mode 38 | is the one that uses CMake scripts named ``Find****.cmake``. "config" 39 | mode is the preferred mode, and it works differently. 40 | 41 | One reason we find the 'config mode' superior is that is supports 42 | multiple simultaneous installed versions of packages. 43 | 44 | For a package ``t``, 'config mode' consists of two CMake files, both of 45 | which are installed somewhere on CMake's ``CMAKE_PREFIX_PATH``. The 46 | first is 'tConfig-version.cmake'. We find the most succinct form to 47 | be like this:: 48 | 49 | set(PACKAGE_VERSION_EXACT False) 50 | set(PACKAGE_VERSION_COMPATIBLE False) 51 | if("${PACKAGE_FIND_VERSION}" STREQUAL "") 52 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 53 | return() 54 | endif() 55 | 56 | if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "9.9.9") 57 | set(PACKAGE_VERSION_EXACT True) 58 | set(PACKAGE_VERSION_COMPATIBLE True) 59 | endif() 60 | 61 | if("${PACKAGE_FIND_VERSION}" VERSION_LESS "9.9.9") 62 | set(PACKAGE_VERSION_COMPATIBLE True) 63 | endif() 64 | 65 | where `9.9.9` is replaced by the numeric version of the package. The 66 | second file, ``tConfig.cmake``, tells the client what the assorted 67 | includes/libs are for the package by setting variables 68 | ``t_INCLUDE_DIRS``, ``t_LIBRARIES``, ``t_LIBRARY_DIRS`` and so forth. 69 | The user passes these values to CMake's ``include_directories()`` and 70 | ``target_link_libraries()``. Since the libraries contains absolute 71 | paths ``link_directories()`` is not necessary. 72 | -------------------------------------------------------------------------------- /doc/user_guide/glossary.rst: -------------------------------------------------------------------------------- 1 | Glossary 2 | -------- 3 | 4 | .. glossary:: 5 | 6 | bloom.conf 7 | A file that lives on a special orphan branch `bloom` in a 8 | :term:`GBP repository` which contains meta-information (like 9 | upstream repository location and type) used when making 10 | releases with bloom. 11 | 12 | config-mode infrastructure 13 | Files named ``Config.cmake`` and 14 | ``Config-version.cmake`` which are used by cmake's 15 | ``find_package()`` in "config mode". 16 | 17 | dry 18 | a rosbuild stack or package not yet converted to catkin. 19 | 20 | Environment files 21 | The `setup.sh`, `setup.zsh` and `setup.bash` files generated 22 | and installed by catkin. See also :ref:`envfiles`. 23 | 24 | FHS 25 | The Linux `Filesystem Hierarchy Standard `_ 26 | 27 | generated code 28 | Code generated during the build process, typically by a message 29 | code generator package. May or may not require compilation. 30 | 31 | GBP repository 32 | A ``git-buildpackage`` repository. Contains released upstream 33 | source and the associated debian build files sufficient to 34 | assemble binary and source debs. Bloom-controlled repositories 35 | also contain a branch ``bloom`` with meta-information. 36 | 37 | package 38 | either a not yet to catkin convert package identified by a 39 | manifest.xml or a catkinized package containing a package.xml. 40 | 41 | pkgutil 42 | Nifty python package: 43 | http://docs.python.org/library/pkgutil.html 44 | 45 | project 46 | CMake's notion of a buildable subdirectory: it contains a 47 | ``CMakeLists.txt`` that calls CMake's ``project()`` macro. 48 | 49 | stack 50 | unit of grouping dry packages in the old rosbuild system. Each 51 | stack was packaged into a Debian package. 52 | 53 | static code 54 | Code typed in by a developer, contrast :term:`generated code` 55 | 56 | wet 57 | a ROS package already converted to catkin. 58 | It also applies to non-ROS code using catkin. 59 | -------------------------------------------------------------------------------- /doc/user_guide/installation.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | If you have a working ROS installation, catkin should be installed 5 | already. 6 | 7 | Prerequisites 8 | ------------- 9 | 10 | Catkin has the following dependencies: 11 | 12 | * CMake - A cross-platform, open-source build system. 13 | * Python - A general-purpose, interpreted high-level programming language. 14 | * catkin_pkg - A Python runtime library for catkin. 15 | * empy - A Python template library. 16 | * nose - A Python testing framework. 17 | * GTest - A C++ unit test framework from Google. 18 | 19 | You can resolve these dependencies on Ubuntu with this command:: 20 | 21 | sudo apt-get install cmake python-catkin-pkg python-empy python-nose libgtest-dev 22 | 23 | If you are not on Ubuntu you can install ``catkin_pkg`` from PyPi via 24 | pip:: 25 | 26 | sudo pip install -U catkin_pkg 27 | 28 | Ubuntu install 29 | -------------- 30 | 31 | Catkin is distributed with ROS as binary debian package for Ubuntu, it 32 | can be installed via:: 33 | 34 | sudo apt-get install ros-groovy-catkin 35 | 36 | For ROS Hydro, install ``ros-hydro-catkin`` instead. 37 | -------------------------------------------------------------------------------- /doc/user_guide/user_guide.rst: -------------------------------------------------------------------------------- 1 | User Guide 2 | ========== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | installation 8 | find_package 9 | setup_dot_py 10 | standards 11 | variables 12 | environment 13 | glossary 14 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | catkin 7 | 0.8.12 8 | Low-level build system macros and infrastructure for ROS. 9 | Geoffrey Biggs 10 | Ivan Santiago Paunovic 11 | BSD 12 | 13 | http://wiki.ros.org/catkin 14 | https://github.com/ros/catkin/issues 15 | https://github.com/ros/catkin 16 | 17 | Troy Straszheim 18 | Morten Kjaergaard 19 | Brian Gerkey 20 | Dirk Thomas 21 | Michael Carroll 22 | Tully Foote 23 | 24 | python-argparse 25 | python-catkin-pkg 26 | python3-catkin-pkg 27 | python-empy 28 | python3-empy 29 | 30 | cmake 31 | python-setuptools 32 | python3-setuptools 33 | 34 | cmake 35 | python3-setuptools 36 | 37 | google-mock 38 | gtest 39 | python-nose 40 | python3-nose 41 | 42 | python-mock 43 | python-nose 44 | python3-nose 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /python/catkin/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/python/catkin/__init__.py -------------------------------------------------------------------------------- /python/catkin/cmake.py: -------------------------------------------------------------------------------- 1 | # Software License Agreement (BSD License) 2 | # 3 | # Copyright (c) 2013, Open Source Robotics Foundation, Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following 14 | # disclaimer in the documentation and/or other materials provided 15 | # with the distribution. 16 | # * Neither the name of Open Source Robotics Foundation, Inc. nor 17 | # the names of its contributors may be used to endorse or promote 18 | # products derived from this software without specific prior 19 | # written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | 34 | from __future__ import print_function 35 | 36 | import os 37 | 38 | from catkin.find_in_workspaces import find_in_workspaces 39 | 40 | 41 | def get_cmake_path(): 42 | relpath = os.path.join(os.path.dirname(__file__), '..', '..', 'cmake') 43 | if os.path.exists(relpath): 44 | return os.path.normpath(relpath) 45 | paths = find_in_workspaces(['share'], 'catkin', first_matching_workspace_only=True, first_match_only=True) 46 | if not paths: 47 | raise RuntimeError('Could not determine catkin cmake path') 48 | return os.path.join(paths[0], 'cmake') 49 | -------------------------------------------------------------------------------- /python/catkin/package_version.py: -------------------------------------------------------------------------------- 1 | # for backward compatibility 2 | from catkin_pkg.package_version import * # noqa 3 | -------------------------------------------------------------------------------- /python/catkin/terminal_color.py: -------------------------------------------------------------------------------- 1 | # for backward compatibility 2 | from catkin_pkg.terminal_color import * # noqa 3 | -------------------------------------------------------------------------------- /python/catkin/workspace_vcs.py: -------------------------------------------------------------------------------- 1 | # for backward compatibility 2 | from catkin_pkg.workspace_vcs import * # noqa 3 | -------------------------------------------------------------------------------- /rosdoc.yaml: -------------------------------------------------------------------------------- 1 | - builder: sphinx 2 | sphinx_root_dir: doc 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from catkin_pkg.python_setup import generate_distutils_setup 2 | 3 | from setuptools import setup 4 | 5 | d = generate_distutils_setup( 6 | packages=['catkin'], 7 | package_dir={'': 'python'}, 8 | scripts=[ 9 | 'bin/catkin_find', 10 | 'bin/catkin_init_workspace', 11 | 'bin/catkin_make', 12 | 'bin/catkin_make_isolated', 13 | 'bin/catkin_test_results', 14 | 'bin/catkin_topological_order', 15 | ], 16 | ) 17 | 18 | setup(**d) 19 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | debbuild 2 | pkgbuild 3 | tmp/* 4 | src/catkin_test/debian 5 | scratch 6 | SCRATCH 7 | PREFIX 8 | fullbuild 9 | -------------------------------------------------------------------------------- /test/README.rst: -------------------------------------------------------------------------------- 1 | Subfolders of catkin/test: 2 | ========================== 3 | 4 | To run tests, you need to set the python sources of catkin first in the pythonpath. In the catkin folder, run:: 5 | 6 | $ export PYTHONPATH=`pwd`/python:$PYTHONPATH 7 | 8 | 9 | Use python-nose to run tests, get it from apt-get. 10 | Run tests from the catkin folder using just:: 11 | 12 | $ nosetests 13 | $ nosetests test/path/to/python_file 14 | 15 | Is it also possible to run tests from the test folder. 16 | 17 | To run a single test function, run e.g.:: 18 | 19 | $ nosetests path/to/python_file.py:ClassName.testmethod 20 | 21 | 22 | src 23 | --- 24 | 25 | a test workspace with mock catkin stacks 26 | 27 | mock_resources 28 | -------------- 29 | 30 | mock catkin stacks to run tests against 31 | 32 | unit_tests 33 | ---------- 34 | 35 | tests testing (python) functions in isolation 36 | 37 | local_tests 38 | ----------- 39 | 40 | tests that run catkin cli but require no network connection (quick) 41 | 42 | network_tests 43 | ------------- 44 | 45 | tests that run catkin cli and checkout all core ros stacks, and require network connection (slow) 46 | 47 | tmp 48 | --- 49 | 50 | created by network tests, downloaded ros core packages to run make against. 51 | Placed here to avoid long test durations due to duplicate downloads. 52 | 53 | 54 | checks 55 | ------ 56 | scripts to run manually that ensure catkin is viable for ROS distros. 57 | Those scripts do many dangerous things, such as sudo rm -rf /opt/ros. 58 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) 5 | -------------------------------------------------------------------------------- /test/checks/README.rst: -------------------------------------------------------------------------------- 1 | This folder contains utiliy scripts and files used during the 2 | development of catkin in fuerte. They seem to be outdated and 3 | unmaintained. To be deleted once we are sure we don't care about them 4 | anymore. 5 | -------------------------------------------------------------------------------- /test/checks/catkin-test.sh: -------------------------------------------------------------------------------- 1 | TOP=$(cd `dirname $0` ; pwd) 2 | BUILD=$TOP/build 3 | SRC=$TOP/src 4 | 5 | cleanup () { 6 | 7 | echo "!!!!!!!!!!!!!!! DO NOT PROCEED UNLESS YOU KNOW WHAT YOU ARE DOING !!!!!!!!!" 8 | echo "This script completely removes /opt/ros/fuerte and reinstalls catkin stacks from source" 9 | echo -n "Please confirm (y or n) :" 10 | read CONFIRM 11 | case $CONFIRM in 12 | y|Y|YES|yes|Yes) ;; 13 | *) echo Aborting - you entered $CONFIRM 14 | exit 15 | ;; 16 | esac 17 | 18 | rm -rf $BUILD || /bin/true 19 | mkdir -p $BUILD 20 | 21 | sudo dpkg -r ros-fuerte\* || /bin/true 22 | sudo rm -rf /opt/ros/fuerte/* || /bin/true 23 | sudo mkdir -p /opt/ros/fuerte 24 | sudo chown -R `whoami` /opt/ros/fuerte 25 | 26 | rm $SRC/*.dsc || /bin/true 27 | rm $SRC/*.tar.gz || /bin/true 28 | rm $SRC/*.deb || /bin/true 29 | rm $SRC/*.changes || /bin/true 30 | } -------------------------------------------------------------------------------- /test/checks/fuerte/distro-to-install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import rospkg.distro 4 | import sys 5 | 6 | def go(argv): 7 | if len(argv) != 2: 8 | print('wrong number args') 9 | sys.exit(1) 10 | 11 | d=rospkg.distro.load_distro(argv[1]) 12 | ri=rospkg.distro.distro_to_rosinstall(d, 'release') 13 | print(ri) 14 | 15 | if __name__ == '__main__': 16 | go(sys.argv) 17 | -------------------------------------------------------------------------------- /test/checks/full.rosinstall: -------------------------------------------------------------------------------- 1 | - git: 2 | uri: 'git://github.com/ros/catkin.git' 3 | local-name: catkin 4 | version: master 5 | 6 | - git: 7 | uri: 'git://github.com/willowgarage/catkin-debs.git' 8 | local-name: catkin-debs 9 | version: master 10 | 11 | - git: 12 | uri: 'git://github.com/ros/genmsg.git' 13 | local-name: genmsg 14 | version: master 15 | 16 | - git: 17 | uri: 'git://github.com/ros/gencpp.git' 18 | local-name: gencpp 19 | version: master 20 | 21 | - git: 22 | uri: 'git://github.com/ros/genpy.git' 23 | local-name: genpy 24 | version: master 25 | 26 | - git: 27 | uri: 'git://github.com/ros/langs.git' 28 | local-name: langs 29 | version: master 30 | 31 | - git: 32 | uri: 'git://github.com/ros/langs-dev.git' 33 | local-name: langs-dev 34 | version: master 35 | 36 | - git: 37 | uri: 'git://github.com/ros/genpybindings.git' 38 | local-name: genpybindings 39 | version: master 40 | 41 | - git: 42 | uri: 'git://github.com/ros/gentypelibxml.git' 43 | local-name: gentypelibxml 44 | version: master 45 | 46 | - git: 47 | uri: 'git://github.com/ros/std_msgs.git' 48 | local-name: std_msgs 49 | version: master 50 | 51 | - git: 52 | uri: 'git://github.com/ros/roscpp_core.git' 53 | local-name: roscpp_core 54 | version: master 55 | 56 | - svn: 57 | uri: 'https://code.ros.org/svn/ros/stacks/ros_comm/trunk/' 58 | local-name: ros_comm 59 | 60 | - svn: 61 | uri: 'https://code.ros.org/svn/ros/stacks/ros_tutorials/trunk/' 62 | local-name: ros_tutorials 63 | 64 | - svn: 65 | uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' 66 | local-name: ros 67 | 68 | - svn: 69 | uri: 'https://code.ros.org/svn/ros-pkg/stacks/common_msgs/trunk' 70 | local-name: common_msgs 71 | 72 | - hg: 73 | local-name: rospkg 74 | uri: https://kforge.ros.org/rosrelease/rospkg 75 | 76 | - hg: 77 | local-name: rospack 78 | uri: https://kforge.ros.org/rosrelease/rospack 79 | 80 | - svn: 81 | local-name: rx 82 | uri: https://code.ros.org/svn/ros/stacks/rx/trunk 83 | 84 | - hg: 85 | local-name: actionlib 86 | uri: https://kforge.ros.org/common/actionlib 87 | -------------------------------------------------------------------------------- /test/checks/incremental_by_stack_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -ex 2 | 3 | # Helper script to use an existing catkin workspace and call 4 | # cmake, make install, for each package inside 5 | 6 | TOP=$(cd `dirname $0` ; pwd) 7 | 8 | [ $# -eq 2 ] || { /bin/echo "usage: $0 [srcdir] [scratchdir]" ; exit 1 ; } 9 | 10 | SRC=$1 11 | cd $SRC 12 | SRC=$(/bin/pwd) 13 | cd .. 14 | 15 | SCRATCHDIR=$2 16 | mkdir -p $SCRATCHDIR || /bin/true 17 | cd $SCRATCHDIR 18 | SCRATCHDIR=$(/bin/pwd) #abspath 19 | cd .. 20 | 21 | BUILD=$SCRATCHDIR/build 22 | mkdir -p $BUILD 23 | 24 | INSTALL=$SCRATCHDIR/install 25 | mkdir -p $INSTALL 26 | 27 | #EAR: CMAKE_PREFIX_PATH appears to be ignored if passed as a cmake variable... 28 | export CMAKE_PREFIX_PATH=$INSTALL 29 | CMAKE="cmake -DCMAKE_PREFIX_PATH=$INSTALL -DCMAKE_INSTALL_PREFIX=$INSTALL" 30 | 31 | # calls cmake, make, make install on one package 32 | doone () { 33 | pkg=$1 34 | mkdir -p $BUILD/$pkg 35 | cd $BUILD/$pkg 36 | $CMAKE $SRC/$proj 37 | make -j8 38 | make install 39 | cd .. 40 | } 41 | 42 | for proj in catkin rospkg rospack ros genmsg gencpp genpy genpybindings gentypelibxml roscpp_core std_msgs common_msgs ros_comm ros_tutorials 43 | do 44 | /bin/echo "\n\n\n======================= $proj =======================" 45 | doone $proj 46 | done 47 | 48 | -------------------------------------------------------------------------------- /test/checks/make_enmasse_dscs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -ex 2 | 3 | # this script deletes all of /opt/ros/fuerte and then runs cmake + gendebian 4 | 5 | TOP=$(cd `dirname $0` ; pwd) 6 | . $TOP/catkin-test.sh 7 | 8 | CMAKE="cmake -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte -DCMAKE_PREFIX_PATH=/opt/ros/fuerte -DCATKIN=YES -DCATKIN_DEB_SNAPSHOTS=YES -DCATKIN_PACKAGE_PREFIX=ros-fuerte-" 9 | DESTDIR=$TOP/DESTDIR 10 | CATKIN_DEB_SNAPSHOT_VERSION=$(date +%Y%m%d-%H%M%z) 11 | export CATKIN_DEB_SNAPSHOT_VERSION 12 | 13 | cleanup 14 | 15 | cd $BUILD 16 | $CMAKE '-DCATKIN_DPKG_BUILDPACKAGE_FLAGS=-d;-S;-kBE0A7693' $SRC 17 | for distro in lucid maverick natty oneiric precise 18 | do 19 | make VERBOSE=1 \ 20 | CATKIN_DEB_SNAPSHOT_VERSION=$CATKIN_DEB_SNAPSHOT_VERSION \ 21 | CATKIN_DEBIAN_DISTRIBUTION=$distro \ 22 | gendebian 23 | done 24 | 25 | -------------------------------------------------------------------------------- /test/checks/make_quick.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -ex 2 | 3 | # helper script that make installs ros fuerte core stacks 4 | # using cmake and make to /opt/ros/fuerte 5 | 6 | echo "!!!!!!!!!!!!!!! DO NOT PROCEED UNLESS YOU KNOW WHAT YOU ARE DOING !!!!!!!!!" 7 | echo "This script completely removes /opt/ros/fuerte and reinstalls catkin stacks from source" 8 | echo -n "Please confirm (y or n) :" 9 | read CONFIRM 10 | case $CONFIRM in 11 | y|Y|YES|yes|Yes) ;; 12 | *) echo Aborting - you entered $CONFIRM 13 | exit 14 | ;; 15 | esac 16 | 17 | TOP=$(cd `dirname $0` ; pwd) 18 | BUILD=$TOP/pkgbuild 19 | PREFIX=$1 20 | 21 | CMAKE="cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCATKIN=YES -DCATKIN_LOG=2" 22 | DESTDIR=$TOP/DESTDIR 23 | 24 | sudo dpkg -r ros-fuerte\* || /bin/true 25 | sudo rm -rf /opt/ros/fuerte/* || /bin/true 26 | sudo mkdir -p /opt/ros/fuerte 27 | sudo chown -R `whoami` /opt/ros/fuerte 28 | 29 | rm -rf $BUILD 30 | mkdir -p $BUILD 31 | cd $BUILD 32 | 33 | SRC=$TOP/src 34 | 35 | rm $SRC/*.tar.gz $SRC/*.deb $SRC/*.changes $SRC/*.dsc || /bin/true 36 | 37 | doone () { 38 | pkg=$1 39 | mkdir $BUILD/$pkg 40 | pushd $BUILD/$pkg 41 | SRC=../../src/$pkg 42 | $CMAKE $SRC 43 | make VERBOSE=1 44 | make VERBOSE=1 install 45 | for distro in lucid maverick natty oneiric 46 | do 47 | make CATKIN_DEBIAN_DISTRIBUTION=$distro $pkg-gendebian 48 | done 49 | popd 50 | } 51 | 52 | fatbuild () 53 | { 54 | mkdir $BUILD/buildall 55 | pushd $BUILD/buildall 56 | cmake ../../src -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte 57 | make 58 | make install 59 | popd 60 | } 61 | 62 | fatbuild 63 | 64 | doone catkin 65 | doone genmsg 66 | doone gencpp 67 | doone genpy 68 | doone genpybindings 69 | doone gentypelibxml 70 | 71 | doone std_msgs 72 | doone common_msgs 73 | doone rospack 74 | doone ros 75 | 76 | doone roscpp_core 77 | doone nolangs 78 | doone catkin_test 79 | doone ros_comm 80 | doone ros_tutorials 81 | 82 | -------------------------------------------------------------------------------- /test/checks/release_repos.yaml: -------------------------------------------------------------------------------- 1 | - git: 2 | uri: 'git@github.com:wg-debs/genmsg-release.git' 3 | local-name: genmsg 4 | version: master 5 | 6 | - git: 7 | uri: 'git@github.com:wg-debs/gencpp-release.git' 8 | local-name: gencpp 9 | version: master 10 | 11 | - git: 12 | uri: 'git@github.com:wg-debs/genpy-release.git' 13 | local-name: genpy 14 | version: master 15 | - git: 16 | uri: 'git@github.com:wg-debs/ros-release.git' 17 | local-name: ros 18 | version: master 19 | - git: 20 | uri: 'git@github.com:wg-debs/std_msgs-release.git' 21 | local-name: std_msgs 22 | version: master 23 | 24 | - git: 25 | uri: 'git@github.com:wg-debs/roscpp_core-release.git' 26 | local-name: roscpp_core 27 | version: master 28 | - git: 29 | uri: 'git@github.com:wg-debs/catkin-release.git' 30 | local-name: catkin 31 | version: master 32 | - git: 33 | uri: 'git@github.com:wg-debs/common_msgs-release.git' 34 | local-name: common_msgs 35 | version: master 36 | 37 | - git: 38 | uri: 'git@github.com:wg-debs/rospack-release.git' 39 | local-name: rospack 40 | version: master 41 | 42 | - git: 43 | uri: 'git@github.com:wg-debs/ros_comm-release.git' 44 | local-name: ros_comm 45 | version: master 46 | 47 | - git: 48 | uri: 'git@github.com:wg-debs/langs-release.git' 49 | local-name: langs 50 | version: master 51 | -------------------------------------------------------------------------------- /test/checks/test-nocatkin.rosinstall: -------------------------------------------------------------------------------- 1 | # - git: 2 | # uri: 'git://github.com/willowgarage/catkin-debs.git' 3 | # local-name: catkin_debs 4 | # version: master 5 | 6 | - git: 7 | uri: 'git://github.com/ros/genmsg.git' 8 | local-name: genmsg 9 | version: master 10 | 11 | - git: 12 | uri: 'git://github.com/ros/gencpp.git' 13 | local-name: gencpp 14 | version: master 15 | 16 | - git: 17 | uri: 'git://github.com/ros/genlisp.git' 18 | local-name: genlisp 19 | version: master 20 | 21 | - git: 22 | uri: 'git://github.com/ros/genpy.git' 23 | local-name: genpy 24 | version: master 25 | 26 | - git: 27 | uri: 'git://github.com/ros/langs.git' 28 | local-name: langs 29 | version: master 30 | 31 | - git: 32 | uri: 'git://github.com/ros/langs-dev.git' 33 | local-name: langs-dev 34 | version: master 35 | 36 | - git: 37 | uri: 'git://github.com/ros/std_msgs.git' 38 | local-name: std_msgs 39 | version: master 40 | 41 | - git: 42 | uri: 'git://github.com/ros/roscpp_core.git' 43 | local-name: roscpp_core 44 | version: master 45 | 46 | - svn: 47 | uri: 'https://code.ros.org/svn/ros/stacks/ros_comm/trunk/' 48 | local-name: ros_comm 49 | 50 | - svn: 51 | uri: 'https://code.ros.org/svn/ros/stacks/ros_tutorials/trunk/' 52 | local-name: ros_tutorials 53 | 54 | - svn: 55 | uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' 56 | local-name: ros 57 | 58 | - svn: 59 | uri: 'https://code.ros.org/svn/ros-pkg/stacks/common_msgs/trunk' 60 | local-name: common_msgs 61 | 62 | - hg: 63 | local-name: rospkg 64 | uri: https://kforge.ros.org/rosrelease/rospkg 65 | 66 | - hg: 67 | local-name: rospack 68 | uri: https://kforge.ros.org/rosrelease/rospack 69 | 70 | - svn: 71 | local-name: rx 72 | uri: https://code.ros.org/svn/ros/stacks/rx/trunk 73 | 74 | - hg: 75 | local-name: actionlib 76 | uri: https://kforge.ros.org/common/actionlib 77 | -------------------------------------------------------------------------------- /test/checks/unstable/desktop-overlay.rosinstall: -------------------------------------------------------------------------------- 1 | [{'svn': {'local-name': 'common_tutorials', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/common_tutorials/tags/common_tutorials-0.2.2'}}, {'hg': {'local-name': 'geometry_tutorials', 'version': 'geometry_tutorials-0.1.3', 'uri': 'https://kforge.ros.org/geometry/tutorials'}}, {'svn': {'local-name': 'visualization_tutorials', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/visualization_tutorials/tags/visualization_tutorials-0.2.3'}}, {'hg': {'local-name': 'robot_model_tutorials', 'version': 'robot_model_tutorials-0.1.2', 'uri': 'https://kforge.ros.org/robotmodel/tutorials'}}] 2 | 3 | -------------------------------------------------------------------------------- /test/checks/unstable/extras.rosinstall: -------------------------------------------------------------------------------- 1 | - svn: 2 | local-name: visualization 3 | uri: https://code.ros.org/svn/ros-pkg/stacks/visualization/tags/visualization-1.7.4 4 | 5 | - svn: 6 | local-name: rx 7 | uri: https://code.ros.org/svn/ros/stacks/rx/tags/rx-1.6.2 8 | 9 | - svn: 10 | local-name: visualization_common 11 | uri: https://code.ros.org/svn/ros-pkg/stacks/visualization_common/tags/visualization_common-1.7.0 12 | 13 | - svn: 14 | local-name: laser_pipeline 15 | uri: https://code.ros.org/svn/ros-pkg/stacks/laser_pipeline/tags/laser_pipeline-1.4.3 16 | 17 | - hg: 18 | local-name: pluginlib 19 | uri: https://kforge.ros.org/common/pluginlib 20 | version: pluginlib-1.7.0 21 | 22 | - hg: 23 | local-name: geometry 24 | uri: https://kforge.ros.org/geometry/geometry 25 | version: geometry-1.7.1 26 | 27 | - hg: 28 | local-name: bullet 29 | uri: https://kforge.ros.org/geometry/bullet 30 | version: bullet-2.79 31 | 32 | - git: 33 | local-name: orocos_kinematics_dynamics 34 | uri: http://git.mech.kuleuven.be/robotics/orocos_kinematics_dynamics.git 35 | version: orocos_kinematics_dynamics-0.2.3 36 | 37 | - hg: 38 | local-name: common_rosdeps 39 | uri: https://kforge.ros.org/common/rosdepcore 40 | version: common_rosdeps-1.0.2 41 | - hg: 42 | local-name: filters 43 | uri: https://kforge.ros.org/common/filters 44 | version: filters-1.6.0 45 | 46 | - hg: 47 | local-name: robot_model 48 | uri: https://kforge.ros.org/robotmodel/robot_model 49 | version: robot_model-1.7.1 50 | 51 | - svn: 52 | local-name: image_common 53 | uri: https://code.ros.org/svn/ros-pkg/stacks/image_common/tags/image_common-1.7.0 54 | 55 | - hg: 56 | local-name: common 57 | uri: https://kforge.ros.org/common/common 58 | version: common-1.8.0 59 | 60 | - hg: 61 | local-name: nodelet_core 62 | uri: https://kforge.ros.org/common/nodeletcore 63 | version: nodelet_core-1.5.0 64 | 65 | - hg: 66 | local-name: bond_core 67 | uri: https://kforge.ros.org/common/bondcore 68 | version: bond_core-1.6.3 69 | 70 | - svn: 71 | local-name: perception_pcl 72 | uri: http://svn.pointclouds.org/ros/tags/perception_pcl_unstable-1.1.2 73 | 74 | - svn: 75 | local-name: driver_common 76 | uri: https://code.ros.org/svn/ros-pkg/stacks/driver_common/tags/driver_common-1.2.3 77 | 78 | - svn: 79 | local-name: diagnostics 80 | uri: https://code.ros.org/svn/ros-pkg/stacks/diagnostics/tags/diagnostics-1.6.1 81 | 82 | - hg: 83 | local-name: eigen 84 | uri: https://kforge.ros.org/geometry/eigen 85 | version: eigen-1.6.0 86 | -------------------------------------------------------------------------------- /test/local_tests/__init.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/test/local_tests/__init.py -------------------------------------------------------------------------------- /test/mock_resources/src-fail/.gitignore: -------------------------------------------------------------------------------- 1 | badly_specified_changelog/debian/control -------------------------------------------------------------------------------- /test/mock_resources/src-fail/badly_specified_changelog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | 3 | project(badly_specified_changelog) 4 | find_package(catkin) 5 | 6 | catkin_package() 7 | -------------------------------------------------------------------------------- /test/mock_resources/src-fail/badly_specified_changelog/package.xml: -------------------------------------------------------------------------------- 1 | 2 | badly_specified_changelog 3 | 0.0.0 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | Someone 9 | 10 | 11 | catkin 12 | 13 | -------------------------------------------------------------------------------- /test/mock_resources/src-fail/noproject/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | # commented to cause failure 3 | # project(noproject) 4 | find_package(catkin) 5 | 6 | catkin_package() 7 | 8 | -------------------------------------------------------------------------------- /test/mock_resources/src-fail/noproject/package.xml: -------------------------------------------------------------------------------- 1 | 2 | noproject 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | -------------------------------------------------------------------------------- /test/mock_resources/src/.gitignore: -------------------------------------------------------------------------------- 1 | actionlib 2 | catkin 3 | catkin-debs 4 | CMakeLists.txt 5 | common_msgs 6 | gencpp 7 | genlisp 8 | genmsg 9 | genpy 10 | genpybindings 11 | gentypelibxml 12 | langs 13 | langs-dev 14 | nolangs/debian 15 | ros 16 | ros_comm 17 | roscpp_core 18 | rosdep_rules 19 | rospack 20 | rospkg 21 | ros_tutorials 22 | rx 23 | setup.bash 24 | setup.sh 25 | setup.zsh 26 | std_msgs 27 | .rosinstall.bak 28 | *.changes 29 | *.deb 30 | *.dsc 31 | *.tar.gz 32 | 33 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/.gitignore: -------------------------------------------------------------------------------- 1 | ._* 2 | *.pyc 3 | 4 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(catkin_test) 3 | find_package(catkin REQUIRED) 4 | 5 | find_package(genmsg REQUIRED) 6 | find_package(std_msgs REQUIRED) 7 | 8 | foreach(subdir 9 | quux_msgs 10 | quux_user 11 | a 12 | b 13 | c 14 | d 15 | ) 16 | add_subdirectory(${subdir}) 17 | endforeach() 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/test/mock_resources/src/catkin_test/README -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(a) 3 | find_package(catkin REQUIRED COMPONENTS genmsg std_msgs) 4 | 5 | add_message_files( 6 | DIRECTORY msg 7 | FILES AMsg.msg 8 | ) 9 | 10 | generate_messages(DEPENDENCIES std_msgs) 11 | 12 | catkin_package( 13 | INCLUDE_DIRS include 14 | LIBRARIES a 15 | ) 16 | 17 | add_library(a SHARED lib.cpp) 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/include/a/foo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace a { 3 | void foo(); 4 | } 5 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace a { 4 | void foo() { 5 | std::cout << __PRETTY_FUNCTION__ << "\n"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/msg/AMsg.msg: -------------------------------------------------------------------------------- 1 | std_msgs/Float64 f64 2 | std_msgs/Bool b 3 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/package.xml: -------------------------------------------------------------------------------- 1 | 2 | a 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/a/src/a/__init__.py: -------------------------------------------------------------------------------- 1 | import std_msgs.msg 2 | 3 | s = std_msgs.msg.String() 4 | 5 | print('<<< a >>>') 6 | print(type(s)) 7 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(b) 3 | find_package(catkin REQUIRED) 4 | catkin_package( 5 | INCLUDE_DIRS include 6 | LIBRARIES b 7 | ) 8 | 9 | find_package(a) 10 | include_directories(${a_INCLUDE_DIRS}) 11 | 12 | add_library(b SHARED lib.cpp) 13 | target_link_libraries(b ${a_LIBRARIES}) 14 | 15 | add_message_files( 16 | DIRECTORY msg 17 | FILES BMsg.msg 18 | ) 19 | 20 | # catkin_python_setup() 21 | # enable_python(b) 22 | 23 | # generate_messages(DEPENDENCIES std_msgs) 24 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/include/b/foo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace b { 3 | void foo(); 4 | } 5 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace b { 6 | void foo() { 7 | a::foo(); 8 | std::cout << __PRETTY_FUNCTION__ << "\n"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/msg/BMsg.msg: -------------------------------------------------------------------------------- 1 | std_msgs/String string1 2 | std_msgs/String string2 3 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/package.xml: -------------------------------------------------------------------------------- 1 | 2 | b 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/b/src/b/__init__.py: -------------------------------------------------------------------------------- 1 | import a.msg 2 | 3 | import b.msg 4 | 5 | import std_msgs.msg 6 | 7 | s = std_msgs.msg.String() 8 | a = a.msg.AMsg() 9 | b = b.msg.BMsg() 10 | 11 | print('<<< b >>>') 12 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(c) 3 | find_package(catkin REQUIRED) 4 | 5 | catkin_package( 6 | INCLUDE_DIRS include 7 | LIBRARIES c-one c-two 8 | ) 9 | 10 | find_package(a) 11 | include_directories(${a_INCLUDE_DIRS}) 12 | 13 | add_library(c-one SHARED lib.cpp) 14 | add_library(c-two SHARED lib.cpp) 15 | target_link_libraries(c-one ${a_LIBRARIES}) 16 | target_link_libraries(c-two ${a_LIBRARIES}) 17 | 18 | add_message_files( 19 | DIRECTORY msg 20 | FILES CMsg.msg 21 | ) 22 | 23 | # catkin_python_setup() 24 | # enable_python(c) 25 | 26 | # generate_messages(DEPENDENCIES std_msgs a) 27 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/include/c/foo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace c { 3 | void foo(); 4 | } 5 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | namespace c { 5 | void foo() { 6 | a::foo(); 7 | std::cout << __PRETTY_FUNCTION__ << "\n"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/msg/CMsg.msg: -------------------------------------------------------------------------------- 1 | std_msgs/String s 2 | a/AMsg amsg 3 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/package.xml: -------------------------------------------------------------------------------- 1 | 2 | c 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/c/src/c/__init__.py: -------------------------------------------------------------------------------- 1 | print('IMPORTING') 2 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/catkin_test/package.xml: -------------------------------------------------------------------------------- 1 | 2 | catkin_test 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | catkin 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/changelog.em: -------------------------------------------------------------------------------- 1 | @(CATKIN_PACKAGE_PREFIX)catkin-test (@(Version)@(SnapshotVersion)~@(Distribution)) @(Distribution); urgency=high 2 | 3 | * These are custom rules generated via empy and python 4 | 5 | -- @(Maintainer) @(Date) 6 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(d) 3 | find_package(catkin REQUIRED) 4 | 5 | catkin_package( 6 | INCLUDE_DIRS include 7 | LIBRARIES d 8 | ) 9 | 10 | find_package(c) 11 | find_package(b) 12 | find_package(a) 13 | include_directories(${b_INCLUDE_DIRS}) 14 | 15 | include_directories(${c_INCLUDE_DIRS}) 16 | 17 | add_library(d SHARED lib.cpp) 18 | target_link_libraries(d ${b_LIBRARIES} ${c_LIBRARIES}) 19 | 20 | add_message_files( 21 | DIRECTORY msg 22 | FILES DMsg.msg 23 | ) 24 | 25 | # catkin_python_setup() 26 | # enable_python(d) 27 | 28 | # generate_messages(DEPENDENCIES std_msgs b c a) 29 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/include/d/foo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace d { 3 | void foo(); 4 | } 5 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | namespace d { 7 | void foo() { 8 | b::foo(); 9 | c::foo(); 10 | std::cout << __PRETTY_FUNCTION__ << "\n"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/msg/DMsg.msg: -------------------------------------------------------------------------------- 1 | std_msgs/String s 2 | b/BMsg bmsg 3 | c/CMsg cmsg 4 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/package.xml: -------------------------------------------------------------------------------- 1 | 2 | d 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/d/src/d/__init__.py: -------------------------------------------------------------------------------- 1 | print('IMPORTING') 2 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_msgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(quux_msgs) 3 | find_package(catkin REQUIRED) 4 | find_package(genmsg REQUIRED) 5 | find_package(std_msgs REQUIRED) 6 | 7 | add_message_files( 8 | DIRECTORY msg 9 | FILES QuuxString.msg 10 | ) 11 | 12 | generate_messages(DEPENDENCIES std_msgs) 13 | 14 | catkin_package() 15 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_msgs/msg/QuuxString.msg: -------------------------------------------------------------------------------- 1 | std_msgs/String string1 2 | std_msgs/String string2 3 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_msgs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | quux_msgs 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_user/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(quux_user) 3 | find_package(catkin REQUIRED) 4 | 5 | catkin_package() 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 7 | 8 | find_package(quux_msgs) 9 | assert(quux_msgs_INCLUDE_DIRS) 10 | 11 | include_directories(${quux_msgs_INCLUDE_DIRS}) 12 | 13 | find_package(rostime) 14 | include_directories(${rostime_INCLUDE_DIRS}) 15 | assert(rostime_INCLUDE_DIRS) 16 | assert(rostime_LIBRARIES) 17 | 18 | find_package(cpp_common) 19 | include_directories(${cpp_common_INCLUDE_DIRS}) 20 | 21 | find_package(roscpp_traits) 22 | include_directories(${roscpp_traits_INCLUDE_DIRS}) 23 | 24 | find_package(roscpp_serialization) 25 | include_directories(${roscpp_serialization_INCLUDE_DIRS}) 26 | assert(roscpp_serialization_LIBRARIES) 27 | 28 | find_package(sensor_msgs) 29 | include_directories(${sensor_msgs_INCLUDE_DIRS}) 30 | 31 | include_directories(${std_msgs_INCLUDE_DIRS} ${quux_msgs_INCLUDE_DIRS}) 32 | 33 | add_executable(quux_user-exec src/main.cpp) 34 | add_dependencies(quux_user-exec ${sensor_msgs_EXPORTED_TARGETS}) 35 | 36 | message(STATUS ${roscpp_serialization_LIBRARIES}) 37 | 38 | target_link_libraries(quux_user-exec ${roscpp_serialization_LIBRARIES} ${rostime_LIBRARIES}) 39 | 40 | add_executable(quux_srv-exec src/srv_test.cpp) 41 | 42 | target_link_libraries(quux_srv-exec ${roscpp_serialization_LIBRARIES}) 43 | add_dependencies(quux_srv-exec ${sensor_msgs_EXPORTED_TARGETS}) 44 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_user/package.xml: -------------------------------------------------------------------------------- 1 | 2 | quux_user 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | std_msgs 16 | ros_comm 17 | 18 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_user/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | sensor_msgs::PointCloud2 pc_1; 6 | pc_1.width = 10; 7 | pc_1.height = 20; 8 | // todo set other stuff 9 | 10 | std::cout << "PointCloud2 message: " << std::endl << pc_1 << std::endl; 11 | 12 | uint8_t buf[1024]; 13 | ros::serialization::OStream out(buf, sizeof(buf) ); 14 | ros::serialization::serialize(out, pc_1); 15 | 16 | std::cout << "Message Was Serialized" << std::endl; 17 | 18 | sensor_msgs::PointCloud2 pc_2; 19 | ros::serialization::IStream in(buf, sizeof(buf) ); 20 | ros::serialization::deserialize(in, pc_2); 21 | 22 | std::cout << "Its a message again: " << std::endl << pc_2 << std::endl; 23 | } 24 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/quux_user/src/srv_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | sensor_msgs::SetCameraInfo srv; 6 | srv.response.status_message = std::string("Some Text"); 7 | 8 | std::cout << "Srv Response Msg: " << std::endl << srv.response << std::endl; 9 | 10 | uint8_t buf[1024]; 11 | ros::serialization::OStream out(buf, sizeof(buf) ); 12 | ros::serialization::serialize(out, srv.response); 13 | 14 | std::cout << "Its Serialized" << std::endl; 15 | 16 | sensor_msgs::SetCameraInfo::Response msg2; 17 | ros::serialization::IStream in(buf, sizeof(buf) ); 18 | ros::serialization::deserialize(in, msg2); 19 | 20 | std::cout << "Im a message again: " << std::endl << msg2 << std::endl; 21 | } 22 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/rules.em: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # THESE ARE CUSTOM RULES 4 | 5 | export DH_VERBOSE=1 6 | export DH_OPTIONS=-v 7 | 8 | %: 9 | dh $@@ 10 | 11 | override_dh_auto_configure: 12 | dh_auto_configure -Scmake -- \ 13 | -DCMAKE_INSTALL_PREFIX="@(CMAKE_INSTALL_PREFIX)" \ 14 | -DCMAKE_PREFIX_PATH="@(CMAKE_PREFIX_PATH)" \ 15 | -DCATKIN_PACKAGE_PREFIX="@(CATKIN_PACKAGE_PREFIX)" \ 16 | -DCATKIN=YES 17 | -------------------------------------------------------------------------------- /test/mock_resources/src/catkin_test/stack.yaml: -------------------------------------------------------------------------------- 1 | Package: catkin-test 2 | Version: 3.4.5 3 | Section: misc 4 | Priority: extra 5 | Architecture: all 6 | Depends: python-empy, cmake, make, 7 | catkin, genmsg, genpy, gencpp, std_msgs, roscpp_core, common_msgs 8 | Description: Willow Garage low level build system macros and infrastructure 9 | Author: Troy Straszheim , Morten Kjaergaard, Ken Conley 10 | Maintainer: Troy Straszheim 11 | Homepage: http://www.ros.org 12 | 13 | Catkin-ProjectName: catkin_test 14 | Catkin-CopyrightType: willowgarage 15 | Catkin-Depends: catkin, genmsg, common_msgs, roscpp_core 16 | 17 | Catkin-DebRulesType: +rules.em 18 | Catkin-ChangelogType: +changelog.em 19 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/leaf_pkg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(leaf_pkg) 3 | 4 | find_package(catkin REQUIRED COMPONENTS root_pkg) 5 | 6 | add_executable(leaf leaf.cpp) 7 | target_link_libraries(leaf ${catkin_LIBRARIES}) 8 | target_include_directories(leaf PUBLIC ${catkin_INCLUDE_DIRS}) 9 | 10 | catkin_package() 11 | 12 | list(LENGTH catkin_LIBRARIES size) 13 | math(EXPR size_is_not_3 "${size} - 3") 14 | if (size_is_not_3) 15 | message(FATAL_ERROR "Wrong size for catkin_LIBRARIES: ${catkin_LIBRARIES} : ${size}") 16 | else() 17 | message(STATUS "All is OK: ${catkin_LIBRARIES}") 18 | endif() 19 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/leaf_pkg/leaf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | std::cout << "leaf_pkg calling "; 7 | root_pkg::func(); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/leaf_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | leaf_pkg 3 | 3.4.5 4 | Checks library and linker options 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | root_pkg 13 | 14 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/root_pkg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(root_pkg) 3 | 4 | find_package(catkin REQUIRED) 5 | 6 | add_library(rootlib SHARED root.cpp) 7 | target_include_directories(rootlib PUBLIC include) 8 | 9 | catkin_package( 10 | INCLUDE_DIRS include 11 | LIBRARIES -pthread -lpthread rootlib 12 | ) 13 | 14 | install(TARGETS rootlib 15 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 16 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 17 | RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) 18 | 19 | install(DIRECTORY include/${PROJECT_NAME}/ 20 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) 21 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/root_pkg/include/root_pkg/root.hpp: -------------------------------------------------------------------------------- 1 | namespace root_pkg 2 | { 3 | void func(); 4 | } 5 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/root_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | root_pkg 3 | 3.4.5 4 | Exports library and linker options in ${root_pkg_LIBRARIES} 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | -------------------------------------------------------------------------------- /test/mock_resources/src/linker_options/src/root_pkg/root.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "root_pkg/root.hpp" 4 | 5 | namespace root_pkg 6 | { 7 | void func() 8 | { 9 | std::cout << "root_pkg::func()\n"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/mock_resources/src/nolangs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | 3 | project(nolangs) 4 | find_package(catkin REQUIRED) 5 | catkin_package() 6 | 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 8 | 9 | add_executable(nolangs_exec 10 | main.cpp) 11 | 12 | install(TARGETS nolangs_exec 13 | RUNTIME DESTINATION bin) 14 | -------------------------------------------------------------------------------- /test/mock_resources/src/nolangs/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int, char**) { 4 | std::cout << __PRETTY_FUNCTION__ << "\n"; 5 | } 6 | -------------------------------------------------------------------------------- /test/mock_resources/src/nolangs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | nolangs 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | 16 | -------------------------------------------------------------------------------- /test/mock_resources/src/python_test_a/msg/A.msg: -------------------------------------------------------------------------------- 1 | std_msgs/String data 2 | -------------------------------------------------------------------------------- /test/mock_resources/src/python_test_a/package.xml: -------------------------------------------------------------------------------- 1 | 2 | python_test_a 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | 16 | -------------------------------------------------------------------------------- /test/mock_resources/src/python_test_a/src/a_uses_std_msgs.py: -------------------------------------------------------------------------------- 1 | # add build/gen/py to pythonpath before running 2 | import std_msgs 3 | import std_msgs.msg 4 | 5 | some_string = std_msgs.msg.String 6 | some_string.data = 'Some Data in a std_msgs.msg.String' 7 | print(some_string.data) 8 | -------------------------------------------------------------------------------- /test/mock_resources/src/ros_user/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace rs = ros::serialization; 4 | 5 | int main() 6 | { 7 | sensor_msgs::PointCloud2 pc_1; 8 | pc_1.width = 10; 9 | pc_1.height = 20; 10 | // todo set other stuff 11 | 12 | std::cout << "PointCloud2 message: " << std::endl << pc_1 << std::endl; 13 | 14 | uint8_t buf[1024]; 15 | rs::OStream out(buf, sizeof(buf) ); 16 | rs::serialize(out, pc_1); 17 | 18 | std::cout << "Message Was Serialized" << std::endl; 19 | 20 | sensor_msgs::PointCloud2 pc_2; 21 | rs::IStream in(buf, sizeof(buf) ); 22 | rs::deserialize(in, pc_2); 23 | 24 | std::cout << "Its a message again: " << std::endl << pc_2 << std::endl; 25 | } 26 | -------------------------------------------------------------------------------- /test/mock_resources/src/ros_user/package.xml: -------------------------------------------------------------------------------- 1 | 2 | ros_user 3 | 3.4.5 4 | foo 5 | Somebody 6 | Somebody 7 | Unknown 8 | 9 | 10 | catkin 11 | 12 | gencpp 13 | genmsg 14 | genpy 15 | cpp_common 16 | rostime 17 | roscpp_traits 18 | roscpp_serialization 19 | sensor_msgs 20 | 21 | -------------------------------------------------------------------------------- /test/network_tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/test/network_tests/__init__.py -------------------------------------------------------------------------------- /test/network_tests/network_test_utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from test.utils import AbstractCatkinWorkspaceTest 4 | from test.utils import TEMP_DIR 5 | from test.utils import create_catkin_workspace 6 | from test.utils import rosinstall 7 | 8 | 9 | class AbstractUnstableTest(AbstractCatkinWorkspaceTest): 10 | """Parent class for any Test case that download latest ros core stacks from github to build custom stacks against that.""" 11 | 12 | def __init__(self, testCaseName, name): 13 | # for ROS core integration tests, we reuse the same sources 14 | # (to save download time), keep in test folder 15 | super(AbstractUnstableTest, self).__init__( 16 | testCaseName, os.path.join(TEMP_DIR, name)) 17 | 18 | def setupWorkspaceContents(self): 19 | rosinstall(self.workspacedir, 20 | os.path.join(os.path.dirname(__file__), 21 | 'test.rosinstall')) 22 | create_catkin_workspace(self.workspacedir) 23 | 24 | def tearDown(self): 25 | # override parent tearDown which would delete what we 26 | # rosinstalled 27 | pass 28 | 29 | def delete_build(self): 30 | """ 31 | Clean the build folder, run manually in subtests when appropriate. 32 | 33 | We don't to this in setup because it takes so long to build all of ros core' 34 | """ 35 | if os.path.isdir(self.builddir): 36 | shutil.rmtree(self.builddir) 37 | -------------------------------------------------------------------------------- /test/network_tests/test.rosinstall: -------------------------------------------------------------------------------- 1 | # Using catkin from source instead 2 | # - git: 3 | # uri: 'git://github.com/ros/catkin.git' 4 | # local-name: catkin 5 | # version: master 6 | 7 | - git: 8 | uri: 'git://github.com/ros/genmsg.git' 9 | local-name: genmsg 10 | version: master 11 | 12 | - git: 13 | uri: 'git://github.com/ros/gencpp.git' 14 | local-name: gencpp 15 | version: master 16 | 17 | - git: 18 | uri: 'git://github.com/ros/genlisp.git' 19 | local-name: genlisp 20 | version: master 21 | 22 | - git: 23 | uri: 'git://github.com/ros/genpy.git' 24 | local-name: genpy 25 | version: master 26 | 27 | - git: 28 | uri: 'git://github.com/ros/langs.git' 29 | local-name: langs 30 | version: master 31 | 32 | # - git: 33 | # uri: 'git://github.com/ros/langs-dev.git' 34 | # local-name: langs-dev 35 | # version: master 36 | 37 | - git: 38 | uri: 'git://github.com/ros/message_generation.git' 39 | local-name: message_generation 40 | version: master 41 | 42 | - git: 43 | uri: 'git://github.com/ros/message_runtime.git' 44 | local-name: message_runtime 45 | version: master 46 | 47 | - git: 48 | uri: 'git://github.com/ros/std_msgs.git' 49 | local-name: std_msgs 50 | version: master 51 | 52 | - git: 53 | uri: 'git://github.com/ros/roscpp_core.git' 54 | local-name: roscpp_core 55 | version: master 56 | 57 | # - git: 58 | # uri: 'git://github.com/ros/ros_comm.git' 59 | # local-name: ros_comm 60 | 61 | # - git: 62 | # uri: 'git://github.com/ros/ros_tutorials.git' 63 | # local-name: ros_tutorials 64 | 65 | - svn: 66 | uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' 67 | local-name: ros 68 | 69 | - git: 70 | uri: 'git://github.com/ros/common_msgs.git' 71 | local-name: common_msgs 72 | 73 | - git: 74 | uri: 'git://github.com/ros/rospack.git' 75 | local-name: rospack 76 | 77 | # - hg: 78 | # local-name: actionlib 79 | # uri: https://kforge.ros.org/common/actionlib 80 | -------------------------------------------------------------------------------- /test/unit_tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/catkin/af1cdf271b11b8d55cf66b2ea91a8a30614ddaef/test/unit_tests/__init__.py -------------------------------------------------------------------------------- /test/unit_tests/test_catkin_find.py: -------------------------------------------------------------------------------- 1 | import imp 2 | import os 3 | import unittest 4 | 5 | imp.load_source('catkin_find', 6 | os.path.join(os.path.dirname(__file__), 7 | '..', '..', 'bin', 'catkin_find')) 8 | 9 | from catkin_find import parse_args # noqa: E402 10 | 11 | 12 | class CatkinFindTest(unittest.TestCase): 13 | 14 | def test_parse_args_empty(self): 15 | args = parse_args([]) 16 | self.assertEqual(False, args.first_only) 17 | self.assertIsNone(args.path) 18 | self.assertIsNone(args.project) 19 | self.assertIsNone(args.install_folders) 20 | 21 | def test_parse_args_folders(self): 22 | args = parse_args(['--etc', '--lib', '--bin']) 23 | self.assertEqual(False, args.first_only) 24 | self.assertIsNone(args.path) 25 | self.assertIsNone(args.project) 26 | self.assertEqual(['etc', 'lib', 'bin'], args.install_folders) 27 | args = parse_args(['--etc', '--bin', '--lib']) 28 | self.assertEqual(['etc', 'bin', 'lib'], args.install_folders) 29 | 30 | def test_parse_args_first(self): 31 | args = parse_args(['--first-only']) 32 | self.assertEqual(True, args.first_only) 33 | self.assertIsNone(args.path) 34 | self.assertIsNone(args.project) 35 | self.assertIsNone(args.install_folders) 36 | -------------------------------------------------------------------------------- /test/unit_tests/test_download_md5.py: -------------------------------------------------------------------------------- 1 | import imp 2 | import os 3 | import shutil 4 | import tempfile 5 | import unittest 6 | 7 | imp.load_source('download_checkmd5', 8 | os.path.join(os.path.dirname(__file__), 9 | '..', '..', 'cmake', 'test', 'download_checkmd5.py')) 10 | 11 | from download_checkmd5 import checkmd5 # noqa: E402 12 | from download_checkmd5 import download_md5 # noqa: E402 13 | from download_checkmd5 import main # noqa: E402 14 | 15 | 16 | class DowloadCheckMd5Test(unittest.TestCase): 17 | 18 | def test_download(self): 19 | try: 20 | rootdir = tempfile.mkdtemp() 21 | src_file = os.path.join(rootdir, 'testfile') 22 | check_file = os.path.join(rootdir, 'checkfile') 23 | with open(src_file, 'w') as fhand: 24 | fhand.write('foo') 25 | download_md5('file://%s' % src_file, check_file) 26 | self.assertTrue(os.path.isfile(check_file)) 27 | finally: 28 | shutil.rmtree(rootdir) 29 | 30 | def test_checkmd5(self): 31 | try: 32 | rootdir = tempfile.mkdtemp() 33 | src_file = os.path.join(rootdir, 'testfile') 34 | realmd5 = 'acbd18db4cc2f85cedef654fccc4a4d8' 35 | with open(src_file, 'w') as fhand: 36 | fhand.write('foo') 37 | result, hexdig = checkmd5(src_file, 'hello') 38 | self.assertFalse(result) 39 | self.assertEqual(realmd5, hexdig) 40 | result, hexdig = checkmd5(src_file, realmd5) 41 | self.assertTrue(result) 42 | self.assertEqual(realmd5, hexdig) 43 | finally: 44 | shutil.rmtree(rootdir) 45 | 46 | def test_main(self): 47 | try: 48 | rootdir = tempfile.mkdtemp() 49 | src_file = os.path.join(rootdir, 'testfile') 50 | check_file = os.path.join(rootdir, 'checkfile') 51 | realmd5 = 'acbd18db4cc2f85cedef654fccc4a4d8' 52 | with open(src_file, 'w') as fhand: 53 | fhand.write('foo') 54 | main([os.path.join('file://localhost', src_file), check_file]) 55 | self.assertTrue(os.path.isfile(check_file)) 56 | os.remove(check_file) 57 | self.assertFalse(os.path.isfile(check_file)) 58 | self.assertNotEqual(main([os.path.join('file://localhost', src_file), check_file, 'hello']), 0) 59 | main([os.path.join('file://localhost', src_file), check_file, realmd5]) 60 | 61 | finally: 62 | shutil.rmtree(rootdir) 63 | -------------------------------------------------------------------------------- /test/unit_tests/test_order_packages_cmake_em.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import unittest 4 | 5 | import em 6 | 7 | 8 | class OrderPackagesEmTest(unittest.TestCase): 9 | 10 | def test_env_cached_static(self): 11 | # hack to fix empy nosetests clash 12 | sys.stdout = em.ProxyFile(sys.stdout) 13 | template_file = os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'em', 'order_packages.cmake.em') 14 | with open(template_file, 'r') as fhand: 15 | template = fhand.read() 16 | gdict = {'CATKIN_DEVEL_PREFIX': '/foo', 17 | 'CMAKE_PREFIX_PATH': ['/bar'], 18 | 'CATKIN_GLOBAL_LIB_DESTINATION': '/glob-dest/lib', 19 | 'CATKIN_GLOBAL_BIN_DESTINATION': '/glob-dest/bin', 20 | 'PYTHON_INSTALL_DIR': '/foo/dist-packages'} 21 | result = em.expand(template, gdict, 22 | source_root_dir='/tmp/nowhere_dir', 23 | whitelisted_packages=[], 24 | blacklisted_packages=[], 25 | underlay_workspaces=[]) 26 | self.assertTrue('set(CATKIN_ORDERED_PACKAGES "")' in result, result) 27 | self.assertTrue('set(CATKIN_ORDERED_PACKAGE_PATHS "")' in result, result) 28 | self.assertTrue('set(CATKIN_ORDERED_PACKAGES_IS_META "")' in result, result) 29 | self.assertTrue('set(CATKIN_ORDERED_PACKAGES_BUILD_TYPE "")' in result, result) 30 | self.assertTrue('set(CATKIN_MESSAGE_GENERATORS' in result, result) 31 | self.assertEqual(10, len(result.splitlines())) 32 | -------------------------------------------------------------------------------- /test/unit_tests/test_order_paths.py: -------------------------------------------------------------------------------- 1 | import imp 2 | import os 3 | import unittest 4 | 5 | imp.load_source('order_paths', 6 | os.path.join(os.path.dirname(__file__), 7 | '..', '..', 'cmake', 'order_paths.py')) 8 | 9 | from order_paths import order_paths # noqa: E402 10 | 11 | 12 | class OrderPathsTest(unittest.TestCase): 13 | 14 | def test_order_paths(self): 15 | self.assertEqual([], order_paths([], [])) 16 | self.assertEqual(['foo/1', 'foo/2', 'bar/1', 'bar/2', 'foo3'], 17 | order_paths(['foo3', 'bar/1', 'foo/1', 'foo/2', 'bar/2'], ['foo', 'bar'])) 18 | self.assertEqual(['foo/1', 'foo/2'], 19 | order_paths(['foo/1', 'foo/2'], [])) 20 | self.assertEqual(['foo/1', 'foo/2'], 21 | order_paths(['foo/1', 'foo/2'], [''])) 22 | -------------------------------------------------------------------------------- /test/unit_tests/test_run_tests.py: -------------------------------------------------------------------------------- 1 | import imp 2 | import os 3 | import shutil 4 | import tempfile 5 | import unittest 6 | 7 | imp.load_source('run_tests', 8 | os.path.join(os.path.dirname(__file__), 9 | '..', '..', 'cmake', 'test', 'run_tests.py')) 10 | 11 | from run_tests import main # noqa: E402 12 | 13 | 14 | class RunTestsTest(unittest.TestCase): 15 | 16 | def test_main(self): 17 | try: 18 | rootdir = tempfile.mkdtemp() 19 | results_file = os.path.join(rootdir, 'foo', 'testfile.xml') 20 | placeholder = os.path.join(rootdir, 'foo', 'MISSING-testfile.xml') 21 | # check_file = os.path.join(rootdir, 'checkfile') 22 | # with open(src_file, 'w') as fhand: 23 | # fhand.write('foo') 24 | # self.assertTrue(os.path.isfile(check_file)) 25 | main([results_file, 26 | 'true', 27 | '--working-dir', rootdir]) 28 | self.assertFalse(os.path.exists(results_file)) 29 | self.assertTrue(os.path.exists(placeholder)) 30 | with open(placeholder, 'r') as fhand: 31 | contents = fhand.read() 32 | self.assertTrue(results_file in contents) 33 | os.remove(placeholder) 34 | 35 | main([results_file, 36 | "echo '' > %s" % results_file, 37 | '--working-dir', rootdir]) 38 | self.assertTrue(os.path.exists(results_file)) 39 | self.assertFalse(os.path.exists(placeholder)) 40 | os.remove(results_file) 41 | # no working dir given 42 | main([results_file, 43 | "echo '' > %s" % results_file]) 44 | self.assertTrue(os.path.exists(results_file)) 45 | self.assertFalse(os.path.exists(placeholder)) 46 | os.remove(results_file) 47 | # make sure resultsfile is deleted 48 | main([results_file, 49 | 'true', 50 | '--working-dir', rootdir]) 51 | self.assertFalse(os.path.exists(results_file)) 52 | self.assertTrue(os.path.exists(placeholder)) 53 | with open(placeholder, 'r') as fhand: 54 | contents = fhand.read() 55 | self.assertTrue(results_file in contents) 56 | finally: 57 | shutil.rmtree(rootdir) 58 | -------------------------------------------------------------------------------- /test/unit_tests/test_tidy_xml.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import tempfile 4 | import unittest 5 | 6 | try: 7 | from catkin.tidy_xml import tidy_xml, _SAFE_XML_REGEX 8 | except ImportError as impe: 9 | raise ImportError( 10 | 'Please adjust your pythonpath before running this test: %s' % str(impe)) 11 | 12 | try: 13 | char = unichr 14 | except NameError: 15 | char = chr 16 | 17 | 18 | class TidyXmlTest(unittest.TestCase): 19 | 20 | def test_safe_xml_regex(self): 21 | for data in [char(0), char(14)]: 22 | self.assertIsNotNone(_SAFE_XML_REGEX.match(data)) 23 | 24 | def test_tiny_xml(self): 25 | try: 26 | rootdir = tempfile.mkdtemp() 27 | not_exist_file = os.path.join(rootdir, 'not_exist') 28 | self.assertRaises(ValueError, tidy_xml, not_exist_file) 29 | 30 | utf8_file = os.path.join(rootdir, 'utf8.xml') 31 | with open(utf8_file, 'ab') as fhand: 32 | fhand.write(char(0).encode('utf8)')) 33 | tidy_xml(utf8_file) 34 | with open(utf8_file, 'r') as fhand: 35 | contents = fhand.read() 36 | self.assertEqual('?', contents) 37 | 38 | iso_file = os.path.join(rootdir, 'iso.xml') 39 | with open(iso_file, 'ab') as fhand: 40 | fhand.write(char(0).encode('ascii')) 41 | tidy_xml(iso_file) 42 | with open(iso_file, 'r') as fhand: 43 | contents = fhand.read() 44 | self.assertEqual('?', contents) 45 | finally: 46 | shutil.rmtree(rootdir) 47 | -------------------------------------------------------------------------------- /test/unit_tests/test_workspace.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import tempfile 4 | import unittest 5 | 6 | try: 7 | from catkin.workspace import get_workspaces, get_source_paths 8 | 9 | from catkin.workspace import CATKIN_MARKER_FILE 10 | import catkin.workspace 11 | except ImportError as impe: 12 | raise ImportError( 13 | 'Please adjust your pythonpath before running this test: %s' % str(impe)) 14 | 15 | 16 | class WorkspaceTest(unittest.TestCase): 17 | 18 | def test_get_workspaces(self): 19 | old_environ = os.environ 20 | try: 21 | root_dir = tempfile.mkdtemp() 22 | ws1 = os.path.join(root_dir, 'ws1') 23 | ws2 = os.path.join(root_dir, 'ws2') 24 | os.makedirs(ws1) 25 | os.makedirs(ws2) 26 | with open(os.path.join(ws1, CATKIN_MARKER_FILE), 'w') as fhand: 27 | fhand.write('loc1;loc2') 28 | with open(os.path.join(ws2, CATKIN_MARKER_FILE), 'w') as fhand: 29 | fhand.write('loc3;loc4') 30 | catkin.workspace.os.environ = {} 31 | self.assertEqual([], get_workspaces()) 32 | catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ''} 33 | self.assertEqual([], get_workspaces()) 34 | catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ws1} 35 | self.assertEqual([ws1], get_workspaces()) 36 | catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': 'nowhere'} 37 | self.assertEqual([], get_workspaces()) 38 | catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ws2 + os.pathsep + ws1} 39 | self.assertEqual([ws2, ws1], get_workspaces()) 40 | finally: 41 | shutil.rmtree(root_dir) 42 | os.environ = old_environ 43 | catkin.workspace.os.environ = os.environ 44 | 45 | def test_get_source_paths(self): 46 | try: 47 | root_dir = tempfile.mkdtemp() 48 | ws1 = os.path.join(root_dir, 'ws1') 49 | ws2 = os.path.join(root_dir, 'ws2') 50 | os.makedirs(ws1) 51 | os.makedirs(ws2) 52 | with open(os.path.join(ws1, CATKIN_MARKER_FILE), 'w') as fhand: 53 | fhand.write('loc1;loc2') 54 | with open(os.path.join(ws2, CATKIN_MARKER_FILE), 'w') as fhand: 55 | fhand.write('') 56 | self.assertEqual(['loc1', 'loc2'], get_source_paths(ws1)) 57 | self.assertEqual([], get_source_paths(ws2)) 58 | self.assertRaises(ValueError, get_source_paths, root_dir) 59 | finally: 60 | shutil.rmtree(root_dir) 61 | --------------------------------------------------------------------------------