pax_global_header00006660000000000000000000000064136126472740014526gustar00rootroot0000000000000052 comment=dfc93c72d9799f57442d08c2f6e9fd494bba95c1 catkin-0.8.0/000077500000000000000000000000001361264727400130045ustar00rootroot00000000000000catkin-0.8.0/.gitignore000066400000000000000000000001761361264727400150000ustar00rootroot00000000000000build ._* .\#* \#*\# doc/build *.pyc .rosinstall .project .pydevproject *~ *.orig *~ bin/.tmp .tmp bin/catkin_make_isolatedc catkin-0.8.0/.travis.yml000066400000000000000000000004401361264727400151130ustar00rootroot00000000000000language: python python: - "2.7" - "3.5" virtualenv: system_site_packages: true # command to install dependencies install: - pip install argparse catkin-pkg empy mock nose # command to run tests script: - nosetests test/unit_tests test/local_tests notifications: email: false catkin-0.8.0/CHANGELOG.rst000066400000000000000000001256031361264727400150340ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package catkin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0.8.0 (2020-01-24) ------------------ * install devel space wrapper for Python scripts (`#1044 `_) * various code cleanup (`#1055 `_) * make catkin_install_python code a little clearer (`#1054 `_) 0.7.21 (2020-01-23) ------------------- * bump CMake minimum version in tests and docs (`#1053 `_) * bump CMake minimum version to use new behavior of CMP0048 (`#1052 `_) * Prefer setuptools with Python 3 (`#1048 `_) * Support use of gmake on FreeBSD (`#1051 `_) * Fix if statement in catkin_libraries (`#1050 `_) * Update gtest config documentation (`#1046 `_) * Contributors: Dirk Thomas, Matt Reynolds, Shane Loretz, dodsonmg, poggenhans 0.7.20 (2019-12-10) ------------------- * fix checking dependency conditions (`#1041 `_) * fix gtest-not-found bug, regression from 0.7.19 (`#1040 `_) * support build_type tag with condition attribute (`#1038 `_) * use ${prefix} variable in generated pkg-config (`#1037 `_) * check for INTERFACE library type in add_library function (`#1034 `_) 0.7.19 (2019-10-08) ------------------- * support for pytest 5.1+ jUnit result files (`#1033 `_) * fix -pthread handling in Debian buster (`#1021 `_) * gmock from source on Debian buster (`#1022 `_) * [windows] update a typo in local_setup.bat.in (`#1029 `_) * fix test when using different Python version (`#1028 `_) * add a blacklist option to make_isolated (`#1027 `_) * use condition attributes to specify Python 2 and 3 dependencies (`#1025 `_) * change relay script to use current Python executable (`#1024 `_) * remove executable bit and shebang line (`#1023 `_) * correctly set gtest 1.8 root directory (`#1014 `_) * fix interface targets that do not have libraries (`#1013 `_) * fix catkin_make on Windows (`#1020 `_) * prefix install target with project name (`#1019 `_) * [Windows][kinetic-devel] fix build issues with specific build type (`#1015 `_) * fix Python 3 version used by travis (`#1016 `_) 0.7.18 (2019-06-07) ------------------- * add catkin_make(_isolated) default parameters for Windows developers (`#1011 `_) * fix order of bin/lib in PATH on Windows (`#1010 `_) * clarify consequences of running setup.py manually (`#1009 `_) * update docs for dynamic reconfigure (`#1001 `_) 0.7.17 (2019-03-18) ------------------- * fix setup.sh/env.sh filename, regression from 0.7.15 (`#1000 `_) 0.7.16 (2019-03-12) ------------------- * protection against double -l in pkg-config files (`#998 `_) * add error message to the setup.sh if devel space relocation is attempted (`#997 `_) 0.7.15 (2019-03-04) ------------------- * add local_setup files (`#993 `_) * update docs to suggest 'test' path instead of 'tests'. (`#990 `_) * generate CTest and dart config to avoid warnings (`#987 `_) * fix PYTHONPATH missing in cached environment (`#986 `_) * add double quotes around cmake_command to handle spaces (`#976 `_) * strip "-l" from "-lpthread" library, to fix a build failure on ros-ros-comm (`#975 `_) * correct Python executable in CMake files (`#977 `_) * need to sanitize paths before cprint (`#969 `_) * add friendly error message for `ros/catkin#961 `_ (`#964 `_) * document how to install python subpackages (`#962 `_) * add existing catkin logo to README (`#959 `_) * fix warnings in docs * install environment hooks into a package-specific directory (`#953 `_) * fix race condition with catkin_tools in parallel builds (`#955 `_) * use CATKIN_GLOBAL_ETC_DESTINATION instead of etc (`#954 `_) * remove CMAKE_MODULE_PATH from list of "forbidden" variables (`#951 `_) * Windows related: * add win_ros script wrappers to make Python scripts executable (`#978 `_) * fix python_distutils_install.bat.in (`#992 `_) * add script.bat.in template for general use (`#981 `_) * normalize paths in CMAKE_PREFIX_PATH for proper comparison (`#979 `_) * update windows.cmake to fix common build issues on Windows (`#984 `_) * update builder.py to add Windows support (`#982 `_) * ensure desired Python path is added into PATH in setup.bat (`#983 `_) * check both IMPORTED_IMPLIB\_ and IMPORTED_LOCATION\_ in catkin_libraries.cmake (`#980 `_) * enable catkin build use_nmake on Windows (`#949 `_) 0.7.14 (2018-06-06) ------------------- * terminal_color is now in catkin_pkg, regression from 0.7.13 (`#943 `_) * fix permission of CMake file (`#942 `_) 0.7.13 (2018-05-31) ------------------- * add separate option CATKIN_INSTALL_INTO_PREFIX_ROOT (`#940 `_) * find the Python version specified in ROS_PYTHON_VERSION (`#939 `_) * move catkin_prepare_release script as well as dependencies to catkin_pkg (`#941 `_) 0.7.12 (2018-05-01) ------------------- * add CMake option for symlink install (`#929 `_) * use verbatim on test target to fix testing with Ninja (`#935 `_) * do not add_library() gmock and gtest if targets already exist (`#927 `_) * modernize Python 2 code to get ready for Python 3 (`#928 `_) * remove Python 3.3 specific code because it is end of life (`#924 `_) * fix an error in the comment. (`#930 `_) * fix typos (`#934 `_) 0.7.11 (2018-02-02) ------------------- * catkin_add_gtest: drop explicit add_dependencies(), rely on CMake. (`#917 `_) * prevent reading non-whitelisted properties of interface targets (`#916 `_) * fix logic when only gtest is present (`#919 `_) * add option to pass specific version to catkin_prepare_release (`#918 `_) 0.7.10 (2018-01-24) ------------------- * support for googletest 1.8 and deduplicated code (`#914 `_) 0.7.9 (2018-01-22) ------------------ * add support for GMock (`#897 `_) * provide default values to unbound variables in setup.sh.in (`#907 `_) * cleanup environment changes reliably (`#906 `_) * call the find PythonInterp with version in the arguments (`#898 `_) * fix python3 support for builder.py (`#903 `_) * fix Unicode write error (`#902 `_) 0.7.8 (2017-10-27) ------------------ * handle EOF on raw_input (`#888 `_) * dynamically check gtest library type (`#885 `_) * remove executable flag since file is not a script (`#882 `_) 0.7.7 (2017-07-27) ------------------ * fix warning in case devel space is nested in the build space (`#880 `_) * remove workaround using -l: necessary for older pkg-config versions (`#879 `_) * replace exec call with runpy.run_path (`#873 `_) * use environment variable to extend environment in plain shell (`#862 `_) * prefer reporting problems to bugtracker / website before maintainer (`#861 `_) 0.7.6 (2017-02-17) ------------------ * skip gtest install rules for newer gtest versions (`#857 `_) 0.7.5 (2017-02-14) ------------------ * update --pkg help for catkin_make_isolated (`#853 `_) * add skipped / disabled tests to catkin_test_results summary (`#848 `_) * use functions instead of macros where possible to avoid leaking variables (`#835 `_) * write output of parsing package xml as UTF-8 for Python 3 (`#828 `_) * update documentation 0.7.4 (2016-09-25) ------------------ * fix regression in logic to select make / ninja for CMake packages from 0.7.2 (`#826 `_) 0.7.3 (2016-09-19) ------------------ * relax fixed DEPENDS check from last release (`#825 `_) 0.7.2 (2016-09-02) ------------------ * change warning to status when nosetests was not found (`#823 `_) * maintain file context when invoking Python scripts through relay (`#820 `_) * fix rollback logic for more than one value per environment variable and workspace (`#819 `_) * add option to use NMake instead of Make (`#816 `_) * fix check if DEPENDS was found (`#813 `_) * fix quoting of paths to handle spaces (`#808 `_) * update doc of catkin_package to clarify importance of case for variable names * improve doc about catkin_package(CFG_EXTRAS) (`#805 `_) * doc: fix format 2 howto to suggest to declare a build export dependency on "message_runtime" 0.7.1 (2016-03-18) ------------------ * expose format 2 style dependencies as CMake variables (`#787 `_) 0.7.0 (2016-03-04) ------------------ * remove CPATH from setup files (`#783 `_) * use NO_MODULE to find exported catkin dependencies (`#760 `_) 0.6.17 (2016-03-03) ------------------- * fix docs: nosetest target names use periods (`#781 `_) * add custom message explaining CMake find_package error messages (`#780 `_) * fix regression with DESTDIR introduced in 0.6.16 (`#755 `_) * avoid adding nonexistent paths to environment variables (`#777 `_) * ensure that Python install destination exists (`#775 `_, https://github.com/ros/catkin/issues/776) * set commonly predefines attributes when interrogating setup.py files (`#770 `_) * align Python script directory recommendations with REP-0008 (`#769 `_) * fix default value for _workspaces in find_in_workspaces (`#768 `_) * improve robustness of exec call interogating setup.py files (`#766 `) * fix reinstalling Python files installed by catkin_install_python after modifying them (`#764 `_) * fix project specific clean_test_results targets (`#762 `_) * update generated CMake API 0.6.16 (2015-11-09) ------------------- * remove -x in Python distutils shell script (`#755 `_) 0.6.15 (2015-09-19) ------------------- * adding check to prevent tool cross talk (`#743 `_) * only clean the test result ending with .xml of the current project (`#737 `_) * fix regression in find_in_workspaces (`#739 `_) * fix setup.py package_dir location logic (`#751 `_) 0.6.14 (2015-04-20) ------------------- * support zsh with NOCLOBBER enabled (`#734 `_) 0.6.13 (2015-04-17) ------------------- * allow setting CATKIN_GLOBAL_LIBEXEC_DESTINATION to libexec (`#713 `_) 0.6.12 (2015-04-16) ------------------- * remove CATKIN_TEST_RESULTS_DIR environment variable (`#728 `_) * catkin_test_results will output skipped xml files only when --all is being passed (`#733 `_) * extract catkin_add_executable_with_gtest() from catkin_add_gtest() (`#726 `_) * separate download function from tests (`#633 `_) * only install environment hooks for catkin_make(_isolated) completion in the catkin package (`#732 `_) * avoid warning with CMake 3.1 and newer (`#731 `_) * quote command in "Reproduce this error" instructions (`#730 `_) * fix Python error when working with non-ascii characters in catkin workspace path (`#724 `_) * use $TMPDIR for temporary _setup_util.py file if set (`#710 `_) * fix regex for library config types (`#723 `_) * fix potential race condition in download_checkmd5.py (`#715 `_) * output package whitelist / blacklist if set (`#714 `_) * add --verbose option to catkin_test_results to show the content of result files (`#705 `_) * source in reset zsh emulation mode (`#686 `_) * improve help text for --only-pkg-with-deps (`#706 `_) 0.6.11 (2014-12-29) ------------------- * fix return code for tests run by ctest (`#703 `_) 0.6.10 (2014-12-22) ------------------- * check changes to -D args CATKIN_DEVEL_PREFIX / CMAKE_INSTALL_PREFIX when considering to reinvoke cmake (`#700 `_) * add --use-ninja option to catkin_make(_isolated) to use ninja instead of make (`#693 `_) * remove 'emulate sh' from setup.zsh (`#686 `_) * set terminal title only when isatty (`#687 `_) * add description to catkin_make for ignoring packages * add suggestion to use catkin_make_isolated for non-homogeneous workspaces * refactor code from run_tests.py into Python module (`#678 `_) 0.6.9 (2014-07-11) ------------------ * fix regression from 0.6.8 (`#676 `_) 0.6.8 (2014-07-10) ------------------ * make nosetests --xunit-file argument an absolute path to work around nose bug 779 (`#659 `_) * fix handling of CMake packages which do not install any files (`#665 `_) * fix gtest on Arch Linux and others (`#663 `_) * improve generation of .catkin marker file (`#671 `_, `#676 `_) * escape messages to avoid CMake warning (`#667 `_) * fix CMake warning for doxygen target with CMake 3 (`#660 `_) * avoid using ARGN for efficiency (`#669 `_) 0.6.7 (2014-06-16) ------------------ * reset CATKIN_SHELL in devel space generated env.sh files (`#652 `_, `#655 `_) * ignore cd path echo when using CDPATH (`#654 `_) * use PYTHON_EXECUTABLE for _setup_util.py (`#646 `_) * expose PYTHON_EXECUTABLE to environment hook .em templates (`#645 `_) * catkin_prepare_release: * add --no-push to catkin_prepare_release (`#657 `_) * flush stdin before asking for input (`#658 `_) 0.6.6 (2014-06-02) ------------------ * fix rollback of environment when workspace has been deleted (`#641 `_) * fix argument handling when cm / cmi is invoked in a symlinked folder (`#638 `_) 0.6.5 (2014-05-25) ------------------ * fix regression in catkin_make_isolated from 0.6.4 (`#624 `_) * fix problem when catkin_make / catkin_make_isolated is invoked in a symlinked folder (`#638 `_) 0.6.4 (2014-05-07) ------------------ * add architecture independent flag in package.xml (`#625 `_) * add error message for circular dependencies in catkin_make_isolated and catkin_topological_order (`#607 `_, `#608 `_) * add multiarch support for catkin environment files (`#545 `_) * add workspace marker file for catkin_make / catkin_make_isolated (`#304 `_) * allow better performance for repeated invocations of find_in_workspaces() * consider test_depends for topolocial order (`#612 `_) * invoke empy with specific Python interpreter (`#620 `_) * support setting ${PROJECT_NAME}_LIBRARIES before invoking catkin_package() (`#609 `_) * update package manifest to format 2 (`#619 `_) * fixes: * fix catkin_find to not return path with '/.' suffix (`#621 `_) * fix python path setting for plain cmake workspaces (`#618 `_) * improve unicode handling (`#615 `_) * replace CMake usage of IMPORTED_IMPLIB with IMPORTED_LOCATION (`#616 `_) * do not call chpwd hooks in setup.zsh (`#613 `_) * set catkin_* variables only when find_package(catkin COMPONENTS ...) (`#629 `_) 0.6.3 (2014-03-04) ------------------ * allow passing absolute INCLUDE_DIRS via catkin_package() into CMake config file in install space (`#600 `_, `#601 `_) * improve error messages for wrong include dirs 0.6.2 (2014-02-24) ------------------ * use underlay workspaces when calculating topological order (`#590 `_) * remove restriction to run unit test single threaded (`#597 `_) * support using nosetests with Python3 (`#593 `_) * remove invalid symbolic links of workspace level CMakeLists.txt file (`#591 `_) * remove debug_message usage from generated pkgConfig.cmake files (`#583 `_) * use catkin_install_python() to install Python scripts (`#596 `_) * fix unicode error with japanese LANG (`#578 `_) * fix gtest include dir when using gtest inside the workspace (`#585 `_) 0.6.1 (2014-01-29) ------------------ * remove more obsolete files (`#582 `_) 0.6.0 (2014-01-29) ------------------ * remove deprecated functionality (`#582 `_) * remove eigen CMake config files (`#492 `_) * fix EXPORTED_TARGETS argument for catkin_package() (`#581 `_) 0.5.80 (2014-01-27) ------------------- * fix library deduplication (`#565 `_) 0.5.79 (2014-01-09) ------------------- * fix handling of not found imported libraries (`#565 `_) 0.5.78 (2014-01-07) ------------------- * add support for py_modules in setup.py (`#399 `_) * fix order and deduplication of of catkin_LIBRARIES (`#558 `_) * update handling of library deduplication to support build configuration keywords in the whole process (`#565 `_) * Python 3 related: * python 3 compatibility (`#544 `_) * add option to specify Python version (`#570 `_) * add catkin_install_python function (`#573 `_) * catkin_make and catkin_make_isolated: * add --only-pkg-with-deps option * fix completion for -DCMAKE_BUILD_TYPE and -DCATKIN_ENABLE_TESTING * catkin_make_isolated: * add empty line between packages for better readability * update command line doc (`#534 `_) * fix generated setup.sh for plain cmake package when path contains spaces * fix to actually build run_depends before the things that depend on them * fix check if environment exists with DESTDIR * update setup scripts to use builtin cd command (`#542 `_) * improve docs on system library dependencies (`#552 `_) * install scripts under bin via setup.py (`#555 `_) * update download script to resume downloads when server supports it (`#559 `_) * add error handling when _setup_util.py fails, e.g. due to disk full (`#561 `_) * add atomic_configure_file to work support parallel builds better (`#566 `_) * update catkin_test_results usage message to mention return code (`#576 `_) * prefix invocation of python script with PYTHON_EXECUTABLE (`ros/genpy#23 `_) * update toplevel.cmake to use catkin_find_pkg instead of trying a fixed location to find catkin in the workspace * modify gtest message level to only warn if gtest is not available but a package trys to register a gtest * update run_tests to work robustly in parallel * use sys.exit and not just exit * catkin_prepare_release: undo quoting of commit messages 0.5.77 (2013-10-09) ------------------- * catkin_prepare_release: show tag name explicitly when using tag prefix (`#528 `_) * catkin_make_isolated: * separate devel and install build folders for plain cmake packages cleanly without polluting namespace (`#532 `_) * fix build folder naming (regression from 0.5.75) * fix setup generation if last package in workspace is plain cmake (`#530 `_) * fix creating missing folder 0.5.76 (2013-10-06) ------------------- * fix regression in catkin_make from 0.5.75 0.5.75 (2013-10-04) ------------------- * add --all option to catkin_test_results * improve svn support in catkin_prepare_release * keep build folder of plain CMake packages completely isolated between devel and install (`#374 `_) * fix handling of spaces in path (`#519 `_) * fix generated setup.bash|zsh for isolated devel space (`#520 `_) * fix env.sh for plain cmake packages to not define _CATKIN_SETUP_DIR (`#521 `_) * fix crash when DESTDIR is specified but install not asked for (`#526 `_) * update doc for downloading test data from download.ros.org * update environment hook doc (`#516 `_) 0.5.74 (2013-09-18) ------------------- * support multiple package names for catkin_make --pkg (`#504 `_) * improve help message on catkin_make_isolated --from-pkg * fix include path in generated .pc files to be absolute (`#506 `_, regression of 0.5.72) * fix handling DESTDIR in catkin_make_isolated for plain cmake packages (`#499 `_) * fix catkin_python_setup to consider actual package names inside setup.py when signaling that an __init__.py file is installed to genmsg/dynamic_reconfigure (`ros/genmsg#34 `_) * fix unsetting temporary variables - especially CATKIN_SETUP_DIR - to not influence next environment (`#505 `_) 0.5.73 (2013-08-23) ------------------- * fix include dirs in generated CMake config file when a non-catkin package depends on a catkin package (regression of `#490 `_) 0.5.72 (2013-08-21) ------------------- * make catkin packages relocatable (`#490 `_) * catkin_prepare_release: * add tagging changelog sections (`#489 `_) * add warning when trying to release non-catkin packages (`#478 `_) * add --tag-prefix option (`#447 `_) * catkin_make_isolated: * support installation with DESTDIR (`#490 `_) * handle missing install target gracefully * fix message with command to reproduce (`#496 `_) * fix completion for catkin_make(_isolated) for older bash completion (`#485 `_) * fix Python3.2 compatibility (`#487 `_) * update documentation (`#438 `_, `#467 `_, `#495 `_, `#497 `_) 0.5.71 (2013-07-20) ------------------- * catkin_make_isolated: show progress in terminal title bar on Linux and Darwin (`#482 `_) * catkin_prepare_release: add warning if package names contain upper case characters (`#473 `_) * catkin_make: fix handling of non-ascii characters (`#476 `_) * fix dry tests by disabling CTest for dry packages (`#483 `_) * update documentation (`#474 `_) 0.5.70 (2013-07-14) ------------------- * add warning if versioned dependencies are not fulfilled (`#472 `_) * catkin_prepare_release: * add checks for local changes in the working copy (`#471 `_) * remove '--push' option in favor of interactive questions * improve error message when branch is not tracked (`#463 `_) * colorize output for improved readability * catkin_make_isolated: * suppress traceback when a package fails to build (`#470 `_) * improve output to include 'cd' command to reproduce a failing command more easily * fix initialization issue with CATKIN_ENABLE_TESTING variable (`#464 `_) * find nosetest under different name on QNX (`#461 `_) * update documentation (`#438 `_, `#465 `_, `#468 `_) 0.5.69 (2013-07-05) ------------------- * disable CTest on the farm since it breaks the binarydeb build with the current Debian rules files (`#460 `_) * skip generating CATKIN_IGNORE marker file when build space equals source space (`#459 `_) * fix warning message if gtest is not found (`#458 `_) 0.5.68 (2013-07-03) ------------------- * add option CATKIN_ENABLE_TESTING to configure without tests * add CTest support for all registered test types: gtest, nosetest, rostest * add the --from-pkg option to catkin_make_isolated * catkin_prepare_release: * fix if git repo has multiple remotes (`#450 `_) * modify to not change the remote repo by default, add option --push for old behavior (`#451 `_) * add 'prefix' to generated pkg-config files (`#444 `_) * add dummy target to catkin_EXPORTED_TARGETS if empty (`#453 `_) * expose SETUPTOOLS_DEB_LAYOUT as option again (`#418 `_) * suppress stacktrace when topologic_order raises within generating CMake files (`#442 `_) * fixes: * update check in generated pkgConfig.cmake files to work independent of cmake policy CMD0012 (`#452 `_) * fix generating pkg-config files with empty -I directives (`#445 `_) * update documentation, especially about testing * for a complete list of changes see the `commit log for 0.5.68 `_ 0.5.67 (2013-06-18) ------------------- * fix --build and --directory auto completion for catkin_make(_isolated) (`#325 `_) * fix catkin_make(_isolated) auto completion on older versions of bash on OS X (`#325 `_) * add how-to documentation * for a complete list of changes see the `commit log for 0.5.67 `_ 0.5.66 (2013-06-06) ------------------- * add new CMake function catkin_download_test_data, mark download_test_data as deprecated (`#426 `_, `#431 `_) * catkin_make and catkin_make_isolated: * add bash autocompletion (`#325 `_) * allow passing MAKEFLAGS (`#402 `_) * catkin_make_isolated: * allow building empty workspace (`#423 `_, `#425 `_) * add --catkin-make-args which enables calling 'catkin_make_isolated run_tests' (`#414 `_) * catkin_prepare_release: * execute the commands rather than printing them (`#417 `_) * warn about missing changelog files * validate metapackages (`#404 `_) * auto detect former SETUPTOOLS_DEB_LAYOUT (`#418 `_) * fixes: * fix error using sys.stdout.encoding without checking existance * remove linker flag -lrt for Android (`#430 `_) * fix resetting IFS shell variable when it was unset before (`#427 `_) * ensure to only return unique source paths from a workspace marker file (`#424 `_) * catkin_make_isolated: * fix chaining of plain cmake packages (`#422 `_) * fix --install error for non-catkin packages (`#411 `_) * only try to remove Makefile if it exists (`#420 `_, regression from 0.5.64) * fix detection of python paths for plain cmake packages * update documentation: * update API doc of several CMake functions and macros * add generated CMake API to appear in the wiki (`#384 `_) * add and install LICENSE file (`#398 `_) * for a complete list of changes see the `commit log for 0.5.66 `_ 0.5.65 (2013-03-21) ------------------- * remove including workspace.cmake if it exists, use -C and/or -DCMAKE_USER_MAKE_RULES_OVERRIDE instead (`#377 `_) * change catkin_test_results return code based on failing tests (`#392 `_) * apply CATKIN_BUILD_BINARY_PACKAGE for catkin (`#395 `_) * modify extra file handling to make the generated code relocatable (`#369 `_) * various improvements and fixes for Windows (`#388 `_, `#390 `_, `#391 `_, `#393 `_, `ros-infrastructure/catkin_pkg#35 `_) * fixes: * fix --force-cmake for catkin_make_isolation (regression from 0.5.64) * fix catkin_package_version and catkin_prepare_release when no packages are found (`#387 `_) * fix catkin_prepare_release bumping wrong part of the version (`#386 `_) * handle dependencies that are imported libraries (`#378 `_) * for a complete list of changes see the `commit log for 0.5.65 `_ 0.5.64 (2013-03-08) ------------------- * disable env.sh without args (`#370 `_) * add --bump to catkin_prepare_release * add EXPORTED_TARGETS to catkin_package() for cross-package target dependencies (`#368 `_) * enable cfg extras with absolute path and devel/install space specific * enable additional cfg extra files via project specific global variable * allow overriding CATKIN_TEST_RESULTS_DIR via cmake argument (`#365 `_) * add options to skip generation of cmake config and pkg-config files (`#360 `_) * catkin_make and catkin_make_isolated: * add --(c)make-args options to pass arbitrary arguments (`#376 `_) * catkin_make: * enable to build individual package (`#348 `_) * enable to build metapackages without CMakeLists.txt (`#349 `_) * add colorization of several error messages * catkin_make_isolated: * requires metapackages to have a CMakeLists.txt (`#349 `_) * force cmake for plain cmake packages when --install is toggled (`#374 `_) * switched default output from quiet to verbose (`#331 `_) * print full stacktrace to better diagnose internal problems (`#373 `_) * various improvements and fixes for Windows (`#276 `_, `#351 `_, `#358 `_, `#359 `_) * fixes: * catkin_make and catkin_make_isolated: * ignore install space and any subspaces when searching packages (`#361 `_) * catkin_make_isolated: * ensure that install space exists before trying to create a env.sh file for cmake projects (`#340 `_) * fix generated env.sh file if first package is plain cmake (`#340 `_) * remove old Makefile when cmake fails * fix sourcing some environment hooks multiple times * fix handling spaces in folder names (`ros/catkin#375 `_) * fix usage of ROS_PARALLEL_JOBS (`#335 `_) * prefix all temp variable in setup.sh (i.e. to not collide in zsh) (`#338 `_) * setup.sh: check that temp file was created successfully, call rm command instead of potential alias (`#343 `_) * update documentation: * update doc on CFG_EXTRAS (`#353 `_) * general catkin docs (`#357 `_) * for a complete list of changes see the `commit log for 0.5.64 `_ 0.5.63 (2013-01-24) ------------------- * add sanity check to catkin_make that no CMakeLists.txt exists in the base path (`#328 `_) * catkin_make and catkin_make_isolated: * add -lN besides -jN (`#326 `_) * support inverted color scheme (`#323 `_) * catkin_make_isolated: * allow building individual packages (`#322 `_) * add support for -D options (`#306 `_) * generate setup.sh file (`#327 `_) * print instructions how to reproduce errors in case a command returns non-zero return code * fixes: * readd old _setup_util.py to not break environment of workspaces built with 0.5.58 or older (`#329 `_) * fix sourcing environment hooks * improve several error messages in case of problems (`#318 `_, `#320 `_) * for a complete list of changes see the `commit log for 0.5.63 `_ 0.5.62 (2013-01-17) ------------------- * fixes: * add check to catkin_make to force cmake when cmake-specific arguments change * force cmake on workspace changes in catkin_make_isolated (`#315 `_) * source environment hooks for all workspace in correct order (`#316 `_) * fix PYTHON_PACKAGES_DIR and SETUPTOOLS_ARG_EXTRA to be up-to-date when passing -DSETUPTOOLS_DEB_LAYOUT=.. (`#314 `_) * for a complete list of changes see the `commit log for 0.5.62 `_ 0.5.61 (2013-01-16) ------------------- * yet another workaround for pkg-config handling static libraries (`#300 `_) * for a complete list of changes see the `commit log for 0.5.61 `_ 0.5.60 (2013-01-15) ------------------- * work around for pkg-config reordering libs with no -l prefix (`#300 `_) * fix colorizing of unicode text in catkin_make and catkin_make_isolated (`#310 `_) * for a complete list of changes see the `commit log for 0.5.60 `_ 0.5.59 (2013-01-13) ------------------- * improve performance to source setup.sh for nested workspaces (`#289 `_) * remove obsolete BUILD variables and find_package(ROS) * improve error message when command execution or colorization fails (`#298 `_) * catkin_make keeps track of previously build packages and forces cmake on changes (`#290 `_) * fix pkg-config for absolute libraries (`#300 `_) * fix catkin_toplogical_order (`#299 `_) * make plain cmake install to devel when --install not present (`#302 `_) * fix creating test_results folder before trying to use it when running tests * for a complete list of changes see the `commit log for 0.5.59 `_ 0.5.58 (2012-12-21) ------------------- * first public release for Groovy catkin-0.8.0/CMakeLists.txt000066400000000000000000000012421361264727400155430ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) set(catkin_EXTRAS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake) project(catkin) if(NOT DEFINED CATKIN_TOPLEVEL) include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) endif() catkin_package() install(FILES LICENSE DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) # install cmake files for catkin (except some files only used at build time of catkin) install(DIRECTORY cmake DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} USE_SOURCE_PERMISSIONS PATTERN "catkinConfig.cmake.in" EXCLUDE) catkin_python_setup() if(CATKIN_ENABLE_TESTING) catkin_add_nosetests(test/local_tests) catkin_add_nosetests(test/unit_tests) endif() catkin-0.8.0/LICENSE000066400000000000000000000026371361264727400140210ustar00rootroot00000000000000Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. catkin-0.8.0/README.rst000066400000000000000000000004511361264727400144730ustar00rootroot00000000000000.. image:: https://www.gravatar.com/avatar/ebfbbd6f16ce1f0dc30fc7c82c38d688 :width: 100px catkin ====== Catkin is a collection of cmake macros and associated python code used to build some parts of `ROS `_ Documentation ------------- http://ros.org/doc/api/catkin/html/ catkin-0.8.0/bin/000077500000000000000000000000001361264727400135545ustar00rootroot00000000000000catkin-0.8.0/bin/.gitignore000066400000000000000000000000451361264727400155430ustar00rootroot00000000000000catkin_findc catkin_prepare_releasec catkin-0.8.0/bin/catkin_find000077500000000000000000000053731361264727400157630ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) from catkin.find_in_workspaces import find_in_workspaces # noqa: E402 def parse_args(args=sys.argv[1:]): parser = argparse.ArgumentParser(description='Searches the catkin workspaces for project-specific files/folders.') parser.add_argument('project', nargs='?', help='The project to find a path for') parser.add_argument('path', nargs='?', help='The relative path of a project file/folder (a prefix is sufficient)') parser.add_argument('--first-only', action='store_true', help='Flag if only the first result should be returned') parser.add_argument('--without-underlays', action='store_true', help='Flag if further workspaces should be skipped after finding matches in one workspace') group = parser.add_argument_group('Search folders', 'Restrict the folders to search in') for foldername, subfolder_help in {'bin': 'Search in "bin" folder', 'etc': 'Search in "etc(/PROJECT)" folder', 'include': 'Search in "include(/PROJECT)" folder', 'lib': 'Search in "lib" folder', 'libexec': 'Search in "lib/PROJECT" folder', 'share': 'Search in "share(/PROJECT)" folder (and source of PROJECT if not installed)'}.items(): group.add_argument('--%s' % foldername, dest='install_folders', action='append_const', const=foldername, help=subfolder_help) return parser.parse_args(args=args) def main(): args = parse_args() try: # keep order of folders to search in checked = [] results = find_in_workspaces(args.install_folders, args.project, args.path, first_matching_workspace_only=args.without_underlays, first_match_only=args.first_only, considered_paths=checked) if args.first_only: if len(results) > 1: raise RuntimeError('Could not find unique path, the following paths are matching:\n%s' % '\n'.join(results)) elif len(results) == 0: raise RuntimeError('Could not find any path, checked the following paths:\n%s' % '\n'.join(checked)) if results: print('\n'.join(results)) except Exception as e: sys.exit(str(e)) if __name__ == '__main__': main() catkin-0.8.0/bin/catkin_init_workspace000077500000000000000000000021021361264727400200470ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) from catkin.init_workspace import init_workspace # noqa: E402 def main(): parser = argparse.ArgumentParser(description='Initializes a catkin workspace by creating a top-level CMakeLists.txt.') parser.add_argument('workspace', nargs='?', default='.', help='The path to an existing folder (default: .)') args = parser.parse_args() # verify that workspace folder exists workspace = os.path.abspath(args.workspace) if not os.path.isdir(workspace): parser.error('Workspace "%s" does not exist' % workspace) try: init_workspace(workspace) except Exception as e: sys.stderr.write(str(e)) sys.exit(2) if __name__ == '__main__': main() catkin-0.8.0/bin/catkin_make000077500000000000000000000355741361264727400157660ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import subprocess import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) from catkin.builder import apply_platform_specific_defaults # noqa: E402 from catkin.builder import cmake_input_changed # noqa: E402 from catkin.builder import determine_path_argument # noqa: E402 from catkin.builder import extract_cmake_and_make_arguments # noqa: E402 from catkin.builder import get_package_names_with_recursive_dependencies # noqa: E402 from catkin.builder import handle_make_arguments # noqa: E402 from catkin.builder import print_command_banner # noqa: E402 from catkin.builder import run_command # noqa: E402 from catkin.builder import run_command_colorized # noqa: E402 from catkin.init_workspace import init_workspace # noqa: E402 from catkin.terminal_color import disable_ANSI_colors, fmt # noqa: E402 from catkin_pkg.packages import find_packages # noqa: E402 from catkin_pkg.tool_detection import get_previous_tool_used_on_the_space # noqa: E402 from catkin_pkg.tool_detection import mark_space_as_built_by # noqa: E402 from catkin_pkg.workspaces import ensure_workspace_marker # noqa: E402 def main(): args = _parse_args() apply_platform_specific_defaults(args) cmake_args = args.cmake_args # force --no-color if stdout is non-interactive if not sys.stdout.isatty(): args.no_color = True # disable colors if asked if args.no_color: disable_ANSI_colors() # use PWD in order to work when being invoked in a symlinked location cwd = os.getenv('PWD', os.curdir) # verify that the base path is known base_path = os.path.abspath(os.path.join(cwd, args.directory)) if not os.path.exists(base_path): return fmt('@{rf}The specified base path @{boldon}"%s"@{boldoff} ' 'does not exist' % base_path) print('Base path: %s' % base_path) # verify that the base path does not contain a package.xml if os.path.exists(os.path.join(base_path, 'package.xml')): return fmt('@{rf}The specified base path @{boldon}"%s"@{boldoff} ' 'contains a package but "catkin_make" must be invoked ' 'in the root of workspace' % base_path) # determine source space source_path = determine_path_argument(cwd, base_path, args.source, 'src') if not os.path.exists(source_path): return fmt('@{rf}The specified source space @{boldon}"%s"@{boldoff} ' 'does not exist' % source_path) print('Source space: %s' % source_path) # verify that the base path does not contain a CMakeLists.txt # except if base path equals source path if (os.path.realpath(base_path) != os.path.realpath(source_path)) \ and os.path.exists(os.path.join(base_path, 'CMakeLists.txt')): return fmt('@{rf}The specified base path @{boldon}"%s"@{boldoff} ' 'contains a CMakeLists.txt but "catkin_make" must be ' 'invoked in the root of workspace' % base_path) build_path = determine_path_argument(cwd, base_path, args.build, 'build') print('Build space: %s' % build_path) # ensure the build space was previously built by catkin_make previous_tool = get_previous_tool_used_on_the_space(build_path) if previous_tool is not None and previous_tool != 'catkin_make': if args.override_build_tool_check: print(fmt( "@{yf}Warning: build space at '%s' was previously built by '%s', " 'but --override-build-tool-check was passed so continuing anyways.' % (build_path, previous_tool))) else: return fmt( "@{rf}The build space at '%s' was previously built by '%s'. " 'Please remove the build space or pick a different build space.' % (build_path, previous_tool)) mark_space_as_built_by(build_path, 'catkin_make') # determine devel space devel_arg = None prefix = '-DCATKIN_DEVEL_PREFIX=' devel_prefix = [a for a in cmake_args if a.startswith(prefix)] if devel_prefix: devel_arg = devel_prefix[-1][len(prefix):] cmake_args = [a for a in cmake_args if a not in devel_prefix] devel_path = determine_path_argument(cwd, base_path, devel_arg, 'devel') print('Devel space: %s' % devel_path) cmake_args.append('-DCATKIN_DEVEL_PREFIX=%s' % devel_path) # ensure the devel space was previously built by catkin_make previous_tool = get_previous_tool_used_on_the_space(devel_path) if previous_tool is not None and previous_tool != 'catkin_make': if args.override_build_tool_check: print(fmt( "@{yf}Warning: devel space at '%s' was previously built by '%s', " 'but --override-build-tool-check was passed so continuing anyways.' % (devel_path, previous_tool))) else: return fmt( "@{rf}The devel space at '%s' was previously built by '%s'. " 'Please remove the devel space or pick a different devel space.' % (devel_path, previous_tool)) mark_space_as_built_by(devel_path, 'catkin_make') # determine install space install_arg = None prefix = '-DCMAKE_INSTALL_PREFIX=' install_prefix = [a for a in cmake_args if a.startswith(prefix)] if install_prefix: install_arg = install_prefix[-1][len(prefix):] cmake_args = [a for a in cmake_args if a not in install_prefix] install_path = determine_path_argument( cwd, base_path, install_arg, 'install') print('Install space: %s' % install_path) cmake_args.append('-DCMAKE_INSTALL_PREFIX=%s' % install_path) # ensure build folder exists if not os.path.exists(build_path): os.mkdir(build_path) # ensure toplevel cmake file exists toplevel_cmake = os.path.join(source_path, 'CMakeLists.txt') if not os.path.exists(toplevel_cmake): try: init_workspace(source_path) except Exception as e: return fmt('@{rf}Creating the toplevel cmake file failed:@| %s' % str(e)) packages = find_packages(source_path, exclude_subspaces=True) # whitelist packages and their dependencies in workspace if args.only_pkg_with_deps: package_names = [p.name for p in packages.values()] unknown_packages = [name for name in args.only_pkg_with_deps if name not in package_names] if len(unknown_packages) == len(args.only_pkg_with_deps): # all package names are unknown return fmt( '@{rf}Packages @{boldon}"%s"@{boldoff} not found in the workspace' % ', '.join(args.only_pkg_with_deps)) if unknown_packages: # ignore unknown packages print(fmt( '@{yf}Packages @{boldon}"%s"@{boldoff} not found in the workspace - ignoring them' % ', '.join(sorted(unknown_packages))), file=sys.stderr) args.only_pkg_with_deps = [name for name in args.only_pkg_with_deps if name in package_names] whitelist_pkg_names = get_package_names_with_recursive_dependencies(packages, args.only_pkg_with_deps) print('Whitelisted packages: %s' % ', '.join(sorted(whitelist_pkg_names))) packages = {path: p for path, p in packages.items() if p.name in whitelist_pkg_names} cmake_args += ['-DCATKIN_WHITELIST_PACKAGES=%s' % ';'.join(sorted(whitelist_pkg_names))] # verify that specified package exists in workspace if args.pkg: packages_by_name = {p.name: path for path, p in packages.items()} unknown_packages = [name for name in args.pkg if name not in packages_by_name] if len(unknown_packages) == len(args.pkg): # all package names are unknown return fmt('@{rf}Packages @{boldon}"%s"@{boldoff} not found in the workspace' % ', '.join(args.pkg)) if unknown_packages: # ignore unknown packages print(fmt( '@{yf}Packages @{boldon}"%s"@{boldoff} not found in the workspace - ignoring them' % ', '.join(sorted(unknown_packages))), file=sys.stderr) args.pkg = [name for name in args.pkg if name in packages_by_name] if not [arg for arg in cmake_args if arg.startswith('-G')]: if args.use_ninja: cmake_args += ['-G', 'Ninja'] elif args.use_nmake: cmake_args += ['-G', 'NMake Makefiles'] else: # no need to check for use_gmake, as it uses the same generator as make cmake_args += ['-G', 'Unix Makefiles'] elif args.use_ninja or args.use_nmake: return fmt("@{rf}Error: either specify a generator using '-G...' or '--use-[ninja|nmake]' but not both") # check if cmake must be run (either for a changed list of package paths or changed cmake arguments) force_cmake = cmake_input_changed(packages, build_path, cmake_args=cmake_args) # consider calling cmake if not args.use_ninja: makefile = os.path.join(build_path, 'Makefile') else: makefile = os.path.join(build_path, 'build.ninja') if not os.path.exists(makefile) or args.force_cmake or force_cmake: cmd = [ 'cmake', source_path, ] cmd += cmake_args try: print_command_banner(cmd, build_path, color=not args.no_color) if args.no_color: run_command(cmd, build_path) else: run_command_colorized(cmd, build_path) except subprocess.CalledProcessError: return fmt('@{rf}Invoking @{boldon}"cmake"@{boldoff} failed') else: if args.use_ninja: cmd = ['ninja', 'build.ninja'] elif args.use_nmake: cmd = ['nmake', 'cmake_check_build_system'] elif args.use_gmake: cmd = ['gmake', 'cmake_check_build_system'] else: cmd = ['make', 'cmake_check_build_system'] try: print_command_banner(cmd, build_path, color=not args.no_color) if args.no_color: run_command(cmd, build_path) else: run_command_colorized(cmd, build_path) except subprocess.CalledProcessError: return fmt('@{rf}Invoking @{boldon}"%s"@{boldoff} failed' % ' '.join(cmd)) ensure_workspace_marker(base_path) # invoke make if args.use_ninja: cmd = ['ninja'] elif args.use_nmake: cmd = ['nmake'] elif args.use_gmake: cmd = ['gmake'] else: cmd = ['make'] cmd.extend(handle_make_arguments(args.make_args, append_default_jobs_flags=not args.use_nmake)) try: if not args.pkg: make_paths = [build_path] else: make_paths = [os.path.join(build_path, packages_by_name[name]) for name in args.pkg] for make_path in make_paths: print_command_banner(cmd, make_path, color=not args.no_color) run_command(cmd, make_path) except subprocess.CalledProcessError: return fmt('@{rf}Invoking @{boldon}"%s"@{boldoff} failed' % ' '.join(cmd)) def _parse_args(args=sys.argv[1:]): args, cmake_args, make_args = extract_cmake_and_make_arguments(args) parser = argparse.ArgumentParser(description=( 'Creates the catkin workspace layout and invokes cmake and make. ' 'Any argument starting with "-D" will be passed to the "cmake" invocation. ' 'The -j (--jobs) and -l (--load-average) arguments for make are also extracted and passed to make directly. ' 'If no -j/-l arguments are given, then the MAKEFLAGS environment variable is searched for -j/-l flags. ' 'If found then no -j/-l flags are passed to make explicitly (as not to override the MAKEFLAGS). ' 'If MAKEFLAGS is not set then the job flags in the ROS_PARALLEL_JOBS environment variable are passed to make. ' 'Note: ROS_PARALLEL_JOBS should contain the exact job flags, not just a number. ' 'See: http://www.ros.org/wiki/ROS/EnvironmentVariables#ROS_PARALLEL_JOBS ' 'If ROS_PARALLEL_JOBS is not set then the flags "-jn -ln" are used, where n is number of CPU cores. ' 'If the number of CPU cores cannot be determined then no flags are given to make. ' 'All other arguments (i.e. target names) are passed to the "make" invocation. ' 'To ignore certain packages place a file named CATKIN_IGNORE in the package folder. ' 'Or you can pass the list of package names to the CMake variable CATKIN_BLACKLIST_PACKAGES. ' 'For example: catkin_make -DCATKIN_BLACKLIST_PACKAGES="foo;bar".')) add = parser.add_argument add('-C', '--directory', default=os.curdir, help="The base path of the workspace (default '%s')" % os.curdir) add('--source', help="The path to the source space (default 'workspace_base/src')") add('--build', help="The path to the build space (default 'workspace_base/build')") add('--use-ninja', action='store_true', help="Use 'ninja' instead of 'make'") add('--use-nmake', action='store_true', help="Use 'nmake' instead of 'make'") add('--use-gmake', action='store_true', help="Use 'gmake' instead of 'make'") add('--force-cmake', action='store_true', help="Invoke 'cmake' even if it has been executed before") add('--no-color', action='store_true', help='Disables colored output (only for catkin_make and CMake)') add('--pkg', nargs='+', help="Invoke 'make' on specific packages only") add('--only-pkg-with-deps', nargs='+', help='Whitelist only the specified packages and their dependencies by ' 'setting the CATKIN_WHITELIST_PACKAGES variable. This variable is ' 'stored in CMakeCache.txt and will persist between CMake calls ' 'unless explicitly cleared; e.g. catkin_make -DCATKIN_WHITELIST_PACKAGES="".') add('--cmake-args', dest='cmake_args', nargs='*', type=str, help='Arbitrary arguments which are passed to CMake. ' 'It must be passed after other arguments since it collects all following options.') add('--make-args', dest='make_args', nargs='*', type=str, help='Arbitrary arguments which are passes to make. ' 'It must be passed after other arguments since it collects all following options. ' 'This is only necessary in combination with --cmake-args since else all unknown ' 'arguments are passed to make anyway.') add('--override-build-tool-check', action='store_true', default=False, help='use to override failure due to using different build tools on the same workspace.') namespace, unknown_args = parser.parse_known_args(args) namespace.cmake_args = cmake_args namespace.make_args = unknown_args + make_args return namespace if __name__ == '__main__': try: sys.exit(main()) except Exception as e: sys.exit(str(e)) catkin-0.8.0/bin/catkin_make_isolated000077500000000000000000000200631361264727400176350ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import re import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) from catkin.builder import apply_platform_specific_defaults # noqa: E402 from catkin.builder import build_workspace_isolated # noqa: E402 from catkin.builder import colorize_line # noqa: E402 from catkin.builder import determine_path_argument # noqa: E402 from catkin.builder import extract_cmake_and_make_and_catkin_make_arguments # noqa: E402 from catkin.builder import extract_jobs_flags # noqa: E402 def parse_args(args=None): args = sys.argv[1:] if args is None else args args, cmake_args, make_args, catkin_make_args = extract_cmake_and_make_and_catkin_make_arguments(args) # Extract make jobs flags jobs_flags = extract_jobs_flags(' '.join(args)) if jobs_flags: args = re.sub(jobs_flags, '', ' '.join(args)).split() jobs_flags = jobs_flags.split() parser = argparse.ArgumentParser(description=( 'Builds each catkin (and non-catkin) package from a given workspace in isolation, ' 'but still in topological order. ' 'Make job flags (-j/-l) are handled just like catkin_make handles them.' )) add = parser.add_argument add('-C', '--directory', dest='workspace', default=os.curdir, help="The base path of the workspace (default '%s')" % os.curdir) add('--source', '--source-space', default=None, help="The path to the source space (default 'workspace_base/src')") add('--build', '--build-space', default=None, help="The path to the build space (default 'workspace_base/build_isolated')") add('--devel', '--devel-space', default=None, help="Sets the target devel space (default 'workspace_base/devel_isolated')") add('--merge', action='store_true', default=False, help='Build each catkin package into a common devel space.') add('--install-space', default=None, help="Sets the target install space (default 'workspace_base/install_isolated')") add('--use-ninja', action='store_true', help="Use 'ninja' instead of 'make'") add('--use-nmake', action='store_true', help="Use 'nmake' instead of 'make'") add('--use-gmake', action='store_true', help="Use 'gmake' instead of 'make'") add('--install', action='store_true', default=False, help='Causes each catkin package to be installed.') add('--force-cmake', action='store_true', default=False, help='Runs cmake explicitly for each catkin package.') add('--no-color', action='store_true', default=False, help='Disables colored output (only for catkin_make and CMake)') pkg = parser.add_mutually_exclusive_group(required=False) pkg.add_argument('--pkg', nargs='+', metavar='PKGNAME', dest='packages', help='Process only specific packages ' '(only after catkin_make_isolated has been invoked before with the same install flag)') pkg.add_argument('--ignore-pkg', nargs='+', metavar='PKGNAME', dest='ignore_packages', help='Ignore specific packages.') pkg.add_argument('--from-pkg', metavar='PKGNAME', dest='from_package', help='Restart catkin_make_isolated at the given package continuing from there ' '(do not change CMake arguments, add/move/remove packages or toggle the install flag when ' 'using this option since this may result in an inconsistent workspace state).') add('--only-pkg-with-deps', nargs='+', help='Only consider the specific packages and their recursive dependencies and ignore all other packages in ' 'the workspace (only works together with --merge or --install)') add('-q', '--quiet', action='store_true', default=False, help='Suppresses the cmake and make output until an error occurs.') add('--cmake-args', nargs='*', type=str, help='Arbitrary arguments which are passes to CMake. ' 'It must be passed after other arguments since it collects all following options.') add('--make-args', nargs='*', type=str, help='Arbitrary arguments which are passes to make.' 'It must be passed after other arguments since it collects all following options.') add('--catkin-make-args', nargs='*', type=str, help='Arbitrary arguments which are passes to make but only for catkin packages.' 'It must be passed after other arguments since it collects all following options.') add('--override-build-tool-check', action='store_true', default=False, help='use to override failure due to using differnt build tools on the same workspace.') opts = parser.parse_args(args) if opts.only_pkg_with_deps and not opts.merge and not opts.install: parser.error("The '--only-pkg-with-deps' option can only be used together with '--merge' or '--install'") opts.cmake_args = cmake_args opts.make_args = make_args + (jobs_flags or []) opts.catkin_make_args = catkin_make_args return opts def handle_cmake_args(cmake_args, opts): # Process cmake arugments for arg in list(cmake_args): if arg.startswith('-DCMAKE_INSTALL_PREFIX='): if opts.install_space is None: opts.install_space = arg.split('=', 1)[-1] else: print(colorize_line( "Warning: both the cmake argument '" + str(arg) + "' " + 'and the --install-space argument have been used, ' + 'using the --install-space argument.' )) cmake_args.remove(arg) elif arg.startswith('-DCATKIN_DEVEL_PREFIX='): if opts.devel is None: opts.devel = arg.split('=', 1)[-1] else: print(colorize_line( "Warning: both the cmake argument '" + str(arg) + "' " + 'and the --devel-space argument have been used, ' + 'using the --devel-space argument.' )) cmake_args.remove(arg) return cmake_args, opts def main(): opts = parse_args() apply_platform_specific_defaults(opts) cmake_args, opts = handle_cmake_args(opts.cmake_args, opts) # force --no-color if stdout is non-interactive if not sys.stdout.isatty(): opts.no_color = True # use PWD in order to work when being invoked in a symlinked location cwd = os.getenv('PWD', os.curdir) workspace = os.path.abspath(os.path.join(cwd, opts.workspace)) sourcespace = determine_path_argument(cwd, workspace, opts.source, 'src') buildspace = determine_path_argument( cwd, workspace, opts.build, 'build_isolated') develspace = determine_path_argument( cwd, workspace, opts.devel, 'devel_isolated') installspace = determine_path_argument( cwd, workspace, opts.install_space, 'install_isolated') destdir = os.environ['DESTDIR'] if 'DESTDIR' in os.environ else None build_workspace_isolated( workspace=workspace, sourcespace=sourcespace, buildspace=buildspace, develspace=develspace, installspace=installspace, merge=opts.merge, install=opts.install, force_cmake=opts.force_cmake, colorize=not opts.no_color, build_packages=opts.packages or ([] if opts.from_package is None else [opts.from_package]), ignore_packages=opts.ignore_packages, quiet=opts.quiet, cmake_args=cmake_args, make_args=opts.make_args, catkin_make_args=opts.catkin_make_args, continue_from_pkg=opts.from_package is not None, only_pkg_with_deps=opts.only_pkg_with_deps, destdir=destdir, use_ninja=opts.use_ninja, use_nmake=opts.use_nmake, use_gmake=opts.use_gmake, override_build_tool_check=opts.override_build_tool_check, ) if __name__ == '__main__': main() catkin-0.8.0/bin/catkin_test_results000077500000000000000000000035451361264727400176020ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) from catkin.test_results import aggregate_results # noqa: E402 from catkin.test_results import print_summary2 # noqa: E402 from catkin.test_results import test_results2 # noqa: E402 def main(): 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.') parser.add_argument('test_results_dir', nargs='?', default=os.curdir, help='The path to the test results') 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') parser.add_argument('--verbose', action='store_true', default=False, help='Show all tests which have errors or failed') args = parser.parse_args() # verify that workspace folder exists test_results_dir = os.path.abspath(args.test_results_dir) if not os.path.isdir(test_results_dir): sys.exit('Test results directory "%s" does not exist' % test_results_dir) try: results = test_results2( test_results_dir, show_verbose=args.verbose, show_all=args.all) _, sum_errors, sum_failures = aggregate_results(results) print_summary2(results, show_stable=args.all) # Skipped tests alone should not count as a failure if sum_errors or sum_failures: sys.exit(1) except Exception as e: sys.stderr.write(str(e)) sys.exit(2) if __name__ == '__main__': main() catkin-0.8.0/bin/catkin_topological_order000077500000000000000000000045641361264727400205530ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import argparse import os import sys # find the import relatively if available to work before installing catkin or overlaying installed version if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) try: from catkin_pkg.topological_order import topological_order except ImportError as e: 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) def main(): parser = argparse.ArgumentParser(description='Outputs the catkin projects of a workspace in topological order.') parser.add_argument('workspace', nargs='?', default='.', help='The path to a workspace (default: .)') parser.add_argument('--underlay-workspaces', nargs='*', default=[], help='The paths to underlay workspaces which are only used to resolve dependencies') parser.add_argument('--only-folders', action='store_true', help='Only output the project folders') parser.add_argument('--only-names', action='store_true', help='Only output the project names') args = parser.parse_args() # verify reasonable argument combination if args.only_folders and args.only_names: parser.error('Use either "--only-folders" or "--only-names" but not both') # verify that workspace folder exists workspace = os.path.abspath(args.workspace) if not os.path.isdir(workspace): sys.exit('Workspace "%s" does not exist' % workspace) ordered_projects = topological_order(workspace, underlay_workspaces=args.underlay_workspaces) if not ordered_projects: sys.stderr.write('Workspace "%s" seems to not contain any projects.' ' Have you passed the correct path to a ' 'catkin workspace?' % workspace) sys.exit(3) for (path, package) in ordered_projects: if path is None: sys.exit('The workspace contains packages with a circular dependency: %s' % package) if args.only_folders: print('%s' % path) elif args.only_names: print('%s' % package.name) else: print('%s %s' % (package.name, path)) if __name__ == '__main__': main() catkin-0.8.0/cmake/000077500000000000000000000000001361264727400140645ustar00rootroot00000000000000catkin-0.8.0/cmake/all.cmake000066400000000000000000000201351361264727400156370ustar00rootroot00000000000000# prevent multiple inclusion if(DEFINED _CATKIN_ALL_INCLUDED_) message(FATAL_ERROR "catkin/cmake/all.cmake included multiple times") endif() set(_CATKIN_ALL_INCLUDED_ TRUE) if(NOT DEFINED catkin_EXTRAS_DIR) message(FATAL_ERROR "catkin_EXTRAS_DIR is not set") endif() # define devel space if(CATKIN_DEVEL_PREFIX) set(CATKIN_DEVEL_PREFIX ${CATKIN_DEVEL_PREFIX} CACHE PATH "catkin devel space") else() set(CATKIN_DEVEL_PREFIX "${CMAKE_BINARY_DIR}/devel") endif() message(STATUS "Using CATKIN_DEVEL_PREFIX: ${CATKIN_DEVEL_PREFIX}") # update develspace marker file with a reference to this sourcespace set(_catkin_marker_file "${CATKIN_DEVEL_PREFIX}/.catkin") # check if the develspace marker file exists yet if(EXISTS ${_catkin_marker_file}) file(READ ${_catkin_marker_file} _existing_sourcespaces) if(_existing_sourcespaces STREQUAL "") # write this sourcespace to the marker file file(WRITE ${_catkin_marker_file} "${CMAKE_SOURCE_DIR}") else() # append to existing list of sourcespaces if it's not in the list list(FIND _existing_sourcespaces "${CMAKE_SOURCE_DIR}" _existing_sourcespace_index) if(_existing_sourcespace_index EQUAL -1) file(APPEND ${_catkin_marker_file} ";${CMAKE_SOURCE_DIR}") endif() endif() else() # create a new develspace marker file # NOTE: extra care must be taken when running multiple catkin jobs in parallel # so that this does not overwrite the result of a similar call in another package file(WRITE ${_catkin_marker_file} "${CMAKE_SOURCE_DIR}") endif() # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument # or CMAKE_PREFIX_PATH from the environment if(NOT DEFINED CMAKE_PREFIX_PATH) if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") if(NOT WIN32) string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) else() set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) endif() endif() endif() message(STATUS "Using CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") # store original CMAKE_PREFIX_PATH set(CMAKE_PREFIX_PATH_AS_IS ${CMAKE_PREFIX_PATH}) # list of unique catkin workspaces based on CMAKE_PREFIX_PATH set(CATKIN_WORKSPACES "") foreach(path ${CMAKE_PREFIX_PATH}) if(EXISTS "${path}/.catkin") file(TO_CMAKE_PATH "${path}" cmake_path) list(FIND CATKIN_WORKSPACES ${cmake_path} _index) if(_index EQUAL -1) list(APPEND CATKIN_WORKSPACES ${cmake_path}) endif() endif() endforeach() if(CATKIN_WORKSPACES) message(STATUS "This workspace overlays: ${CATKIN_WORKSPACES}") endif() # prepend devel space to CMAKE_PREFIX_PATH list(FIND CMAKE_PREFIX_PATH ${CATKIN_DEVEL_PREFIX} _index) if(_index EQUAL -1) list(INSERT CMAKE_PREFIX_PATH 0 ${CATKIN_DEVEL_PREFIX}) endif() # set CATKIN_INSTALL_INTO_PREFIX_ROOT based on CATKIN_BUILD_BINARY_PACKAGE # if not defined already if(NOT DEFINED CATKIN_INSTALL_INTO_PREFIX_ROOT) if(CATKIN_BUILD_BINARY_PACKAGE) set(CATKIN_INSTALL_INTO_PREFIX_ROOT FALSE) else() set(CATKIN_INSTALL_INTO_PREFIX_ROOT TRUE) endif() endif() # enable all new policies (if available) macro(_set_cmake_policy_to_new_if_available policy) if(POLICY ${policy}) cmake_policy(SET ${policy} NEW) endif() endmacro() _set_cmake_policy_to_new_if_available(CMP0000) _set_cmake_policy_to_new_if_available(CMP0001) _set_cmake_policy_to_new_if_available(CMP0002) _set_cmake_policy_to_new_if_available(CMP0003) _set_cmake_policy_to_new_if_available(CMP0004) _set_cmake_policy_to_new_if_available(CMP0005) _set_cmake_policy_to_new_if_available(CMP0006) _set_cmake_policy_to_new_if_available(CMP0007) _set_cmake_policy_to_new_if_available(CMP0008) _set_cmake_policy_to_new_if_available(CMP0009) _set_cmake_policy_to_new_if_available(CMP0010) _set_cmake_policy_to_new_if_available(CMP0011) _set_cmake_policy_to_new_if_available(CMP0012) _set_cmake_policy_to_new_if_available(CMP0013) _set_cmake_policy_to_new_if_available(CMP0014) _set_cmake_policy_to_new_if_available(CMP0015) _set_cmake_policy_to_new_if_available(CMP0016) _set_cmake_policy_to_new_if_available(CMP0017) # the following operations must be performed inside a project context if(NOT PROJECT_NAME) project(catkin_internal) endif() # include CMake functions include(CMakeParseArguments) # functions/macros: list_append_unique, safe_execute_process # python-integration: catkin_python_setup.cmake, interrogate_setup_dot_py.py, templates/__init__.py.in, templates/script.py.in, templates/python_distutils_install.bat.in, templates/python_distutils_install.sh.in, templates/safe_execute_install.cmake.in foreach(filename assert atomic_configure_file catkin_add_env_hooks catkin_destinations catkin_download catkin_generate_environment catkin_install_python catkin_libraries catkin_metapackage catkin_package catkin_package_xml custom_install # required by catkin_symlink_install and test/gtest catkin_symlink_install catkin_workspace debug_message em_expand python # defines PYTHON_EXECUTABLE, required by empy empy find_program_required legacy list_append_deduplicate list_append_unique list_insert_in_workspace_order safe_execute_process stamp string_starts_with platform/lsb platform/ubuntu platform/windows test/tests # defines CATKIN_ENABLE_TESTING, required by other test functions test/catkin_download_test_data test/gtest test/nosetests tools/doxygen tools/libraries tools/rt # tools/threads ) include(${catkin_EXTRAS_DIR}/${filename}.cmake) endforeach() # output catkin version for debugging _catkin_package_xml(${CMAKE_BINARY_DIR}/catkin/catkin_generated/version DIRECTORY ${catkin_EXTRAS_DIR}/..) message(STATUS "catkin ${catkin_VERSION}") # ensure that no current package name is set unset(_CATKIN_CURRENT_PACKAGE) # tools/libraries.cmake configure_shared_library_build_settings() # set global install destinations set(CATKIN_GLOBAL_BIN_DESTINATION bin) set(CATKIN_GLOBAL_ETC_DESTINATION etc) set(CATKIN_GLOBAL_INCLUDE_DESTINATION include) set(CATKIN_GLOBAL_LIB_DESTINATION lib) set(CATKIN_GLOBAL_LIBEXEC_DESTINATION lib) set(CATKIN_GLOBAL_PYTHON_DESTINATION ${PYTHON_INSTALL_DIR}) set(CATKIN_GLOBAL_SHARE_DESTINATION share) # undefine CATKIN_ENV since it might be set in the cache from a previous build set(CATKIN_ENV "" CACHE INTERNAL "catkin environment" FORCE) # generate environment files like env.* and setup.* # uses em_expand without CATKIN_ENV being set yet catkin_generate_environment() # file extension of env script if(CMAKE_HOST_UNIX) # true for linux, apple, mingw-cross and cygwin set(script_ext sh) else() set(script_ext bat) endif() # take snapshot of the modifications the setup script causes # to reproduce the same changes with a static script in a fraction of the time set(SETUP_DIR ${CMAKE_BINARY_DIR}/catkin_generated) set(SETUP_FILENAME "setup_cached") configure_file(${catkin_EXTRAS_DIR}/templates/generate_cached_setup.py.in ${CMAKE_BINARY_DIR}/catkin_generated/generate_cached_setup.py) set(GENERATE_ENVIRONMENT_CACHE_COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/catkin_generated/generate_cached_setup.py) # the script is generated once here and refreshed by # every call to catkin_add_env_hooks() and # the first call to catkin_python_setup() if the Python install directory didn't exist yet safe_execute_process(COMMAND ${GENERATE_ENVIRONMENT_CACHE_COMMAND}) # generate env_cached which just relays to the setup_cached configure_file(${catkin_EXTRAS_DIR}/templates/env.${script_ext}.in ${SETUP_DIR}/env_cached.${script_ext} @ONLY) # environment to call external processes set(CATKIN_ENV ${SETUP_DIR}/env_cached.${script_ext} CACHE INTERNAL "catkin environment") # add additional environment hooks if(NOT CATKIN_INSTALL_INTO_PREFIX_ROOT) set(catkin_skip_install_env_hooks "SKIP_INSTALL") endif() if(CMAKE_HOST_UNIX AND PROJECT_NAME STREQUAL "catkin") catkin_add_env_hooks(05.catkin_make SHELLS bash DIRECTORY ${catkin_EXTRAS_DIR}/env-hooks ${catkin_skip_install_env_hooks}) catkin_add_env_hooks(05.catkin_make_isolated SHELLS bash DIRECTORY ${catkin_EXTRAS_DIR}/env-hooks ${catkin_skip_install_env_hooks}) endif() # requires stamp and environment files include(${catkin_EXTRAS_DIR}/catkin_python_setup.cmake) catkin-0.8.0/cmake/assert.cmake000066400000000000000000000014261361264727400163720ustar00rootroot00000000000000function(assert VAR) if(NOT ${VAR}) message(FATAL_ERROR "\nAssertion failed: ${VAR} (value is '${${VAR}}')\n") endif() debug_message(3 "assert(${VAR}) passed (${VAR} = ${${VAR}})") endfunction() function(assert_unset VAR) if(${VAR}) message(FATAL_ERROR "\nAssertion failed: '${VAR}' is set but should not be (value is '${${VAR}}')\n") endif() debug_message(3 "assert_unset(${VAR}) passed") endfunction() function(assert_file_exists FILENAME MESSAGE) if(NOT FILENAME) message(FATAL_ERROR "\nAssertion failed: check for file existence, but filename (${FILENAME}) unset. Message: ${MESSAGE}\n") endif() if(NOT EXISTS ${FILENAME}) message(FATAL_ERROR "\nAssertion failed: file '${FILENAME}' does not exist. Message: ${MESSAGE}\n") endif() endfunction() catkin-0.8.0/cmake/atomic_configure_file.cmake000066400000000000000000000010161361264727400214000ustar00rootroot00000000000000function(atomic_configure_file input output) get_filename_component(atomic_file ${output} NAME) set(atomic_file "${CMAKE_BINARY_DIR}/atomic_configure/${atomic_file}") configure_file("${input}" "${atomic_file}" ${ARGN}) get_filename_component(output_path ${output} PATH) # sync multiple catkin cmake processes writing to that location if (NOT CMAKE_VERSION VERSION_LESS 3.2) file(LOCK "${output_path}" DIRECTORY GUARD FUNCTION) endif() file(COPY "${atomic_file}" DESTINATION "${output_path}") endfunction() catkin-0.8.0/cmake/catkinConfig.cmake.in000066400000000000000000000124161361264727400200760ustar00rootroot00000000000000# generated from catkin/cmake/catkinConfig.cmake.in # which overlays the default template catkin/cmake/template/pkgConfig.cmake.in # # :outvar catkin_INCLUDE_DIRS: contains the include dirs of all searched components. # For use with CMake ``include_directories(${catkin_INCLUDE_DIRS})``. # :outvar catkin_LIBRARY_DIRS: contains the library dirs of all searched components. # For use with CMake ``link_directories(${catkin_LIBRARY_DIRS})``. # :outvar catkin_LIBRARIES: contains the libraries of all searched components. # For use with CMake ``target_link_libraries( ${catkin_LIBRARIES})``. # :outvar _INCLUDE_DIRS/_LIBRARY_DIRS/_LIBRARIES: # contains the include dirs / library dirs / libraries of the searched component . if(CATKIN_TOPLEVEL_FIND_PACKAGE OR NOT CATKIN_TOPLEVEL) set(catkin_EXTRAS_DIR "@PKG_CMAKE_DIR@") # prevent multiple inclusion from repeated find_package() calls in non-workspace context # as long as this variable is in the scope the variables from all.cmake are also, so no need to be evaluated again if(NOT DEFINED _CATKIN_CONFIG_ALL_INCLUDED_) set(_CATKIN_CONFIG_ALL_INCLUDED_ TRUE) include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) endif() endif() # skip setting find_package() variables when discovered from toplevel.cmake if(CATKIN_TOPLEVEL_FIND_PACKAGE) return() endif() # prevent usage with wrong case if(CATKIN_FIND_COMPONENTS OR CATKIN_FIND_REQUIRED OR CATKIN_FIND_QUIETLY) message(FATAL_ERROR "find_package() only supports lower-case package name 'catkin'") endif() # mark as found if(NOT catkin_FOUND) set(catkin_FOUND) set(CATKIN_PACKAGE_PREFIX "" CACHE STRING "Prefix to apply to package generated via gendebian") endif() # flag project as catkin-based to distinguish if a find_package()-ed project is a catkin project set(catkin_FOUND_CATKIN_PROJECT TRUE) # XXXX don't overwrite catkin_* variables when being called recursively if(NOT _CATKIN_FIND_ OR _CATKIN_FIND_ EQUAL 0) set(_CATKIN_FIND_ 0) if(catkin_FIND_COMPONENTS) set(catkin_INCLUDE_DIRS "") set(catkin_LIBRARIES "") set(catkin_LIBRARY_DIRS "") set(catkin_EXPORTED_TARGETS "") endif() endif() # increment recursion counter math(EXPR _CATKIN_FIND_ "${_CATKIN_FIND_} + 1") # find all components if(catkin_FIND_COMPONENTS) foreach(component ${catkin_FIND_COMPONENTS}) string(TOLOWER "${component}" component_lower) # skip catkin since it does not make sense as a component if(NOT ${component_lower} STREQUAL "catkin") # get search paths from CMAKE_PREFIX_PATH (which includes devel space) set(paths "") foreach(path ${CMAKE_PREFIX_PATH}) if(IS_DIRECTORY ${path}/share/${component}/cmake) list(APPEND paths ${path}/share/${component}/cmake) endif() endforeach() # find package component if(catkin_FIND_REQUIRED) # try without REQUIRED first find_package(${component} NO_MODULE PATHS ${paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) if(NOT ${component}_FOUND) # show better message to help users with the CMake error message coming up message(STATUS "Could not find the required component '${component}'. " "The following CMake error indicates that you either need to install the package " "with the same name or change your environment so that it can be found.") find_package(${component} REQUIRED NO_MODULE PATHS ${paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) endif() elseif(catkin_FIND_QUIETLY) find_package(${component} QUIET NO_MODULE PATHS ${paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) else() find_package(${component} NO_MODULE PATHS ${paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) endif() # append component-specific variables to catkin_* variables list_append_unique(catkin_INCLUDE_DIRS ${${component}_INCLUDE_DIRS}) # merge build configuration keywords with library names to correctly deduplicate catkin_pack_libraries_with_build_configuration(catkin_LIBRARIES ${catkin_LIBRARIES}) catkin_pack_libraries_with_build_configuration(_libraries ${${component}_LIBRARIES}) list_append_deduplicate(catkin_LIBRARIES ${_libraries}) # undo build configuration keyword merging after deduplication catkin_unpack_libraries_with_build_configuration(catkin_LIBRARIES ${catkin_LIBRARIES}) list_append_unique(catkin_LIBRARY_DIRS ${${component}_LIBRARY_DIRS}) list(APPEND catkin_EXPORTED_TARGETS ${${component}_EXPORTED_TARGETS}) endif() endforeach() list_insert_in_workspace_order(catkin_INCLUDE_DIRS ${catkin_INCLUDE_DIRS}) list_insert_in_workspace_order(catkin_LIBRARY_DIRS ${catkin_LIBRARY_DIRS}) endif() # add dummy target to catkin_EXPORTED_TARGETS if empty if(NOT catkin_EXPORTED_TARGETS) if(NOT TARGET _catkin_empty_exported_target) add_custom_target(_catkin_empty_exported_target) endif() list(APPEND catkin_EXPORTED_TARGETS _catkin_empty_exported_target) endif() # decrement recursion counter math(EXPR _CATKIN_FIND_ "${_CATKIN_FIND_} - 1") if(_CATKIN_FIND_ EQUAL 0) # store found components (from the fist level only) for validation in catkin_package() that they are build dependencies list(APPEND catkin_ALL_FOUND_COMPONENTS ${catkin_FIND_COMPONENTS}) endif() catkin-0.8.0/cmake/catkin_add_env_hooks.cmake000066400000000000000000000141451361264727400212270ustar00rootroot00000000000000# # Register environment hooks which are executed by the setup script. # # For each shell in ``SHELLS``, the macro searches for one of the # following files in the directory ``DIRECTORY``: # ``.``, # ``...em``, # ``..em``, # ``...in`` or # ``..in``. # # Plain shells, will be copied to, templates are expanded to # ``etc/catkin/profile.d/``, where it will be read by global generated # ``setup.``. # # The templates can also distinguish between devel- and installspace # using the boolean variables ``DEVELSPACE`` and ``INSTALLSPACE`` # which are either ``true`` or ``false``. # E.g. @[if DEVELSPACE]@ ... @[end if]@ for .em # # .. note:: Note that the extra extensions must appear in the filename # but must not appear in the argument. # # .. note:: These files will share a single directory with other # packages that choose to install env hooks. Be careful to give # the file a unique name. Typically ``NN.name.`` is used, # where NN can define when something should be run (the files are # read in alphanumeric order) and the name serves to disambiguate # in the event of collisions. # # Example:: # # catkin_add_env_hooks(my_prefix SHELLS bash tcsh zsh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks) # # looks for files env-hooks/my_prefix.[bash|tcsh|zsh]((.(devel|install)space)?.[em|in])? # # The environment hooks are installed into two destinations: # * ``etc/catkin/profile.d`` where they can be sourced efficiently by the # catkin generated ``setup.`` scripts # * ``share/${PROJECT_NAME}/catkin_env_hook`` where they can be sourced # efficiently on a per-package base # # :param file_prefix: the filename prefix # :type file_prefix: string # :param SHELLS: the shell extensions (e.g.: sh bat bash zsh tcsh) # :type SHELLS: list of strings # :param DIRECTORY: the directory (default: ${CMAKE_CURRENT_SOURCE_DIR}) # :type DIRECTORY: string # :param SKIP_INSTALL: if specified the env hooks are only generated # in the devel space but not installed # :type SKIP_INSTALL: option # # @public # function(catkin_add_env_hooks file_prefix) cmake_parse_arguments(ARG "SKIP_INSTALL" "DIRECTORY" "SHELLS" ${ARGN}) # create directory if necessary if(NOT IS_DIRECTORY ${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d) file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d) endif() if(NOT ARG_DIRECTORY) set(ARG_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() foreach(shell ${ARG_SHELLS}) set(ENV_HOOK ${file_prefix}.${shell}) set(base ${ARG_DIRECTORY}/${ENV_HOOK}) # generate environment hook for devel space set(DEVELSPACE True) set(INSTALLSPACE False) if(EXISTS ${base}.em OR EXISTS ${base}.develspace.em) # evaluate em template if(EXISTS ${base}.develspace.em) set(em_template ${base}.develspace.em) else() set(em_template ${base}.em) endif() em_expand(${catkin_EXTRAS_DIR}/templates/env-hook.context.py.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${ENV_HOOK}.develspace.context.py ${em_template} ${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d/${ENV_HOOK}) elseif(EXISTS ${base}.in OR EXISTS ${base}.develspace.in) # evaluate in template if(EXISTS ${base}.develspace.in) set(in_template ${base}.develspace.in) else() set(in_template ${base}.in) endif() atomic_configure_file(${in_template} ${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d/${ENV_HOOK} @ONLY) elseif (EXISTS ${base}) # copy plain file file(COPY ${base} DESTINATION ${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d) else() message(FATAL_ERROR "catkin_add_env_hooks() could not find environment hook. Either '${base}', '${base}.em', '${base}.develspace.em' or '${base}.in' must exist.") endif() # generate and install environment hook for installspace set(DEVELSPACE False) set(INSTALLSPACE True) if(EXISTS ${base}.em OR EXISTS ${base}.installspace.em) # evaluate em template and install if(EXISTS ${base}.installspace.em) set(em_template ${base}.installspace.em) else() set(em_template ${base}.em) endif() em_expand(${catkin_EXTRAS_DIR}/templates/env-hook.context.py.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${ENV_HOOK}.installspace.context.py ${em_template} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK}) if(NOT ${ARG_SKIP_INSTALL}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK} DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK} DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook) endif() elseif(EXISTS ${base}.in OR EXISTS ${base}.installspace.in) # evaluate in template and install if(EXISTS ${base}.installspace.in) set(in_template ${base}.installspace.in) else() set(in_template ${base}.in) endif() configure_file(${in_template} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK} @ONLY) if(NOT ${ARG_SKIP_INSTALL}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK} DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK} DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook) endif() elseif (EXISTS ${base}) # install plain file if(NOT ${ARG_SKIP_INSTALL}) install(FILES ${base} DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d) install(FILES ${base} DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook) endif() endif() endforeach() # refresh environment cache safe_execute_process(COMMAND ${GENERATE_ENVIRONMENT_CACHE_COMMAND}) endfunction() catkin-0.8.0/cmake/catkin_destinations.cmake000066400000000000000000000055011361264727400211240ustar00rootroot00000000000000# # Set several path suffixes for install destinations. # # :outvar CATKIN_PACKAGE_BIN_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_BIN_DESTINATION`. # :outvar CATKIN_PACKAGE_ETC_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_ETC_DESTINATION`. # :outvar CATKIN_PACKAGE_INCLUDE_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_INCLUDE_DESTINATION`. # :outvar CATKIN_PACKAGE_LIB_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_LIB_DESTINATION`. # :outvar CATKIN_PACKAGE_PYTHON_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_PYTHON_DESTINATION`. # :outvar CATKIN_PACKAGE_SHARE_DESTINATION: # See :cmake:data:`CATKIN_PACKAGE_SHARE_DESTINATION`. # # :outvar CATKIN_GLOBAL_BIN_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_BIN_DESTINATION`. # :outvar CATKIN_GLOBAL_ETC_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_ETC_DESTINATION`. # :outvar CATKIN_GLOBAL_INCLUDE_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_INCLUDE_DESTINATION`. # :outvar CATKIN_GLOBAL_LIB_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_LIB_DESTINATION`. # :outvar CATKIN_GLOBAL_LIBEXEC_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_LIBEXEC_DESTINATION`. # :outvar CATKIN_GLOBAL_PYTHON_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_PYTHON_DESTINATION`. # :outvar CATKIN_GLOBAL_SHARE_DESTINATION: # See :cmake:data:`CATKIN_GLOBAL_SHARE_DESTINATION`. # macro(catkin_destinations) # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "catkin_destinations() PROJECT_NAME is not set. You must call project() before you can call catkin_destinations().") endif() # execute catkin_destinations() only once, skip repeated invocations if(NOT DEFINED _${PROJECT_NAME}_CATKIN_DESTINATIONS) debug_message(10 "catkin_destinations()") # mark that catkin_destinations() was called set(_${PROJECT_NAME}_CATKIN_DESTINATIONS TRUE) # set project specific install destinations set(CATKIN_PACKAGE_BIN_DESTINATION ${CATKIN_GLOBAL_LIBEXEC_DESTINATION}/${PROJECT_NAME}) set(CATKIN_PACKAGE_ETC_DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/${PROJECT_NAME}) set(CATKIN_PACKAGE_INCLUDE_DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/${PROJECT_NAME}) set(CATKIN_PACKAGE_LIB_DESTINATION ${CATKIN_GLOBAL_LIB_DESTINATION}) set(CATKIN_PACKAGE_PYTHON_DESTINATION ${CATKIN_GLOBAL_PYTHON_DESTINATION}/${PROJECT_NAME}) set(CATKIN_PACKAGE_SHARE_DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}) # set project specific output directory for libraries set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}) # set project specific output directory for binaries set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}) endif() endmacro() catkin-0.8.0/cmake/catkin_download.cmake000066400000000000000000000043411361264727400202300ustar00rootroot00000000000000# # Download a file containing data from a URL. # # It is commonly used to download larger data files which should not be # stored in the repository. # # .. note:: It is not recommended to rely on downloaded data during # a configure / make cycle since this prevents building the package # when no network connectivity is available. # # .. note:: The target will be registered as a dependency # of the "download_extra_data" target. # # :param target: the target name # :type target: string # :param url: the url to download # :type url: string # # :param DESTINATION: the directory where the file is downloaded to # (default: ${PROJECT_BINARY_DIR}) # :type DESTINATION: string # :param FILENAME: the filename of the downloaded file # (default: the basename of the url) # :type FILENAME: string # :param MD5: the expected md5 hash to compare against # (default: empty, skipping the check) # :type MD5: string # # Additionally, options EXCLUDE_FROM_ALL and REQUIRED can be specified. # # @public function(catkin_download target url) cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;REQUIRED" "DESTINATION;FILENAME;MD5" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_download() called with unused arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_DESTINATION) set(ARG_DESTINATION ${PROJECT_BINARY_DIR}) endif() if(NOT ARG_FILENAME) get_filename_component(ARG_FILENAME ${url} NAME) endif() set(required "") if(NOT ARG_REQUIRED) set(required "--ignore-error") endif() set(output "${ARG_DESTINATION}/${ARG_FILENAME}") # With this, the command is always called, even when the output is up to date. # this is because we want to check the md5 sum if it's given, and redownload # the target if the md5 sum does not match. add_custom_target(${target} COMMAND ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/test/download_checkmd5.py ${url} ${output} ${ARG_MD5} ${required} VERBATIM) if(ARG_EXCLUDE_FROM_ALL) set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL TRUE) endif() if(TARGET download_extra_data) add_dependencies(download_extra_data ${target}) endif() endfunction() if(NOT TARGET download_extra_data) add_custom_target(download_extra_data) endif() catkin-0.8.0/cmake/catkin_generate_environment.cmake000066400000000000000000000140471361264727400226430ustar00rootroot00000000000000function(catkin_generate_environment) set(SETUP_FILENAME "setup") # devel space set(SETUP_DIR ${CATKIN_DEVEL_PREFIX}) # generate empty file to prevent searching for packages in binary dir # except if source space and build space are identical (which is the case for dry eclipse projects) if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") file(WRITE "${CMAKE_BINARY_DIR}/CATKIN_IGNORE" "") endif() # get multiarch name set(CATKIN_LIB_ENVIRONMENT_PATHS "'${CATKIN_GLOBAL_LIB_DESTINATION}'") set(CATKIN_PKGCONFIG_ENVIRONMENT_PATHS "os.path.join('${CATKIN_GLOBAL_LIB_DESTINATION}', 'pkgconfig')") if (UNIX AND NOT APPLE) # Two step looking for multiarch support: check for gcc -print-multiarch # and, if failed, try to run dpkg-architecture execute_process(COMMAND gcc -print-multiarch OUTPUT_VARIABLE CATKIN_MULTIARCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) if ("${CATKIN_MULTIARCH}" STREQUAL "") execute_process(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH OUTPUT_VARIABLE CATKIN_MULTIARCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) endif() if (NOT "${CATKIN_MULTIARCH}" STREQUAL "") set(CATKIN_LIB_ENVIRONMENT_PATHS "[${CATKIN_LIB_ENVIRONMENT_PATHS}, os.path.join('${CATKIN_GLOBAL_LIB_DESTINATION}', '${CATKIN_MULTIARCH}')]") set(CATKIN_PKGCONFIG_ENVIRONMENT_PATHS "[${CATKIN_PKGCONFIG_ENVIRONMENT_PATHS}, os.path.join('${CATKIN_GLOBAL_LIB_DESTINATION}', '${CATKIN_MULTIARCH}', 'pkgconfig')]") endif() endif() # generate Python setup util atomic_configure_file(${catkin_EXTRAS_DIR}/templates/_setup_util.py.in ${CATKIN_DEVEL_PREFIX}/_setup_util.py @ONLY) if(NOT WIN32) # non-windows # generate env atomic_configure_file(${catkin_EXTRAS_DIR}/templates/env.sh.in ${CATKIN_DEVEL_PREFIX}/env.sh @ONLY) # generate setup for various shells foreach(shell bash sh zsh) atomic_configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in ${CATKIN_DEVEL_PREFIX}/setup.${shell} @ONLY) atomic_configure_file(${catkin_EXTRAS_DIR}/templates/local_setup.${shell}.in ${CATKIN_DEVEL_PREFIX}/local_setup.${shell} @ONLY) endforeach() else() # windows # generate env atomic_configure_file(${catkin_EXTRAS_DIR}/templates/env.bat.in ${CATKIN_DEVEL_PREFIX}/env.bat @ONLY) # generate setup atomic_configure_file(${catkin_EXTRAS_DIR}/templates/setup.bat.in ${CATKIN_DEVEL_PREFIX}/setup.bat @ONLY) atomic_configure_file(${catkin_EXTRAS_DIR}/templates/local_setup.bat.in ${CATKIN_DEVEL_PREFIX}/local_setup.bat @ONLY) endif() # generate rosinstall file referencing setup.sh atomic_configure_file(${catkin_EXTRAS_DIR}/templates/rosinstall.in ${CATKIN_DEVEL_PREFIX}/.rosinstall @ONLY) # installspace set(SETUP_DIR ${CMAKE_INSTALL_PREFIX}) if(CATKIN_INSTALL_INTO_PREFIX_ROOT) # install empty workspace marker if it doesn't already exist install(CODE " if (NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\") file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\") endif() if (NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/.catkin\") file(WRITE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/.catkin\" \"\") endif()") # generate and install Python setup util configure_file(${catkin_EXTRAS_DIR}/templates/_setup_util.py.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/_setup_util.py @ONLY) catkin_install_python(PROGRAMS ${CMAKE_BINARY_DIR}/catkin_generated/installspace/_setup_util.py DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() if(NOT WIN32) # non-windows # generate and install env configure_file(${catkin_EXTRAS_DIR}/templates/env.sh.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.sh @ONLY) if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(PROGRAMS ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.sh DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() # generate and install setup for various shells foreach(shell bash sh zsh) configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell} @ONLY) configure_file(${catkin_EXTRAS_DIR}/templates/local_setup.${shell}.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.${shell} @ONLY) if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(FILES ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell} ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.${shell} DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() endforeach() else() # windows # generate and install env configure_file(${catkin_EXTRAS_DIR}/templates/env.bat.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.bat @ONLY) install(PROGRAMS ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.bat DESTINATION ${CMAKE_INSTALL_PREFIX}) # generate and install setup configure_file(${catkin_EXTRAS_DIR}/templates/setup.bat.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.bat @ONLY) configure_file(${catkin_EXTRAS_DIR}/templates/local_setup.bat.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.bat @ONLY) install(FILES ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.bat ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.bat DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() # generate rosinstall file referencing setup.sh configure_file(${catkin_EXTRAS_DIR}/templates/rosinstall.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/.rosinstall @ONLY) if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(FILES ${CMAKE_BINARY_DIR}/catkin_generated/installspace/.rosinstall DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() endfunction() catkin-0.8.0/cmake/catkin_install_python.cmake000066400000000000000000000072651361264727400215000ustar00rootroot00000000000000# # Install Python files and update their shebang lines # to use a different Python executable. # # The signature: # # catkin_install_python(PROGRAMS files... DESTINATION [OPTIONAL]) # # See the documentation for CMake install() function for more information. # # @public # function(catkin_install_python signature) string(TOUPPER "${signature}" signature) if(NOT "${signature}" STREQUAL "PROGRAMS") message(FATAL_ERROR "catkin_install_python() only supports the PROGRAMS signature (not '${signature}').") endif() cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION" "" ${ARGN}) if(NOT ARG_DESTINATION) message(FATAL_ERROR "catkin_install_python() called without required DESTINATION argument.") endif() foreach(source_file ${ARG_UNPARSED_ARGUMENTS}) if(NOT IS_ABSOLUTE ${source_file}) set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${source_file}") endif() if(EXISTS ${source_file}) stamp(${source_file}) # read file and check shebang line file(READ ${source_file} data) set(regex "^#!/([^\r\n]+)/env python([\r\n])") string(REGEX MATCH "${regex}" shebang_line "${data}") string(LENGTH "${shebang_line}" length) string(SUBSTRING "${data}" 0 ${length} prefix) if("${shebang_line}" STREQUAL "${prefix}") # write modified file with modified shebang line get_filename_component(python_name ${PYTHON_EXECUTABLE} NAME) string(REGEX REPLACE "${regex}" "#!/\\1/env ${python_name}\\2" data "${data}") get_filename_component(filename ${source_file} NAME) set(rewritten_file "${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace") file(MAKE_DIRECTORY ${rewritten_file}) set(rewritten_file "${rewritten_file}/${filename}") file(WRITE ${rewritten_file} "${data}") else() # Shebang did not match, install file unmodified set(rewritten_file "${source_file}") endif() # install (modified) file to destination set(optional_flag "") if(ARG_OPTIONAL) set(optional_flag "OPTIONAL") endif() # Install copy of file with re-written shebang to install space install(PROGRAMS "${rewritten_file}" DESTINATION "${ARG_DESTINATION}" ${optional_flag}) # Hook for a platform specific wrapper around the modified python script get_filename_component(name "${rewritten_file}" NAME) add_python_executable(SCRIPT_NAME ${name} # prefix with project name to avoid collisions across packages TARGET_NAME ${PROJECT_NAME}_${name}_exec_install_python DESTINATION "${ARG_DESTINATION}") # Create devel-space wrapper if the destination is relative to the install prefix if(NOT IS_ABSOLUTE ${ARG_DESTINATION}) message(STATUS "Installing devel-space wrapper ${source_file} to ${CATKIN_DEVEL_PREFIX}/${ARG_DESTINATION}") # Create wrapper in devel space that uses source_file with correct shebang set(PYTHON_SCRIPT ${source_file}) atomic_configure_file(${catkin_EXTRAS_DIR}/templates/script.py.in ${CATKIN_DEVEL_PREFIX}/${ARG_DESTINATION}/${name} @ONLY) # Hook for a platform specific wrapper around the modified python script add_python_executable(SCRIPT_NAME ${name} # prefix with project name to avoid collisions across packages # cip: avoid conflicting with targets created for scripts installed via setup.py TARGET_NAME ${PROJECT_NAME}_${name}_exec_cip_devel_python DESTINATION "${CATKIN_DEVEL_PREFIX}/${ARG_DESTINATION}") endif() elseif(NOT ARG_OPTIONAL) message(FATAL_ERROR "catkin_install_python() called with non-existing file '${source_file}'.") endif() endforeach() endfunction() catkin-0.8.0/cmake/catkin_libraries.cmake000066400000000000000000000163271361264727400204040ustar00rootroot00000000000000set(CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR ":") # # Filter libraries based on optional build configuration keywords. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries # :type ARGN: list of strings # :param BUILD_TYPE: a keyword for the build type (default: # ``CMAKE_BUILD_TYPE``) # :type BUILD_TYPE: list of strings # # @public # function(catkin_filter_libraries_for_build_configuration VAR) cmake_parse_arguments(ARG "" "BUILD_TYPE" "" ${ARGN}) if(NOT ARG_BUILD_TYPE) set(ARG_BUILD_TYPE ${CMAKE_BUILD_TYPE}) endif() if(NOT ARG_BUILD_TYPE) set(ARG_BUILD_TYPE "Debug") endif() set(result "") list(LENGTH ARG_UNPARSED_ARGUMENTS _count) set(_index 0) while(${_index} LESS ${_count}) list(GET ARG_UNPARSED_ARGUMENTS ${_index} lib) if("${lib}" STREQUAL "debug") if(NOT "${ARG_BUILD_TYPE}" STREQUAL "Debug") # skip keyword and debug library for non-debug builds math(EXPR _index "${_index} + 1") if(${_index} EQUAL ${_count}) message(FATAL_ERROR "catkin_filter_libraries_for_build_configuration() the list of libraries '${ARG_UNPARSED_ARGUMENTS}' ends with '${lib}' which is a build configuration keyword and must be followed by a library") endif() endif() elseif("${lib}" STREQUAL "optimized") if("${ARG_BUILD_TYPE}" STREQUAL "Debug") # skip keyword and non-debug library for debug builds math(EXPR _index "${_index} + 1") if(${_index} EQUAL ${_count}) message(FATAL_ERROR "catkin_filter_libraries_for_build_configuration() the list of libraries '${ARG_UNPARSED_ARGUMENTS}' ends with '${lib}' which is a build configuration keyword and must be followed by a library") endif() endif() elseif("${lib}" STREQUAL "general") # just consume the keyword if(${_index} EQUAL ${_count}) message(FATAL_ERROR "catkin_package() the list of libraries '${ARG_UNPARSED_ARGUMENTS}' ends with '${lib}' which is a build configuration keyword and must be followed by a library") endif() else() list(APPEND result "${lib}") endif() math(EXPR _index "${_index} + 1") endwhile() debug_message(10 "catkin_filter_libraries_for_build_configuration(${VAR} ${ARG_UNPARSED_ARGUMENTS} BUILD_TYPE ${ARG_BUILD_TYPE}) ${result}") set(${VAR} "${result}" PARENT_SCOPE) endfunction() # # Pack a list of libraries with optional build configuration keywords. # Each keyword is joined with its library using a separator. # A packed library list can be deduplicated correctly. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries # :type ARGN: list of strings # # @public # function(catkin_pack_libraries_with_build_configuration VAR) set(result "") set(_argn ${ARGN}) list(LENGTH _argn _count) set(_index 0) while(${_index} LESS ${_count}) list(GET _argn ${_index} lib) if("${lib}" MATCHES "^(debug|optimized|general)$") math(EXPR _index "${_index} + 1") if(${_index} EQUAL ${_count}) message(FATAL_ERROR "catkin_pack_libraries_with_build_configuration() the list of libraries '${_argn}' ends with '${lib}' which is a build configuration keyword and must be followed by a library") endif() list(GET _argn ${_index} library) list(APPEND result "${lib}${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}") else() list(APPEND result "${lib}") endif() math(EXPR _index "${_index} + 1") endwhile() #debug_message(10 "catkin_pack_libraries_with_build_configuration(${VAR} ${_argn}) ${result}") set(${VAR} "${result}" PARENT_SCOPE) endfunction() # # Unpack a list of libraries with optional build configuration keyword prefixes. # Libraries prefixed with a keyword are split into the keyword and the library. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries # :type ARGN: list of strings # # @public # function(catkin_unpack_libraries_with_build_configuration VAR) set(result "") foreach(lib ${ARGN}) string(REGEX REPLACE "^(debug|optimized|general)${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" lib "${lib}") list(APPEND result "${lib}") endforeach() #set(_argn ${ARGN}) #debug_message(10 "catkin_unpack_libraries_with_build_configuration(${VAR} ${_argn}) ${result}") set(${VAR} "${result}" PARENT_SCOPE) endfunction() # # Replace imported library target names with the library name. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries # :type ARGN: list of strings # # @public # function(catkin_replace_imported_library_targets VAR) set(result "") foreach(lib ${ARGN}) if((NOT "${lib}" MATCHES "^(debug|optimized|general)$") AND TARGET ${lib}) # sometimes cmake dependencies define imported targets, in which # case the imported library information is not the target name, but # the information embedded in cmake properties inside the imported library # For interface libraries, this is the INTERFACE_LINK_LIBRARIES property. # For regular imported libraries, this is IMPORTED_LOCATION(_$CONFIG). get_target_property(${lib}_type ${lib} TYPE) get_target_property(${lib}_imported ${lib} IMPORTED) if(${${lib}_type} STREQUAL "INTERFACE_LIBRARY") get_target_property(${lib}_interface_link_libraries ${lib} INTERFACE_LINK_LIBRARIES) if(${lib}_interface_link_libraries) catkin_replace_imported_library_targets(${lib}_resolved_libs ${${lib}_interface_link_libraries}) list(APPEND result ${${lib}_resolved_libs}) endif() elseif(${${lib}_imported}) set(imported_libraries) # empty list get_target_property(${lib}_imported_location ${lib} IMPORTED_LOCATION) if(${lib}_imported_location) list(APPEND imported_libraries ${${lib}_imported_location}) else() get_target_property(${lib}_imported_configurations ${lib} IMPORTED_CONFIGURATIONS) foreach(cfg ${${lib}_imported_configurations}) if(WIN32) # check both locations (imported dll and static lib) on Windows # otherwise, for packages exporting static lib, the lib path won't be published correctly to downstream get_target_property(${lib}_imported_location_${cfg} ${lib} IMPORTED_IMPLIB_${cfg}) if(NOT ${lib}_imported_location_${cfg}) get_target_property(${lib}_imported_location_${cfg} ${lib} IMPORTED_LOCATION_${cfg}) endif() else() get_target_property(${lib}_imported_location_${cfg} ${lib} IMPORTED_LOCATION_${cfg}) endif() if(${lib}_imported_location_${cfg}) list(APPEND imported_libraries ${${lib}_imported_location_${cfg}}) endif() endforeach() endif() foreach(imp_lib ${imported_libraries}) list(APPEND result "${imp_lib}") endforeach() else() # not an imported library target list(APPEND result "${lib}") endif() else() list(APPEND result "${lib}") endif() endforeach() #set(_argn ${ARGN}) #debug_message(10 "catkin_replace_imported_library_targets(${VAR} ${_argn}) ${result}") set(${VAR} "${result}" PARENT_SCOPE) endfunction() catkin-0.8.0/cmake/catkin_metapackage.cmake000066400000000000000000000031641361264727400206650ustar00rootroot00000000000000# # It installs the package.xml file of a metapackage. # # .. note:: It must be called once for each metapackage. Best # practice is to call this macro early in your root CMakeLists.txt, # immediately after calling ``project()`` and # ``find_package(catkin REQUIRED)``. # # :param DIRECTORY: the path to the package.xml file if not in the same # location as the CMakeLists.txt file # :type DIRECTORY: string # # @public # function(catkin_metapackage) cmake_parse_arguments(ARG "" "DIRECTORY" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_metapackage() called with unused arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "catkin_metapackage() PROJECT_NAME is not set. You must call project() before calling catkin_metapackage().") endif() if(PROJECT_NAME STREQUAL "Project") 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().") endif() debug_message(10 "catkin_metapackage() called in file ${CMAKE_CURRENT_LIST_FILE}") if(NOT ARG_DIRECTORY) if(${CMAKE_CURRENT_LIST_FILE} STREQUAL ${CMAKE_BINARY_DIR}/catkin_generated/metapackages/${PROJECT_NAME}/CMakeLists.txt) set(ARG_DIRECTORY ${CMAKE_SOURCE_DIR}/${path}) else() set(ARG_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() endif() catkin_package_xml(DIRECTORY ${ARG_DIRECTORY}) # install package.xml install(FILES ${ARG_DIRECTORY}/package.xml DESTINATION share/${PROJECT_NAME} ) endfunction() catkin-0.8.0/cmake/catkin_package.cmake000066400000000000000000000615171361264727400200240ustar00rootroot00000000000000# # It installs the package.xml file, and it generates code for # ``find_package`` and ``pkg-config`` so that other packages can get # information about this package. For this purpose the information # about include directories, libraries, further dependencies and # CMake variables are used. # # .. note:: It must be called once for each package. It is indirectly # calling``catkin_destinations()`` which will provide additional # output variables. Please make sure to call ``catkin_package()`` # before using those variables. # # :param INCLUDE_DIRS: ``CMAKE_CURRENT_SOURCE_DIR``-relative paths to # C/C++ includes # :type INCLUDE_DIRS: list of strings # :param LIBRARIES: names of library targets that will appear in the # ``catkin_LIBRARIES`` and ``${PROJECT_NAME}_LIBRARIES`` of other # projects that search for you via ``find_package``. Currently # this will break if the logical target names are not the same as # the installed names. # :type LIBRARIES: list of strings # :param CATKIN_DEPENDS: a list of catkin projects which this project # depends on. It is used when client code finds this project via # ``find_package()`` or ``pkg-config``. Each project listed will in # turn be ``find_package``\ -ed or is states as ``Requires`` in the # .pc file. Therefore their ``INCLUDE_DIRS`` and ``LIBRARIES`` will # be appended to ours. Only catkin projects should be used where it # be guarantee that they are *find_packagable* and have pkg-config # files. # :type CATKIN_DEPENDS: list of strings # :param DEPENDS: a list of CMake projects which this project depends # on. Since they might not be *find_packagable* or lack a pkg-config # file their ``INCLUDE_DIRS`` and ``LIBRARIES`` are passed directly. # This requires that it has been ``find_package``\ -ed before and all # variables (``_FOUND``, ``_INCLUDE_DIRS``, etc.) have the # same case as this argument. # :type DEPENDS: list of strings # :param CFG_EXTRAS: a CMake file containing extra stuff that should # be accessible to users of this package after # ``find_package``\ -ing it. This file must live in the # subdirectory ``cmake`` or be an absolute path. # All passed extra files must have unique basenames since they are # being installed into a single folder. # Various additional file extension are possible: # for a plain cmake file just ``.cmake``, for files expanded using # CMake's ``configure_file()`` use ``.cmake.in`` or for files expanded # by empy use ``.cmake.em``. The templates can distinguish between # devel- and installspace using the boolean variables ``DEVELSPACE`` # and ``INSTALLSPACE``. For templated files it is also possible to # use the extensions ``.cmake.develspace.(in|em)`` or # ``.cmake.installspace.(em|in)`` to generate the files only for a # specific case. # If the global variable ${PROJECT_NAME}_CFG_EXTRAS is set it will be # prepended to the explicitly passed argument. # :type CFG_EXTRAS: string # :param EXPORTED_TARGETS: a list of target names which usually generate # code. Downstream packages can depend on these targets to ensure that # code is generated before it is being used. The generated CMake config # file will ensure that the targets exists. # If the global variable ${PROJECT_NAME}_EXPORTED_TARGETS is # set it will be prepended to the explicitly passed argument. # :type EXPORTED_TARGETS: list of strings # :param SKIP_CMAKE_CONFIG_GENERATION: the option to skip the generation # of the CMake config files for the package # :type SKIP_CMAKE_CONFIG_GENERATION: bool # :param SKIP_PKG_CONFIG_GENERATION: the option to skip the generation of # the pkg-config file for the package # :type SKIP_PKG_CONFIG_GENERATION: bool # # Example: # :: # # catkin_package( # INCLUDE_DIRS include # LIBRARIES projlib1 projlib2 # CATKIN_DEPENDS roscpp # DEPENDS Eigen # CFG_EXTRAS proj-extras[.cmake|.cmake.in|.cmake(.develspace|.installspace)?.em] # ) # # @public # macro(catkin_package) debug_message(10 "catkin_package() called in file ${CMAKE_CURRENT_LIST_FILE}") # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "catkin_package() PROJECT_NAME is not set. You must call project() before calling catkin_package().") endif() if(PROJECT_NAME STREQUAL "Project") message(FATAL_ERROR "catkin_package() PROJECT_NAME is set to 'Project', which is not a valid project name. You must call project() before calling catkin_package().") endif() # mark that catkin_package() was called in order to detect wrong order of calling with generate_messages() set(${PROJECT_NAME}_CATKIN_PACKAGE TRUE) # call catkin_package_xml() if it has not been called before if(NOT _CATKIN_CURRENT_PACKAGE) catkin_package_xml() endif() _catkin_package(${ARGN}) endmacro() function(_catkin_package) cmake_parse_arguments(PROJECT "SKIP_CMAKE_CONFIG_GENERATION;SKIP_PKG_CONFIG_GENERATION" "" "INCLUDE_DIRS;LIBRARIES;CATKIN_DEPENDS;DEPENDS;CFG_EXTRAS;EXPORTED_TARGETS" ${ARGN}) if(PROJECT_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_package() called with unused arguments: ${PROJECT_UNPARSED_ARGUMENTS}") endif() if(NOT ${PROJECT_NAME} STREQUAL "catkin") list(FIND ${PROJECT_NAME}_BUILDTOOL_DEPENDS "catkin" _index) if(_index EQUAL -1) list(FIND ${PROJECT_NAME}_BUILD_DEPENDS "catkin" _index) if(_index EQUAL -1) message(FATAL_ERROR "catkin_package() 'catkin' must be listed as a buildtool dependency in the package.xml") endif() message("WARNING: 'catkin' should be listed as a buildtool dependency in the package.xml (instead of build dependency)") endif() endif() # prepend INCLUDE_DIRS and LIBRARIES passed using a variable if(${PROJECT_NAME}_INCLUDE_DIRS) list(INSERT PROJECT_INCLUDE_DIRS 0 ${${PROJECT_NAME}_INCLUDE_DIRS}) endif() if(${PROJECT_NAME}_LIBRARIES) list(INSERT PROJECT_LIBRARIES 0 ${${PROJECT_NAME}_LIBRARIES}) endif() # unset previously found directory of this package, so that this package overlays the other cleanly if(${PROJECT_NAME}_DIR) set(${PROJECT_NAME}_DIR "" CACHE PATH "" FORCE) endif() set(_PROJECT_CATKIN_DEPENDS ${PROJECT_CATKIN_DEPENDS}) set(PROJECT_DEPENDENCIES_INCLUDE_DIRS "") set(PROJECT_DEPENDENCIES_LIBRARIES "") foreach(depend ${PROJECT_DEPENDS}) string(REPLACE " " ";" depend_list ${depend}) # check if the second argument is the COMPONENTS keyword list(LENGTH depend_list count) set(second_item "") if(${count} GREATER 1) list(GET depend_list 1 second_item) endif() if("${second_item}" STREQUAL "COMPONENTS") list(GET depend_list 0 depend_name) if(NOT ${depend_name}_FOUND) message(FATAL_ERROR "catkin_package() DEPENDS on '${depend}' which must be find_package()-ed before") endif() message(WARNING "catkin_package() DEPENDS on '${depend}' which is deprecated. find_package() it before and only DEPENDS on '${depend_name}' instead") list(APPEND PROJECT_DEPENDENCIES_INCLUDE_DIRS ${${depend_name}_INCLUDE_DIRS}) list(APPEND PROJECT_DEPENDENCIES_LIBRARIES ${${depend_name}_LIBRARIES}) else() # split multiple names (without COMPONENTS) into separate dependencies foreach(depend_name ${depend_list}) if(${depend_name}_FOUND_CATKIN_PROJECT) #message(WARNING "catkin_package() DEPENDS on catkin package '${depend_name}' which is deprecated. Use CATKIN_DEPENDS for catkin packages instead.") list(APPEND _PROJECT_CATKIN_DEPENDS ${depend_name}) else() # the dependency might not come from a CMake config / module file # but from e.g. PkgConfig / pkg_search_module # therefore this can't expect ${depend_name}_FOUND to be defined if(NOT DEFINED ${depend_name}_INCLUDE_DIRS AND NOT DEFINED ${depend_name}_LIBRARIES) message(WARNING "catkin_package() DEPENDS on '${depend_name}' but neither '${depend_name}_INCLUDE_DIRS' nor '${depend_name}_LIBRARIES' is defined.") endif() list(APPEND PROJECT_DEPENDENCIES_INCLUDE_DIRS ${${depend_name}_INCLUDE_DIRS}) list(APPEND PROJECT_DEPENDENCIES_LIBRARIES ${${depend_name}_LIBRARIES}) endif() endforeach() endif() endforeach() # for catkin packages it can be guaranteed that they are find_package()-able and have pkg-config files set(PROJECT_DEPENDENCIES "") foreach(depend_name ${_PROJECT_CATKIN_DEPENDS}) # verify that all catkin packages which have been find_package()-ed are listed as build dependencies if(${depend_name}_FOUND) # verify that these packages are really catkin packages if(NOT ${depend_name}_FOUND_CATKIN_PROJECT) if(DEFINED ${depend_name}_CONFIG) message(FATAL_ERROR "catkin_package() CATKIN_DEPENDS on '${depend_name}', which has been found in '${${depend_name}_CONFIG}', but it is not a catkin package") else() message(FATAL_ERROR "catkin_package() CATKIN_DEPENDS on '${depend_name}', but it is not a catkin package") endif() endif() if(catkin_ALL_FOUND_COMPONENTS) list(FIND catkin_ALL_FOUND_COMPONENTS ${depend_name} _index) else() set(_index -1) endif() if(NOT _index EQUAL -1) list(FIND ${PROJECT_NAME}_BUILD_DEPENDS ${depend_name} _index) if(_index EQUAL -1) message(FATAL_ERROR "catkin_package() the catkin package '${depend_name}' has been find_package()-ed but is not listed as a build dependency in the package.xml") endif() # verify versioned dependency constraints if(DEFINED ${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LT AND NOT "${${depend_name}_VERSION}" VERSION_LESS "${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LT}") message(WARNING "catkin_package() version mismatch: the package.xml of '${PROJECT_NAME}' build_depends on '${depend_name} < ${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LT}', but '${depend_name} ${${depend_name}_VERSION}' found") endif() if(DEFINED ${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LTE AND "${${depend_name}_VERSION}" VERSION_GREATER "${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LTE}") message(WARNING "catkin_package() version mismatch: the package.xml of '${PROJECT_NAME}' build_depends on '${depend_name} <= ${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_LTE}', but '${depend_name} ${${depend_name}_VERSION}' found") endif() if(DEFINED ${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_EQ AND NOT "${${depend_name}_VERSION}" VERSION_EQUAL "${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_EQ}") message(WARNING "catkin_package() version mismatch: the package.xml of '${PROJECT_NAME}' build_depends on '${depend_name} = ${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_EQ}', but '${depend_name} ${${depend_name}_VERSION}' found") endif() if(DEFINED ${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GTE AND "${${depend_name}_VERSION}" VERSION_LESS "${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GTE}") message(WARNING "catkin_package() version mismatch: the package.xml of '${PROJECT_NAME}' build_depends on '${depend_name} >= ${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GTE}', but '${depend_name} ${${depend_name}_VERSION}' found") endif() if(DEFINED ${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GT AND NOT "${${depend_name}_VERSION}" VERSION_GREATER "${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GT}") message(WARNING "catkin_package() version mismatch: the package.xml of '${PROJECT_NAME}' build_depends on '${depend_name} > ${${PROJECT_NAME}_BUILD_DEPENDS_${depend_name}_VERSION_GT}', but '${depend_name} ${${depend_name}_VERSION}' found") endif() endif() endif() # verify that all catkin packages are listed as run dependencies list(FIND ${PROJECT_NAME}_RUN_DEPENDS ${depend_name} _index) if(_index EQUAL -1) message(FATAL_ERROR "catkin_package() DEPENDS on the catkin package '${depend_name}' which must therefore be listed as a run dependency in the package.xml") endif() list(APPEND PROJECT_DEPENDENCIES ${depend_name}) endforeach() # package version provided by package.cmake/xml set(PROJECT_VERSION ${${PROJECT_NAME}_VERSION}) # flag if package is deprecated provided by package.cmake/xml set(PROJECT_DEPRECATED ${${PROJECT_NAME}_DEPRECATED}) # package maintainer provided by package.cmake/xml set(PROJECT_MAINTAINER ${${PROJECT_NAME}_MAINTAINER}) # urls provided by package.cmake/xml set(PROJECT_URL_WEBSITE ${${PROJECT_NAME}_URL_WEBSITE}) set(PROJECT_URL_BUGTRACKER ${${PROJECT_NAME}_URL_BUGTRACKER}) # get library paths from all workspaces set(lib_paths "") foreach(workspace ${CATKIN_WORKSPACES}) list_append_unique(lib_paths ${workspace}/lib) endforeach() # merge explicitly listed libraries and libraries from non-catkin but find_package()-ed packages set(_PKG_CONFIG_LIBRARIES "") if(PROJECT_LIBRARIES) list(APPEND _PKG_CONFIG_LIBRARIES ${PROJECT_LIBRARIES}) endif() if(PROJECT_DEPENDENCIES_LIBRARIES) list(APPEND _PKG_CONFIG_LIBRARIES ${PROJECT_DEPENDENCIES_LIBRARIES}) endif() # resolve imported library targets catkin_replace_imported_library_targets(_PKG_CONFIG_LIBRARIES ${_PKG_CONFIG_LIBRARIES}) # deduplicate libraries while maintaining build configuration keywords catkin_pack_libraries_with_build_configuration(_PKG_CONFIG_LIBRARIES ${_PKG_CONFIG_LIBRARIES}) set(PKG_CONFIG_LIBRARIES "") foreach(library ${_PKG_CONFIG_LIBRARIES}) list_append_deduplicate(PKG_CONFIG_LIBRARIES ${library}) endforeach() catkin_unpack_libraries_with_build_configuration(PKG_CONFIG_LIBRARIES ${PKG_CONFIG_LIBRARIES}) # .pc files can not handle build configuration keywords therefore filter them out based on the current build type set(PKG_CONFIG_LIBRARIES_WITH_PREFIX "") catkin_filter_libraries_for_build_configuration(libraries ${PKG_CONFIG_LIBRARIES}) foreach(library ${libraries}) if(NOT IS_ABSOLUTE ${library}) # Append -l to anything that's not a linker flag if(NOT ${library} MATCHES "^-") set(library "-l${library}") endif() endif() list_append_deduplicate(PKG_CONFIG_LIBRARIES_WITH_PREFIX ${library}) endforeach() # # DEVEL SPACE # # used in the cmake extra files set(DEVELSPACE TRUE) set(INSTALLSPACE FALSE) set(PROJECT_SPACE_DIR ${CATKIN_DEVEL_PREFIX}) set(PKG_INCLUDE_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}) # absolute path to include dirs and validate that they are existing either absolute or relative to packages source set(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS "") set(PROJECT_PKG_CONFIG_INCLUDE_DIRS "") foreach(idir ${PROJECT_INCLUDE_DIRS}) if(IS_ABSOLUTE ${idir}) if(IS_DIRECTORY ${idir}) set(include ${idir}) else() message(FATAL_ERROR "catkin_package() absolute include dir '${idir}' does not exist") endif() elseif(IS_DIRECTORY ${PKG_INCLUDE_PREFIX}/${idir}) set(include ${PKG_INCLUDE_PREFIX}/${idir}) else() message(FATAL_ERROR "catkin_package() include dir '${idir}' does not exist relative to '${PKG_INCLUDE_PREFIX}'") endif() list_append_unique(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS ${include}) list_append_unique(PROJECT_PKG_CONFIG_INCLUDE_DIRS ${include}) endforeach() if(PROJECT_DEPENDENCIES_INCLUDE_DIRS) list_append_unique(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS ${PROJECT_DEPENDENCIES_INCLUDE_DIRS}) list_append_unique(PROJECT_PKG_CONFIG_INCLUDE_DIRS ${PROJECT_DEPENDENCIES_INCLUDE_DIRS}) endif() # prepend library path of this workspace set(PKG_CONFIG_LIB_PATHS ${lib_paths}) list(INSERT PKG_CONFIG_LIB_PATHS 0 ${PROJECT_SPACE_DIR}/lib) set(PKG_CMAKE_DIR ${PROJECT_SPACE_DIR}/share/${PROJECT_NAME}/cmake) if("${PROJECT_NAME}" STREQUAL "catkin") set(PKG_CMAKE_DIR "${catkin_EXTRAS_DIR}") endif() if(NOT PROJECT_SKIP_PKG_CONFIG_GENERATION) # ensure that output folder exists file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig) # generate devel space pc for project em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.develspace.context.pc.py ${catkin_EXTRAS_DIR}/em/pkg.pc.em ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig/${PROJECT_NAME}.pc) endif() # generate devel space cfg-extras for project set(PKG_CFG_EXTRAS "") foreach(extra ${${PROJECT_NAME}_CFG_EXTRAS} ${PROJECT_CFG_EXTRAS}) if(IS_ABSOLUTE ${extra}) set(base ${extra}) get_filename_component(extra ${extra} NAME) else() set(base ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${extra}) endif() if(EXISTS ${base}.em OR EXISTS ${base}.develspace.em) if(EXISTS ${base}.develspace.em) set(em_template ${base}.develspace.em) else() set(em_template ${base}.em) endif() em_expand(${catkin_EXTRAS_DIR}/templates/cfg-extras.context.py.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${extra}.develspace.context.cmake.py ${em_template} ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra}) list(APPEND PKG_CFG_EXTRAS ${extra}) elseif(EXISTS ${base}.in OR EXISTS ${base}.develspace.in) if(EXISTS ${base}.develspace.in) set(in_template ${base}.develspace.in) else() set(in_template ${base}.in) endif() configure_file(${in_template} ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra} @ONLY ) list(APPEND PKG_CFG_EXTRAS ${extra}) elseif(EXISTS ${base}) list(APPEND PKG_CFG_EXTRAS ${base}) elseif(NOT EXISTS ${base}.installspace.em AND NOT EXISTS ${base}.installspace.in) message(FATAL_ERROR "catkin_package() could not find CFG_EXTRAS file. Either 'cmake/${extra}.develspace.em', 'cmake/${extra}.em', 'cmake/${extra}.develspace.in', 'cmake/${extra}.in', 'cmake/${extra}' or a variant specific to the installspace must exist.") endif() endforeach() if(NOT PROJECT_SKIP_CMAKE_CONFIG_GENERATION) set(PKG_EXPORTED_TARGETS ${${PROJECT_NAME}_EXPORTED_TARGETS} ${PROJECT_EXPORTED_TARGETS}) foreach(t ${PKG_EXPORTED_TARGETS}) if(NOT TARGET ${t}) message(FATAL_ERROR "catkin_package() could not find target '${t}' for code generation.") endif() endforeach() # generate devel space config for project set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in) if(NOT EXISTS ${infile}) set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in) endif() configure_file(${infile} ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config.cmake @ONLY ) # generate devel space config-version for project configure_file(${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config-version.cmake @ONLY ) endif() # # INSTALLSPACE # # used in the cmake extra files set(DEVELSPACE FALSE) set(INSTALLSPACE TRUE) set(PROJECT_SPACE_DIR ${CMAKE_INSTALL_PREFIX}) set(PKG_INCLUDE_PREFIX "\\\${prefix}") # absolute path to include dir under install prefix if any include dir is set set(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS "") set(PROJECT_PKG_CONFIG_INCLUDE_DIRS "") foreach(idir ${PROJECT_INCLUDE_DIRS}) # include dirs in source / build / devel space are handled like relative ones # since these files are supposed to be installed to the include folder in install space string_starts_with("${idir}/" "${CMAKE_CURRENT_SOURCE_DIR}/" _is_source_prefix) string_starts_with("${idir}/" "${CMAKE_CURRENT_BINARY_DIR}/" _is_build_prefix) string_starts_with("${idir}/" "${CATKIN_DEVEL_PREFIX}/" _is_devel_prefix) if(_is_source_prefix OR _is_build_prefix OR _is_devel_prefix) # generated header files should be places in the devel space rather then in the build space if(_is_build_prefix AND NOT _is_devel_prefix) message(WARNING "catkin_package() include dir '${idir}' should be placed in the devel space instead of the build space") endif() # the value doesn't matter as long as it doesn't match IS_ABSOLUTE set(idir "${CATKIN_GLOBAL_INCLUDE_DESTINATION}") endif() if(IS_ABSOLUTE ${idir}) list_append_unique(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS "${idir}") list_append_unique(PROJECT_PKG_CONFIG_INCLUDE_DIRS "${idir}") else() list_append_unique(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS "${CATKIN_GLOBAL_INCLUDE_DESTINATION}") list_append_unique(PROJECT_PKG_CONFIG_INCLUDE_DIRS "${PKG_INCLUDE_PREFIX}/${CATKIN_GLOBAL_INCLUDE_DESTINATION}") endif() endforeach() if(PROJECT_DEPENDENCIES_INCLUDE_DIRS) list_append_unique(PROJECT_CMAKE_CONFIG_INCLUDE_DIRS ${PROJECT_DEPENDENCIES_INCLUDE_DIRS}) list_append_unique(PROJECT_PKG_CONFIG_INCLUDE_DIRS ${PROJECT_DEPENDENCIES_INCLUDE_DIRS}) endif() # prepend library path of this workspace set(PKG_CONFIG_LIB_PATHS ${lib_paths}) list(INSERT PKG_CONFIG_LIB_PATHS 0 ${PROJECT_SPACE_DIR}/lib) # package cmake dir is the folder where the generated pkgConfig.cmake is located set(PKG_CMAKE_DIR "\${${PROJECT_NAME}_DIR}") if(NOT PROJECT_SKIP_PKG_CONFIG_GENERATION) # ensure that output folder exists file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace) # generate and install pc for project em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.installspace.context.pc.py ${catkin_EXTRAS_DIR}/em/pkg.pc.em ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig ) endif() # generate and install cfg-extras for project set(PKG_CFG_EXTRAS "") set(installable_cfg_extras "") foreach(extra ${${PROJECT_NAME}_CFG_EXTRAS} ${PROJECT_CFG_EXTRAS}) if(IS_ABSOLUTE ${extra}) set(base ${extra}) get_filename_component(extra ${extra} NAME) else() set(base ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${extra}) endif() if(EXISTS ${base}.em OR EXISTS ${base}.installspace.em) if(EXISTS ${base}.installspace.em) set(em_template ${base}.installspace.em) else() set(em_template ${base}.em) endif() em_expand(${catkin_EXTRAS_DIR}/templates/cfg-extras.context.py.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${extra}.installspace.context.cmake.py ${em_template} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${extra}) list(APPEND installable_cfg_extras ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${extra}) list(APPEND PKG_CFG_EXTRAS ${extra}) elseif(EXISTS ${base}.in OR EXISTS ${base}.installspace.in) if(EXISTS ${base}.installspace.in) set(in_template ${base}.installspace.in) else() set(in_template ${base}.in) endif() configure_file(${in_template} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${extra} @ONLY ) list(APPEND installable_cfg_extras ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${extra}) list(APPEND PKG_CFG_EXTRAS ${extra}) elseif(EXISTS ${base}) list(APPEND installable_cfg_extras ${base}) list(APPEND PKG_CFG_EXTRAS ${extra}) elseif(NOT EXISTS ${base}.develspace.em AND NOT EXISTS ${base}.develspace.in) message(FATAL_ERROR "catkin_package() could not find CFG_EXTRAS file. Either 'cmake/${extra}.installspace.em', 'cmake/${extra}.em', 'cmake/${extra}.installspace.in', 'cmake/${extra}.in', 'cmake/${extra}'or a variant specific to the develspace must exist.") endif() endforeach() install(FILES ${installable_cfg_extras} DESTINATION share/${PROJECT_NAME}/cmake ) if(NOT PROJECT_SKIP_CMAKE_CONFIG_GENERATION) # generate config for project set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in) if(NOT EXISTS ${infile}) set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in) endif() configure_file(${infile} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake @ONLY ) # generate config-version for project set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config-version.cmake.in) if(NOT EXISTS ${infile}) set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in) endif() configure_file(${infile} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake @ONLY ) # install config, config-version and cfg-extras for project install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake DESTINATION share/${PROJECT_NAME}/cmake ) endif() # install package.xml install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/package.xml DESTINATION share/${PROJECT_NAME} ) endfunction() catkin-0.8.0/cmake/catkin_package_xml.cmake000066400000000000000000000067721361264727400207060ustar00rootroot00000000000000# # Parse package.xml from ``CMAKE_CURRENT_SOURCE_DIR`` and # make several information available to CMake. # # .. note:: It is called automatically by ``catkin_package()`` if not # called manually before. It must be called once in each package, # after calling ``project()`` where the project name must match the # package name. The macro should only be called manually if the # variables are use to parameterize ``catkin_package()``. # # :param DIRECTORY: the directory of the package.xml (default # ``${CMAKE_CURRENT_SOURCE_DIR}``). # :type DIRECTORY: string # # :outvar _VERSION: the version number # :outvar _MAINTAINER: the name and email of the # maintainer(s) # :outvar _PACKAGE_FORMAT: the format version of the manifest # :outvar __DEPENDS: the dependencies of a specific # type, the following types are available: BUILD, BUILD_EXPORT, BUILDTOOL, # BUILDTOOL_EXPORT, EXEC, RUN, TEST, DOC # :outvar __DEPENDS__VERSION_: for # each dependency which has a version range specified the version number is # provided, the following version types are available: LT, LTE, EQ, GTE, GT # :outvar _URL_WEBSITE: the url(s) of type `website` # :outvar _URL_BUGTRACKER: the url(s) of type `bugtracker` # :outvar _URL_REPOSITORY: the url(s) of type `repository` # :outvar _DEPRECATED: `TRUE` if the package is deprecated # :outvar _CATKIN_CURRENT_PACKAGE: the name of the package from the # manifest # # .. note:: It is calling ``catkin_destinations()`` which will provide # additional output variables. # # @public # macro(catkin_package_xml) debug_message(10 "catkin_package_xml()") # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "catkin_package_xml() PROJECT_NAME is not set. You must call project() before you can call catkin_package_xml().") endif() # ensure that function is not called multiple times per package if(DEFINED _CATKIN_CURRENT_PACKAGE) message(FATAL_ERROR "catkin_package_xml(): in '${CMAKE_CURRENT_LIST_FILE}', _CATKIN_CURRENT_PACKAGE is already set (to: ${_CATKIN_CURRENT_PACKAGE}). Did you called catkin_package_xml() multiple times?") endif() _catkin_package_xml(${CMAKE_CURRENT_BINARY_DIR}/catkin_generated ${ARGN}) # verify that the package name from package.xml equals the project() name if(NOT _CATKIN_CURRENT_PACKAGE STREQUAL PROJECT_NAME) message(FATAL_ERROR "catkin_package_xml() package name '${_CATKIN_CURRENT_PACKAGE}' in '${_PACKAGE_XML_DIRECTORY}/package.xml' does not match current PROJECT_NAME '${PROJECT_NAME}'. You must call project() with the same package name before.") endif() catkin_destinations() endmacro() macro(_catkin_package_xml dest_dir) cmake_parse_arguments(_PACKAGE_XML "" "DIRECTORY" "" ${ARGN}) if(_PACKAGE_XML_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_package_xml() called with unused arguments: ${_PACKAGE_XML_UNPARSED_ARGUMENTS}") endif() # set default directory if(NOT _PACKAGE_XML_DIRECTORY) set(_PACKAGE_XML_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() # stamp and parse package.xml stamp(${_PACKAGE_XML_DIRECTORY}/package.xml) file(MAKE_DIRECTORY ${dest_dir}) safe_execute_process(COMMAND ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/parse_package_xml.py ${_PACKAGE_XML_DIRECTORY}/package.xml ${dest_dir}/package.cmake) # load extracted variable into cmake include(${dest_dir}/package.cmake) endmacro() catkin-0.8.0/cmake/catkin_python_setup.cmake000066400000000000000000000174461361264727400211740ustar00rootroot00000000000000# This macro will interrogate the Python setup.py file in # ``${${PROJECT_NAME}_SOURCE_DIR}``, and then creates forwarding # Python :term:`pkgutil` infrastructure in devel space # accordingly for the scripts and packages declared in setup.py. # # Doing so enables mixing :term:`generated code` in # devel space with :term:`static code` from sourcespace within a # single Python package. # # In addition, it adds the install command of # distutils/setuputils to the install target. # # .. note:: If the project also uses genmsg message generation via # ``generate_messages()`` this function must be called before. # # @public # function(catkin_python_setup) if(ARGN) message(FATAL_ERROR "catkin_python_setup() called with unused arguments: ${ARGN}") endif() if(${PROJECT_NAME}_GENERATE_MESSAGES) message(FATAL_ERROR "generate_messages() must be called after catkin_python_setup() in project '${PROJECT_NAME}'") endif() if(${PROJECT_NAME}_GENERATE_DYNAMIC_RECONFIGURE) message(FATAL_ERROR "generate_dynamic_reconfigure_options() must be called after catkin_python_setup() in project '${PROJECT_NAME}'") endif() if(NOT EXISTS ${${PROJECT_NAME}_SOURCE_DIR}/setup.py) message(FATAL_ERROR "catkin_python_setup() called without 'setup.py' in project folder ' ${${PROJECT_NAME}_SOURCE_DIR}'") endif() assert(PYTHON_INSTALL_DIR) set(INSTALL_CMD_WORKING_DIRECTORY ${${PROJECT_NAME}_SOURCE_DIR}) if(NOT WIN32) set(INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_distutils_install.sh) configure_file(${catkin_EXTRAS_DIR}/templates/python_distutils_install.sh.in ${INSTALL_SCRIPT} @ONLY) else() # need to convert install prefix to native path for python setuptools --prefix (its fussy about \'s) file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} PYTHON_INSTALL_PREFIX) set(INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_distutils_install.bat) configure_file(${catkin_EXTRAS_DIR}/templates/python_distutils_install.bat.in ${INSTALL_SCRIPT} @ONLY) endif() # generate python script which gets executed at install time configure_file(${catkin_EXTRAS_DIR}/templates/safe_execute_install.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/safe_execute_install.cmake) install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/safe_execute_install.cmake) # interrogate setup.py stamp(${${PROJECT_NAME}_SOURCE_DIR}/setup.py) assert(CATKIN_ENV) assert(PYTHON_EXECUTABLE) set(cmd ${CATKIN_ENV} ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/interrogate_setup_dot_py.py ${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE_DIR}/setup.py ${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/setup_py_interrogation.cmake ) debug_message(10 "catkin_python_setup() in project '{PROJECT_NAME}' executes: ${cmd}") safe_execute_process(COMMAND ${cmd}) include(${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/setup_py_interrogation.cmake) # call catkin_package_xml() if it has not been called before if(NOT _CATKIN_CURRENT_PACKAGE) catkin_package_xml() endif() assert(${PROJECT_NAME}_VERSION) # verify that version from setup.py is equal to version from package.xml if(NOT "${${PROJECT_NAME}_SETUP_PY_VERSION}" STREQUAL "${${PROJECT_NAME}_VERSION}") message(FATAL_ERROR "catkin_python_setup() version in setup.py (${${PROJECT_NAME}_SETUP_PY_VERSION}) differs from version in package.xml (${${PROJECT_NAME}_VERSION})") endif() # if the Python install directory didn't exist before # the cached environment won't contain it in the PYTHONPATH if(NOT EXISTS "${CATKIN_DEVEL_PREFIX}/${PYTHON_INSTALL_DIR}") file(MAKE_DIRECTORY "${CATKIN_DEVEL_PREFIX}/${PYTHON_INSTALL_DIR}") # refresh environment cache safe_execute_process(COMMAND ${GENERATE_ENVIRONMENT_CACHE_COMMAND}) endif() # generate relaying __init__.py for each python package if(${PROJECT_NAME}_SETUP_PY_PACKAGES) list(LENGTH ${PROJECT_NAME}_SETUP_PY_PACKAGES pkgs_count) math(EXPR pkgs_range "${pkgs_count} - 1") foreach(index RANGE ${pkgs_range}) list(GET ${PROJECT_NAME}_SETUP_PY_PACKAGES ${index} pkg) if("${pkg}" STREQUAL "${PROJECT_NAME}") # mark that catkin_python_setup() was called and the setup.py file contains a package with the same name as the current project # in order to disable installation of generated __init__.py files in generate_messages() and generate_dynamic_reconfigure_options() set(${PROJECT_NAME}_CATKIN_PYTHON_SETUP_HAS_PACKAGE_INIT TRUE PARENT_SCOPE) endif() list(GET ${PROJECT_NAME}_SETUP_PY_PACKAGE_DIRS ${index} pkg_dir) get_filename_component(name ${pkg_dir} NAME) if(NOT ("${pkg}" STREQUAL "${name}")) message(FATAL_ERROR "The package name '${pkg}' differs from the basename of the path '${pkg_dir}' in project '${PROJECT_NAME}'") endif() get_filename_component(path ${pkg_dir} PATH) set(PACKAGE_PYTHONPATH ${CMAKE_CURRENT_SOURCE_DIR}/${path}) configure_file(${catkin_EXTRAS_DIR}/templates/__init__.py.in ${CATKIN_DEVEL_PREFIX}/${PYTHON_INSTALL_DIR}/${pkg}/__init__.py @ONLY) endforeach() endif() # generate relay-script for each python module (and __init__.py files) if available if(${PROJECT_NAME}_SETUP_PY_MODULES) list(LENGTH ${PROJECT_NAME}_SETUP_PY_MODULES modules_count) math(EXPR modules_range "${modules_count} - 1") foreach(index RANGE ${modules_range}) list(GET ${PROJECT_NAME}_SETUP_PY_MODULES ${index} module) list(GET ${PROJECT_NAME}_SETUP_PY_MODULE_DIRS ${index} module_dir) set(PYTHON_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${module_dir}/${module}) if(EXISTS ${PYTHON_SCRIPT}) get_filename_component(path ${module} PATH) file(MAKE_DIRECTORY "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${path}") configure_file(${catkin_EXTRAS_DIR}/templates/relay.py.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${module} @ONLY) # relay parent __init__.py files if they exist while(NOT "${path}" STREQUAL "") set(PYTHON_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${module_dir}/${path}/__init__.py) if(EXISTS ${PYTHON_SCRIPT}) file(MAKE_DIRECTORY "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${path}") configure_file(${catkin_EXTRAS_DIR}/templates/relay.py.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${path}/__init__.py @ONLY) else() message(WARNING "The module '${module_dir}/${module}' lacks an '__init__.py' file in the parent folder '${module_dir}/${path}' in project '${PROJECT_NAME}'") endif() get_filename_component(path ${path} PATH) endwhile() endif() endforeach() endif() # generate relay-script for each python script foreach(script ${${PROJECT_NAME}_SETUP_PY_SCRIPTS}) get_filename_component(name ${script} NAME) if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${script}) message(FATAL_ERROR "The script '${name}' as listed in 'setup.py' of '${PROJECT_NAME}' doesn't exist") endif() set(PYTHON_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${script}) atomic_configure_file(${catkin_EXTRAS_DIR}/templates/script.py.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION}/${name} @ONLY) add_python_executable(SCRIPT_NAME ${name} # prefix with project name to avoid collisions across packages TARGET_NAME ${PROJECT_NAME}_${name}_exec_devel DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION}) add_python_executable(SCRIPT_NAME ${name} # prefix with project name to avoid collisions across packages TARGET_NAME ${PROJECT_NAME}_${name}_exec_install DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) endforeach() endfunction() stamp(${catkin_EXTRAS_DIR}/interrogate_setup_dot_py.py) catkin-0.8.0/cmake/catkin_symlink_install.cmake000066400000000000000000000041241361264727400216340ustar00rootroot00000000000000# Copyright 2014-2018 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. option(CATKIN_SYMLINK_INSTALL "Replace the CMake install command with a custom implementation using symlinks instead of copying resources" OFF) if(CATKIN_SYMLINK_INSTALL) message(STATUS "Override CMake install command with custom implementation " "using symlinks instead of copying resources") include( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_append_install_code.cmake") include( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_directory.cmake") include( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_files.cmake") include( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_programs.cmake") include( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install_targets.cmake") include("${catkin_EXTRAS_DIR}/symlink_install/catkin_install_logic.cmake") # register custom install logic _use_custom_install() set(_CATKIN_CUSTOM_INSTALL_RULES "${catkin_EXTRAS_DIR}/symlink_install/install.cmake") # create the install script from the template # catkin/cmake/symlink_install/catkin_symlink_install.cmake.in set(CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/catkin_symlink_install/catkin_symlink_install.cmake") configure_file( "${catkin_EXTRAS_DIR}/symlink_install/catkin_symlink_install.cmake.in" "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" @ONLY ) # register script for being executed at install time install(SCRIPT "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}") endif() catkin-0.8.0/cmake/catkin_workspace.cmake000066400000000000000000000140361361264727400204210ustar00rootroot00000000000000# # Search all subfolders in the workspace for ``package.xml`` files. # Based on the dependencies specified in the ``build_depends``, # ``buildtool_depends`` and (as of package format version 2) # ``test_depends`` tags it performs a topological sort and calls # ``add_subdirectory()`` for each directory. # # The functions is only called in catkin's ``toplevel.cmake``, which # is usually symlinked to the workspace root directory (which # contains multiple packages). # function(catkin_workspace) debug_message(10 "catkin_workspace() called in file '${CMAKE_CURRENT_LIST_FILE}'") # set global output directories for artifacts and create them if necessary set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib) if(NOT IS_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) endif() # tools/libraries.cmake configure_shared_library_build_settings() set(CATKIN_WHITELIST_PACKAGES "" CACHE STRING "List of ';' separated packages to build") set(CATKIN_BLACKLIST_PACKAGES "" CACHE STRING "List of ';' separated packages to exclude") if(NOT "${CATKIN_WHITELIST_PACKAGES}" STREQUAL "") message(STATUS "Using CATKIN_WHITELIST_PACKAGES: ${CATKIN_WHITELIST_PACKAGES}") endif() if(NOT "${CATKIN_BLACKLIST_PACKAGES}" STREQUAL "") message(STATUS "Using CATKIN_BLACKLIST_PACKAGES: ${CATKIN_BLACKLIST_PACKAGES}") endif() assert(catkin_EXTRAS_DIR) em_expand( ${catkin_EXTRAS_DIR}/templates/order_packages.context.py.in ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/order_packages.py ${catkin_EXTRAS_DIR}/em/order_packages.cmake.em ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/order_packages.cmake ) debug_message(10 "catkin_workspace() including order_packages.cmake") include(${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/order_packages.cmake) if(CATKIN_ORDERED_PACKAGES) set(CATKIN_NONCONFORMANT_METAPACKAGE FALSE) set(CATKIN_NONHOMOGENEOUS_WORKSPACE FALSE) list(LENGTH CATKIN_ORDERED_PACKAGES count) message(STATUS "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") message(STATUS "~~ traversing ${count} packages in topological order:") math(EXPR range "${count} - 1") foreach(index RANGE ${range}) list(GET CATKIN_ORDERED_PACKAGES ${index} name) list(GET CATKIN_ORDERED_PACKAGE_PATHS ${index} path) list(GET CATKIN_ORDERED_PACKAGES_IS_META ${index} is_meta) list(GET CATKIN_ORDERED_PACKAGES_BUILD_TYPE ${index} build_type) if(${is_meta}) message(STATUS "~~ - ${name} (metapackage)") # verify that CMakeLists.txt of metapackage conforms to standard set(metapackage_arguments "") assert(CATKIN_METAPACKAGE_CMAKE_TEMPLATE) configure_file(${CATKIN_METAPACKAGE_CMAKE_TEMPLATE} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt @ONLY) if(EXISTS ${CMAKE_SOURCE_DIR}/${path}/CMakeLists.txt) # compare CMakeLists.txt with standard content file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt generated_cmakelists) file(STRINGS ${path}/CMakeLists.txt existing_cmakelists) if(NOT "${generated_cmakelists}" STREQUAL "${existing_cmakelists}") set(CATKIN_NONHOMOGENEOUS_WORKSPACE TRUE) message("WARNING: The CMakeLists.txt of the metapackage '${name}' contains non standard content. Use the content of the following file instead: ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt") endif() else() message("WARNING: The metapackage '${name}' has no CMakeLists.txt. Please add one to the package source. You can use the following file: ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt") endif() else() if(${build_type} MATCHES catkin) message(STATUS "~~ - ${name}") else() set(CATKIN_NONHOMOGENEOUS_WORKSPACE TRUE) if(${build_type} MATCHES cmake) message(STATUS "~~ - ${name} (plain cmake)") else() message(STATUS "~~ - ${name} (unknown)") message(WARNING "Unknown build type '${build_type}' for package '${name}'") endif() endif() endif() endforeach() message(STATUS "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") if(${CATKIN_NONCONFORMANT_METAPACKAGE}) message(FATAL_ERROR "This workspace contains metapackages with a non-standard CMakeLists.txt.") endif() if(${CATKIN_NONHOMOGENEOUS_WORKSPACE}) message(FATAL_ERROR "This workspace contains non-catkin packages in it, and catkin cannot build a non-homogeneous workspace without isolation. Try the 'catkin_make_isolated' command instead.") endif() foreach(index RANGE ${range}) list(GET CATKIN_ORDERED_PACKAGES ${index} name) list(GET CATKIN_ORDERED_PACKAGE_PATHS ${index} path) list(GET CATKIN_ORDERED_PACKAGES_IS_META ${index} is_meta) list(GET CATKIN_ORDERED_PACKAGES_BUILD_TYPE ${index} build_type) if(${is_meta}) message(STATUS "+++ processing catkin metapackage: '${name}'") if(EXISTS ${CMAKE_SOURCE_DIR}/${path}/CMakeLists.txt) message(STATUS "==> add_subdirectory(${path})") add_subdirectory(${path}) else() message(STATUS "==> add_subdirectory(${path}) (using generated file from /catkin_generated/metapackages/${name})") message("WARNING: Add a CMakeLists.txt file to the metapackage '${name}'") add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name} ${CMAKE_BINARY_DIR}/${path}) endif() elseif(${build_type} MATCHES catkin) message(STATUS "+++ processing catkin package: '${name}'") message(STATUS "==> add_subdirectory(${path})") add_subdirectory(${path}) else() message(FATAL_ERROR "Non-catkin package found, non-homogeneous workspaces are not supported.") endif() endforeach() endif() endfunction() catkin-0.8.0/cmake/custom_install.cmake000066400000000000000000000006651361264727400201350ustar00rootroot00000000000000function(_use_custom_install) # only redefine install function once if(NOT _CATKIN_USE_CUSTOM_INSTALL) set(_CATKIN_USE_CUSTOM_INSTALL TRUE PARENT_SCOPE) function(install) if(_CATKIN_SKIP_INSTALL_RULES) return() endif() if(_CATKIN_CUSTOM_INSTALL_RULES) include("${_CATKIN_CUSTOM_INSTALL_RULES}") else() _install(${ARGN}) endif() endfunction() endif() endfunction() catkin-0.8.0/cmake/debug_message.cmake000066400000000000000000000005521361264727400176620ustar00rootroot00000000000000# Log levels # 0 Normal use # 1 Catkin developer use (Stuff being developed) # 2 Catkin developer use (Stuff working) # 3 Also Print True Assert Statements function(debug_message level) set(loglevel ${CATKIN_LOG}) if(NOT loglevel) set(loglevel 0) endif() if(NOT ${level} GREATER ${loglevel}) message(STATUS " ${ARGN}") endif() endfunction() catkin-0.8.0/cmake/em/000077500000000000000000000000001361264727400144655ustar00rootroot00000000000000catkin-0.8.0/cmake/em/order_packages.cmake.em000066400000000000000000000055221361264727400210440ustar00rootroot00000000000000# generated from catkin/cmake/em/order_packages.cmake.em @{ import os try: from catkin_pkg.cmake import get_metapackage_cmake_template_path except ImportError as e: raise RuntimeError('ImportError: "from catkin_pkg.cmake import get_metapackage_cmake_template_path" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) try: from catkin_pkg.topological_order import topological_order except ImportError as e: raise RuntimeError('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) try: from catkin_pkg.package import InvalidPackage except ImportError as e: raise RuntimeError('ImportError: "from catkin_pkg.package import InvalidPackage" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) # vars defined in order_packages.context.py.in try: ordered_packages = topological_order(os.path.normpath(source_root_dir), whitelisted=whitelisted_packages, blacklisted=blacklisted_packages, underlay_workspaces=underlay_workspaces) except InvalidPackage as e: print('message(FATAL_ERROR "%s")' % ('%s' % e).replace('"', '\\"')) ordered_packages = [] fatal_error = False }@ set(CATKIN_ORDERED_PACKAGES "") set(CATKIN_ORDERED_PACKAGE_PATHS "") set(CATKIN_ORDERED_PACKAGES_IS_META "") set(CATKIN_ORDERED_PACKAGES_BUILD_TYPE "") @[for path, package in ordered_packages]@ @[if path is None]@ message(FATAL_ERROR "Circular dependency in subset of packages:\n@package") @{ fatal_error = True }@ @[elif package.name != 'catkin']@ list(APPEND CATKIN_ORDERED_PACKAGES "@(package.name)") list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "@(path.replace('\\','/'))") list(APPEND CATKIN_ORDERED_PACKAGES_IS_META "@(str('metapackage' in [e.tagname for e in package.exports]))") @{ package.evaluate_conditions(os.environ) try: build_type = package.get_build_type() except InvalidPackage: build_type = None }@ @[if build_type is None]@ message(FATAL_ERROR "Only one element is permitted for package '@(package.name)'.") @{ fatal_error = True }@ @[else]@ list(APPEND CATKIN_ORDERED_PACKAGES_BUILD_TYPE "@(package.get_build_type())") @[end if]@ @{ deprecated = [e for e in package.exports if e.tagname == 'deprecated'] }@ @[if deprecated]@ message("WARNING: Package '@(package.name)' is deprecated@(' (%s)' % deprecated[0].content if deprecated[0].content else '')") @[end if]@ @[end if]@ @[end for]@ @[if not fatal_error]@ @{ message_generators = [package.name for (_, package) in ordered_packages if 'message_generator' in [e.tagname for e in package.exports]] }@ set(CATKIN_MESSAGE_GENERATORS @(' '.join(message_generators))) @[end if]@ set(CATKIN_METAPACKAGE_CMAKE_TEMPLATE "@(get_metapackage_cmake_template_path().replace('\\','/'))") catkin-0.8.0/cmake/em/pkg.pc.em000066400000000000000000000005141361264727400161720ustar00rootroot00000000000000prefix=@PROJECT_SPACE_DIR Name: @(CATKIN_PACKAGE_PREFIX + PROJECT_NAME) Description: Description of @PROJECT_NAME Version: @PROJECT_VERSION Cflags: @(' '.join(['-I%s' % include for include in PROJECT_PKG_CONFIG_INCLUDE_DIRS])) Libs: -L${prefix}/lib @(' '.join(PKG_CONFIG_LIBRARIES_WITH_PREFIX)) Requires: @(PROJECT_CATKIN_DEPENDS) catkin-0.8.0/cmake/em_expand.cmake000066400000000000000000000022031361264727400170230ustar00rootroot00000000000000function(em_expand context_in context_out em_file_in file_out) assert_file_exists("${context_in}" "input file for context missing") assert_file_exists("${em_file_in}" "template file missing") debug_message(2 "configure_file(${context_in}, ${context_out})") configure_file(${context_in} ${context_out} @ONLY) assert_file_exists("${context_out}" "context file was not generated correctly") stamp(${em_file_in}) # create directory if necessary get_filename_component(_folder_out ${file_out} PATH) if(NOT IS_DIRECTORY ${_folder_out}) file(MAKE_DIRECTORY ${_folder_out}) endif() debug_message(2 "Evaluate template '${em_file_in}' to '${file_out}' (with context from '${context_out}')") assert(EMPY_SCRIPT) # since empy contains a specific python version in its shebang line # override the used python version by invoking it explicitly set(command "${PYTHON_EXECUTABLE};${EMPY_SCRIPT}") # prepend environment if set if(CATKIN_ENV) set(command ${CATKIN_ENV} ${command}) endif() safe_execute_process(COMMAND ${command} --raw-errors -F ${context_out} -o ${file_out} ${em_file_in}) endfunction() catkin-0.8.0/cmake/empy.cmake000066400000000000000000000033001361264727400160340ustar00rootroot00000000000000function(find_python_module module) # cribbed from http://www.cmake.org/pipermail/cmake/2011-January/041666.html string(TOUPPER ${module} module_upper) if(NOT PY_${module_upper}) if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED") set(${module}_FIND_REQUIRED TRUE) endif() # A module's location is usually a directory, but for # binary modules # it's a .so file. execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))" RESULT_VARIABLE _${module}_status OUTPUT_VARIABLE _${module}_location ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _${module}_status) set(PY_${module_upper} ${_${module}_location} CACHE STRING "Location of Python module ${module}") endif(NOT _${module}_status) endif(NOT PY_${module_upper}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper}) endfunction(find_python_module) if(NOT EMPY_SCRIPT) find_program(EMPY_EXECUTABLE empy) if(NOT EMPY_EXECUTABLE) # On OSX, there's an em.py, but not an executable empy script find_python_module(em) if(NOT PY_EM) message(FATAL_ERROR "Unable to find either executable 'empy' or Python module 'em'... try installing the package 'python-empy'") endif() # ensure to use cmake-style path separators on Windows file(TO_CMAKE_PATH "${PY_EM}" EMPY_SCRIPT) else() # ensure to use cmake-style path separators on Windows file(TO_CMAKE_PATH "${EMPY_EXECUTABLE}" EMPY_SCRIPT) endif() set(EMPY_SCRIPT "${EMPY_SCRIPT}" CACHE STRING "Empy script" FORCE) endif() message(STATUS "Using empy: ${EMPY_SCRIPT}") catkin-0.8.0/cmake/env-hooks/000077500000000000000000000000001361264727400157755ustar00rootroot00000000000000catkin-0.8.0/cmake/env-hooks/05.catkin_make.bash000066400000000000000000000054711361264727400213340ustar00rootroot00000000000000function _catkin_make() { local cur prev cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} # autocomplete path arguments for -C, --directory, --source, --build case $prev in -C|--directory|--source|--build) _filedir -d return 0 ;; esac if [[ "$cur" == -DCMAKE_BUILD_TYPE=* ]]; then # autocomplete CMake argument CMAKE_BUILD_TYPE with its options COMPREPLY=( $( compgen -P "-DCMAKE_BUILD_TYPE=" -W "None Debug Release RelWithDebInfo MinSizeRel" -- "${cur:19}" ) ) elif [[ "$cur" == -DCATKIN_ENABLE_TESTING=* ]]; then # autocomplete catkin argument CATKIN_ENABLE_TESTING with its options COMPREPLY=( $( compgen -P "-DCATKIN_ENABLE_TESTING=" -W "0 1" -- "${cur:24}" ) ) elif [[ "$cur" == -DCATKIN_DEVEL_PREFIX=* || "$cur" == -DCMAKE_INSTALL_PREFIX=* ]]; then COMPREPLY=() elif [[ "$cur" == -* ]]; then local opts="$( _parse_help "$1" )" [[ $opts ]] || opts="$( _parse_usage "$1" )" if [[ "$cur" == -* ]]; then # suggest some common CMake arguments opts="$opts -DCATKIN_DEVEL_PREFIX= -DCATKIN_ENABLE_TESTING= -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=" fi COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else # check if custom workspace root has been specified on the command line local workspace_dir="." for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do if [[ ${COMP_WORDS[i]} == -C || ${COMP_WORDS[i]} == --directory ]]; then # eval to expand tilde eval workspace_dir=${COMP_WORDS[i+1]} fi done # check if custom build folder has been specified on the command line local build_dir="build" for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do if [[ ${COMP_WORDS[i]} == --build ]]; then # eval to expand tilde eval build_dir=${COMP_WORDS[i+1]} fi done # determine location of Makefile local makefile_dir if [[ "$build_dir" = /* ]]; then makefile_dir="$build_dir" else makefile_dir="$workspace_dir/$build_dir" fi COMPREPLY=() if [ -f "$makefile_dir/Makefile" ]; then cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $( compgen -W "`make -C $makefile_dir -qp 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][a-zA-Z0-9_\.]*:/ { print $1 }'`" -- $cur )) elif [ -f "$makefile_dir/build.ninja" ]; then cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $( compgen -W "`ninja -C $makefile_dir -t targets 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][a-zA-Z0-9_\.]*:/ { print $1 }'`" -- $cur )) fi fi } && complete -F _catkin_make catkin_make catkin-0.8.0/cmake/env-hooks/05.catkin_make_isolated.bash000066400000000000000000000053421361264727400232150ustar00rootroot00000000000000function _catkin_make_isolated() { local cur prev cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} # autocomplete path arguments for -C, --directory, --source, --build, --devel, --install case $prev in -C|--directory|--source|--build|--devel|--install) _filedir -d return 0 ;; esac if [[ "$cur" == -DCMAKE_BUILD_TYPE=* ]]; then # autocomplete CMake argument CMAKE_BUILD_TYPE with its options COMPREPLY=( $( compgen -P "-DCMAKE_BUILD_TYPE=" -W "None Debug Release RelWithDebInfo MinSizeRel" -- "${cur:19}" ) ) elif [[ "$cur" == -DCATKIN_ENABLE_TESTING=* ]]; then # autocomplete catkin argument CATKIN_ENABLE_TESTING with its options COMPREPLY=( $( compgen -P "-DCATKIN_ENABLE_TESTING=" -W "0 1" -- "${cur:24}" ) ) elif [[ "$cur" == -* ]]; then local opts="$( _parse_help "$1" )" [[ $opts ]] || opts="$( _parse_usage "$1" )" if [[ "$cur" == -* ]]; then # suggest some common CMake arguments opts="$opts -DCATKIN_ENABLE_TESTING= -DCMAKE_BUILD_TYPE=" fi COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else # check if custom workspace root has been specified on the command line local workspace_dir="." for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do if [[ ${COMP_WORDS[i]} == -C || ${COMP_WORDS[i]} == --directory ]]; then # eval to expand tilde eval workspace_dir=${COMP_WORDS[i+1]} fi done # check if custom build folder has been specified on the command line local build_dir="build_isolated" for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do if [[ ${COMP_WORDS[i]} == --build ]]; then # eval to expand tilde eval build_dir=${COMP_WORDS[i+1]} fi done # determine location of Makefile local makefile_dir if [[ "$build_dir" = /* ]]; then makefile_dir="$build_dir" else makefile_dir="$workspace_dir/$build_dir" fi COMPREPLY=() if [ -f "$makefile_dir/Makefile" ]; then cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $( compgen -W "`make -C $makefile_dir -qp 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][a-zA-Z0-9_\.]*:/ { print $1 }'`" -- $cur )) elif [ -f "$makefile_dir/build.ninja" ]; then cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $( compgen -W "`ninja -C $makefile_dir -t targets 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][a-zA-Z0-9_\.]*:/ { print $1 }'`" -- $cur )) fi fi } && complete -F _catkin_make_isolated catkin_make_isolated catkin-0.8.0/cmake/find_program_required.cmake000066400000000000000000000007001361264727400214320ustar00rootroot00000000000000function(find_program_required ARG_VAR ARG_PROGRAM_NAME) cmake_parse_arguments(ARG "NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH" "" "PATHS" ${ARGN}) find_program(${ARG_VAR} ${ARG_PROGRAM_NAME} PATHS ${ARG_PATHS} ${ARG_NO_DEFAULT_PATH} ${ARG_NO_CMAKE_FIND_ROOT_PATH}) if(NOT ${ARG_VAR}) message(FATAL_ERROR "${ARG_PROGRAM_NAME} not found") else() debug_message(1 "${ARG_PROGRAM_NAME} was found at ${${ARG_VAR}}") endif() endfunction() catkin-0.8.0/cmake/interrogate_setup_dot_py.py000066400000000000000000000233251361264727400215640ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import os import runpy import sys from argparse import ArgumentParser setup_modules = [] try: import distutils.core setup_modules.append(distutils.core) except ImportError: pass try: import setuptools setup_modules.append(setuptools) except ImportError: pass assert setup_modules, 'Must have distutils or setuptools installed' def _get_locations(pkgs, package_dir): """ Based on setuptools logic and the package_dir dict, builds a dict of location roots for each pkg in pkgs. See http://docs.python.org/distutils/setupscript.html :returns: a dict {pkgname: root} for each pkgname in pkgs (and each of their parents) """ # package_dir contains a dict {package_name: relativepath} # Example {'': 'src', 'foo': 'lib', 'bar': 'lib2'} # # '' means where to look for any package unless a parent package # is listed so package bar.pot is expected at lib2/bar/pot, # whereas package sup.dee is expected at src/sup/dee # # if package_dir does not state anything about a package, # setuptool expects the package folder to be in the root of the # project locations = {} allprefix = package_dir.get('', '') for pkg in pkgs: parent_location = None splits = pkg.split('.') # we iterate over compound name from parent to child # so once we found parent, children just append to their parent for key_len in range(len(splits)): key = '.'.join(splits[:key_len + 1]) if key not in locations: if key in package_dir: locations[key] = package_dir[key] elif parent_location is not None: locations[key] = os.path.join(parent_location, splits[key_len]) else: locations[key] = os.path.join(allprefix, key) parent_location = locations[key] return locations def generate_cmake_file(package_name, version, scripts, package_dir, pkgs, modules): """ Generate lines to add to a cmake file which will set variables. :param version: str, format 'int.int.int' :param scripts: [list of str]: relative paths to scripts :param package_dir: {modulename: path} :pkgs: [list of str] python_packages declared in catkin package :modules: [list of str] python modules """ prefix = '%s_SETUP_PY' % package_name result = [] result.append(r'set(%s_VERSION "%s")' % (prefix, version)) result.append(r'set(%s_SCRIPTS "%s")' % (prefix, ';'.join(scripts))) # Remove packages with '.' separators. # # setuptools allows specifying submodules in other folders than # their parent # # The symlink approach of catkin does not work with such submodules. # In the common case, this does not matter as the submodule is # within the containing module. We verify this assumption, and if # it passes, we remove submodule packages. locations = _get_locations(pkgs, package_dir) for pkgname, location in locations.items(): if '.' not in pkgname: continue splits = pkgname.split('.') # hack: ignore write-combining setup.py files for msg and srv files if splits[1] in ['msg', 'srv']: continue # check every child has the same root folder as its parent root_name = splits[0] root_location = location for _ in range(len(splits) - 1): root_location = os.path.dirname(root_location) if root_location != locations[root_name]: raise RuntimeError( 'catkin_export_python does not support setup.py files that combine across multiple directories: %s in %s, %s in %s' % (pkgname, location, root_name, locations[root_name])) # If checks pass, remove all submodules pkgs = [p for p in pkgs if '.' not in p] resolved_pkgs = [] for pkg in pkgs: resolved_pkgs += [locations[pkg]] result.append(r'set(%s_PACKAGES "%s")' % (prefix, ';'.join(pkgs))) result.append(r'set(%s_PACKAGE_DIRS "%s")' % (prefix, ';'.join(resolved_pkgs).replace('\\', '/'))) # skip modules which collide with package names filtered_modules = [] for modname in modules: splits = modname.split('.') # check all parents too equals_package = [('.'.join(splits[:-i]) in locations) for i in range(len(splits))] if any(equals_package): continue filtered_modules.append(modname) module_locations = _get_locations(filtered_modules, package_dir) result.append(r'set(%s_MODULES "%s")' % (prefix, ';'.join(['%s.py' % m.replace('.', '/') for m in filtered_modules]))) result.append(r'set(%s_MODULE_DIRS "%s")' % (prefix, ';'.join([module_locations[m] for m in filtered_modules]).replace('\\', '/'))) return result def _create_mock_setup_function(package_name, outfile): """ Create a function to call instead of distutils.core.setup or setuptools.setup. It just captures some args and writes them into a file that can be used from cmake. :param package_name: name of the package :param outfile: filename that cmake will use afterwards :returns: a function to replace disutils.core.setup and setuptools.setup """ def setup(*args, **kwargs): """Check kwargs and write a scriptfile.""" if 'version' not in kwargs: sys.stderr.write("\n*** Unable to find 'version' in setup.py of %s\n" % package_name) raise RuntimeError('version not found in setup.py') version = kwargs['version'] package_dir = kwargs.get('package_dir', {}) pkgs = kwargs.get('packages', []) scripts = kwargs.get('scripts', []) modules = kwargs.get('py_modules', []) unsupported_args = [ 'entry_points', 'exclude_package_data', 'ext_modules ', 'ext_package', 'include_package_data', 'namespace_packages', 'setup_requires', 'use_2to3', 'zip_safe'] used_unsupported_args = [arg for arg in unsupported_args if arg in kwargs] if used_unsupported_args: sys.stderr.write('*** Arguments %s to setup() not supported in catkin devel space in setup.py of %s\n' % (used_unsupported_args, package_name)) result = generate_cmake_file(package_name=package_name, version=version, scripts=scripts, package_dir=package_dir, pkgs=pkgs, modules=modules) with open(outfile, 'w') as out: out.write('\n'.join(result)) return setup def main(): """Script main, parses arguments and invokes Dummy.setup indirectly.""" parser = ArgumentParser(description='Utility to read setup.py values from cmake macros. Creates a file with CMake set commands setting variables.') parser.add_argument('package_name', help='Name of catkin package') parser.add_argument('setupfile_path', help='Full path to setup.py') parser.add_argument('outfile', help='Where to write result to') args = parser.parse_args() # print("%s" % sys.argv) # PACKAGE_NAME = sys.argv[1] # OUTFILE = sys.argv[3] # print("Interrogating setup.py for package %s into %s " % (PACKAGE_NAME, OUTFILE), # file=sys.stderr) # print("executing %s" % args.setupfile_path) # be sure you're in the directory containing # setup.py so the sys.path manipulation works, # so the import of __version__ works os.chdir(os.path.dirname(os.path.abspath(args.setupfile_path))) # patch setup() function of distutils and setuptools for the # context of evaluating setup.py backup_modules = {} try: fake_setup = _create_mock_setup_function( package_name=args.package_name, outfile=args.outfile) for module in setup_modules: backup_modules[id(module)] = module.setup module.setup = fake_setup runpy.run_path(args.setupfile_path) finally: for module in setup_modules: module.setup = backup_modules[id(module)] if __name__ == '__main__': main() catkin-0.8.0/cmake/legacy.cmake000066400000000000000000000002561361264727400163350ustar00rootroot00000000000000function(catkin_stack) message(FATAL_ERROR "catkin_stack() is not supported by catkin as of groovy. Please update the package to the latest catkin version.") endfunction() catkin-0.8.0/cmake/list_append_deduplicate.cmake000066400000000000000000000007401361264727400217340ustar00rootroot00000000000000# # Append elements to a list and remove existing duplicates from the list. # # .. note:: Using CMake's ``list(APPEND ..)`` and # ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its # implementation uses a set internally which makes the operation # unstable. # macro(list_append_deduplicate listname) if(NOT "${ARGN}" STREQUAL "") if(${listname}) list(REMOVE_ITEM ${listname} ${ARGN}) endif() list(APPEND ${listname} ${ARGN}) endif() endmacro() catkin-0.8.0/cmake/list_append_unique.cmake000066400000000000000000000007261361264727400207630ustar00rootroot00000000000000# # Append elements to a list if they are not already in the list. # # .. note:: Using CMake's ``list(APPEND ..)`` and # ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its # implementation uses a set internally which makes the operation # unstable. # macro(list_append_unique listname) foreach(_item ${ARGN}) list(FIND ${listname} ${_item} _index) if(_index EQUAL -1) list(APPEND ${listname} ${_item}) endif() endforeach() endmacro() catkin-0.8.0/cmake/list_insert_in_workspace_order.cmake000066400000000000000000000024601361264727400233660ustar00rootroot00000000000000# # Insert elements to a list in the same order as the chained catkin workspaces. # set(CATKIN_ORDERED_SPACES "") foreach(_space ${CATKIN_DEVEL_PREFIX} ${CATKIN_WORKSPACES}) list(APPEND CATKIN_ORDERED_SPACES ${_space}) if(NOT EXISTS "${_space}/.catkin") message(FATAL_ERROR "The path '${_space}' is in CATKIN_WORKSPACES but does not have a .catkin file") endif() # prepend to existing list of sourcespaces file(READ "${_space}/.catkin" _sourcespaces) list(APPEND CATKIN_ORDERED_SPACES ${_sourcespaces}) endforeach() debug_message(10 "CATKIN_ORDERED_SPACES ${CATKIN_ORDERED_SPACES}") function(list_insert_in_workspace_order listname) if(NOT "${ARGN}" STREQUAL "") assert(CATKIN_ENV) assert(PYTHON_EXECUTABLE) set(cmd ${CATKIN_ENV} ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/order_paths.py ${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/ordered_paths.cmake --paths-to-order ${ARGN} --prefixes ${CATKIN_ORDERED_SPACES} ) debug_message(10 "list_insert_in_workspace_order() in project '{PROJECT_NAME}' executes: ${cmd}") safe_execute_process(COMMAND ${cmd}) include(${${PROJECT_NAME}_BINARY_DIR}/catkin_generated/ordered_paths.cmake) set(${listname} ${ORDERED_PATHS} PARENT_SCOPE) else() set(${listname} "" PARENT_SCOPE) endif() endfunction() catkin-0.8.0/cmake/order_paths.py000066400000000000000000000024431361264727400167530ustar00rootroot00000000000000from __future__ import print_function import os import sys from argparse import ArgumentParser try: from catkin_pkg.workspaces import order_paths except ImportError as e: sys.exit('ImportError: "from catkin_pkg.package import parse_package" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) def main(): """Order a list of paths according to a list of prefixes which define the order.""" 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.') parser.add_argument('outfile', help='The filename of the generated CMake file') parser.add_argument('--paths-to-order', nargs='*', help='The semicolon-separated paths to order') parser.add_argument('--prefixes', nargs='*', help='The semicolon-separated prefixes defining the order') args = parser.parse_args() ordered_paths = order_paths(args.paths_to_order, args.prefixes) # create directory if necessary outdir = os.path.dirname(args.outfile) if not os.path.exists(outdir): os.makedirs(outdir) with open(args.outfile, 'w') as fh: fh.write('set(ORDERED_PATHS "%s")' % ';'.join(ordered_paths)) if __name__ == '__main__': main() catkin-0.8.0/cmake/parse_package_xml.py000066400000000000000000000116431361264727400201100ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import argparse import sys from collections import OrderedDict try: from catkin_pkg.package import parse_package except ImportError as e: sys.exit('ImportError: "from catkin_pkg.package import parse_package" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e) def _get_output(package): """ Return a list of strings with cmake commands to execute to set cmake variables. :param package: Package object :returns: list of str, lines to output """ values = OrderedDict() values['VERSION'] = '"%s"' % package.version values['MAINTAINER'] = '"%s"' % (', '.join([str(m) for m in package.maintainers])) values['PACKAGE_FORMAT'] = '"%d"' % package.package_format values.update(_get_dependency_values('BUILD_DEPENDS', package.build_depends)) values.update(_get_dependency_values('BUILD_EXPORT_DEPENDS', package.build_export_depends)) values.update(_get_dependency_values('BUILDTOOL_DEPENDS', package.buildtool_depends)) values.update(_get_dependency_values('BUILDTOOL_EXPORT_DEPENDS', package.buildtool_export_depends)) values.update(_get_dependency_values('EXEC_DEPENDS', package.exec_depends)) # the run dependencies are a convenience property to mimick format one like dependencies # it contains the build export and exec_dependendcies values.update(_get_dependency_values('RUN_DEPENDS', package.run_depends)) values.update(_get_dependency_values('TEST_DEPENDS', package.test_depends)) values.update(_get_dependency_values('DOC_DEPENDS', package.doc_depends)) for url_type in ['website', 'bugtracker', 'repository']: values['URL_%s' % url_type.upper()] = '"%s"' % (', '.join( [str(u) for u in package.urls if u.type == url_type])) deprecated = [e.content for e in package.exports if e.tagname == 'deprecated'] values['DEPRECATED'] = '"%s"' % ((deprecated[0] if deprecated[0] else 'TRUE') if deprecated else '') output = [] output.append(r'set(_CATKIN_CURRENT_PACKAGE "%s")' % package.name) for k, v in values.items(): output.append('set(%s_%s %s)' % (package.name, k, v)) return output def _get_dependency_values(key, depends): values = OrderedDict() values[key] = ' '.join(['"%s"' % str(d) for d in depends]) for d in depends: comparisons = ['version_lt', 'version_lte', 'version_eq', 'version_gte', 'version_gt'] for comp in comparisons: value = getattr(d, comp, None) if value is not None: values['%s_%s_%s' % (key, str(d), comp.upper())] = '"%s"' % value return values def main(argv=sys.argv[1:]): """Read given package_xml and writes extracted variables to outfile.""" parser = argparse.ArgumentParser(description='Read package.xml and write extracted variables to stdout') parser.add_argument('package_xml') parser.add_argument('outfile') args = parser.parse_args(argv) package = parse_package(args.package_xml) # Force utf8 encoding for python3. # This way unicode files can still be processed on non-unicode locales. kwargs = {} if sys.version_info.major >= 3: kwargs['encoding'] = 'utf8' lines = _get_output(package) with open(args.outfile, 'w', **kwargs) as ofile: ofile.write('\n'.join(lines)) if __name__ == '__main__': main() catkin-0.8.0/cmake/platform/000077500000000000000000000000001361264727400157105ustar00rootroot00000000000000catkin-0.8.0/cmake/platform/lsb.cmake000066400000000000000000000017641361264727400175020ustar00rootroot00000000000000find_program(LSB_RELEASE_EXECUTABLE lsb_release) if(LSB_RELEASE_EXECUTABLE) set(LSB_FOUND TRUE CACHE BOOL "lsb_release executable was found") execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si OUTPUT_VARIABLE LSB_DISTRIB_ID OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOUPPER ${LSB_DISTRIB_ID} v) set(${v} TRUE CACHE BOOL "LSB Distrib tag") execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sd OUTPUT_VARIABLE LSB_DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sr OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sc OUTPUT_VARIABLE LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOUPPER ${LSB_DISTRIB_ID} v) set(${v} TRUE CACHE BOOL "LSB Distribution") #message(STATUS "${v} is on") string(TOUPPER ${LSB_DISTRIB_ID}_${LSB_CODENAME} v) set(${v} TRUE CACHE BOOL "LSB Distrib - codename tag") #message(STATUS "${v} is on") endif() catkin-0.8.0/cmake/platform/ubuntu.cmake000066400000000000000000000001241361264727400202310ustar00rootroot00000000000000# requires lsb to be included first if(UBUNTU) # ubuntu-specifics go here endif() catkin-0.8.0/cmake/platform/windows.cmake000066400000000000000000000150271361264727400204110ustar00rootroot00000000000000# BUILD_SHARED_LIBS is a global cmake variable (usually defaults to on) # that determines the build type of libraries: # http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS # It defaults to shared. # Make sure this is already defined as a cached variable (@sa tools/libraries.cmake) if(NOT DEFINED BUILD_SHARED_LIBS) option(BUILD_SHARED_LIBS "Build dynamically-linked binaries" ON) endif() # Windows/cmake make things difficult if building dll's. # By default: # .dll -> CMAKE_RUNTIME_OUTPUT_DIRECTORY # .exe -> CMAKE_RUNTIME_OUTPUT_DIRECTORY # .lib -> CMAKE_LIBRARY_OUTPUT_DIRECTORY # # Subsequently, .dll's and .exe's use the same variable and by # default must be installed to the same place. Which is not # what we want for catkin. We wish: # # .dll -> CATKIN_GLOBAL_BIN_DESTINATION # .exe -> CATKIN_PACKAGE_BIN_DESTINATION # .lib -> CATKIN_PACKAGE_LIB_DESTINATION # # Since we can't put CMAKE_RUNTIME_OUTPUT_DIRECTORY to # two values at once, we have this ugly workaround here. # # Note - we want to move away from redefining # add_library style calls, but necessary until a better solution # is available for windows. Alternatives are to set_target_properties # on every lib (painful) or to make exe's public (name conflicts # bound to arise). # # Another feature that would be desirable, is to install .pdb's for # debugging along with the library. Can't do that here as we do not # know for sure if the library target is intended for installation # or not. Might a good idea to have a script that searches for all # pdb's under CATKIN_DEVEL_PREFIX and copies them over at the end # of the cmake build. if(BUILD_SHARED_LIBS) if(WIN32) function(add_library library) # Check if its an external, imported library (e.g. boost libs via cmake module definition) list(FIND ARGN "IMPORTED" FIND_IMPORTED) list(FIND ARGN "ALIAS" FIND_ALIAS) list(FIND ARGN "INTERFACE" FIND_INTERFACE) _add_library(${ARGV0} ${ARGN}) if(${FIND_IMPORTED} EQUAL -1 AND ${FIND_ALIAS} EQUAL -1 AND ${FIND_INTERFACE} EQUAL -1) set_target_properties(${ARGV0} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION} RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION} RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION} RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION} RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION} LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} ) endif() endfunction() endif() endif() # It is encouraged to follow this guide to enable exports for dll's in a cross-platform way: # http://wiki.ros.org/win_ros/Contributing/Dll%20Exports # however, since not every project has implemented import/export macros, enable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS as a workaround # https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/ if(BUILD_SHARED_LIBS) if(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() endif() # For Windows, add definitions to exclude defining common names macros that cause name collision if(WIN32) # enable Math Constants (https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants) add_definitions(-D_USE_MATH_DEFINES) # do not define STRICT macros (minwindef.h or boost\winapi\basic_types.hpp) add_definitions(-DNO_STRICT) # do not define min/max macros add_definitions(-DNOMINMAX) # do not define STRICT macros (qtgui\qwindowdefs_win.h) add_definitions(-DQ_NOWINSTRICT) # keep minimum windows headers inclusion add_definitions(-DWIN32_LEAN_AND_MEAN) # explicitly enable C++ to compile wrapper enable_language(CXX) endif() if(MSVC) # https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ add_compile_options(/Zc:__cplusplus) endif() # # Add Python executable wrapper around Python scripts on Windows. # # Python scripts with (or without) .py extension are not executable on Windows # due to lack of shebang support. # # :param SCRIPT_NAME: Python script name that needs a wrapper # :type SCRIPT_NAME: string # :param TARGET_NAME: build target name # :type TARGET_NAME: string # :param DESTINATION: install destination for the build target # :type DESTINATION: string # # @public # function(add_python_executable) # Code courtesy of Yujin Robot. # Derived from https://github.com/ros-windows/win_ros cmake_parse_arguments( ARG "" "SCRIPT_NAME;TARGET_NAME;DESTINATION" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "add_python_executable() called with unused arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(WIN32) set( WRAPPER_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/add_python_executable/${ARG_TARGET_NAME}/${ARG_SCRIPT_NAME}.cpp") configure_file( "${catkin_EXTRAS_DIR}/templates/python_win32_wrapper.cpp.in" "${WRAPPER_SOURCE}" @ONLY) add_executable(${ARG_TARGET_NAME} "${WRAPPER_SOURCE}") # The actual file name of the executable built on Windows will be ${ARG_SCRIPT_NAME}.exe according to OUTPUT_NAME set_target_properties( ${ARG_TARGET_NAME} PROPERTIES OUTPUT_NAME "${ARG_SCRIPT_NAME}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/windows_wrappers/${ARG_TARGET_NAME}") install( TARGETS ${ARG_TARGET_NAME} RUNTIME DESTINATION "${ARG_DESTINATION}") endif() endfunction() catkin-0.8.0/cmake/python.cmake000066400000000000000000000035761361264727400164220ustar00rootroot00000000000000# the CMake variable PYTHON_INSTALL_DIR has the same value as the Python function catkin.builder.get_python_install_dir() set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Python version to use ('major.minor' or 'major')") find_package(PythonInterp ${PYTHON_VERSION} REQUIRED) message(STATUS "Using PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}") set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") set(enable_setuptools_deb_layout OFF) if(EXISTS "/etc/debian_version") set(enable_setuptools_deb_layout ON) endif() option(SETUPTOOLS_DEB_LAYOUT "Enable debian style python package layout" ${enable_setuptools_deb_layout}) if(SETUPTOOLS_DEB_LAYOUT) message(STATUS "Using Debian Python package layout") set(PYTHON_PACKAGES_DIR dist-packages) set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb") # use major version only when installing 3.x with debian layout if("${PYTHON_VERSION_MAJOR}" STREQUAL "3") set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}") endif() else() message(STATUS "Using default Python package layout") set(PYTHON_PACKAGES_DIR site-packages) # setuptools is fussy about windows paths, make sure the install prefix is in native format file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" SETUPTOOLS_INSTALL_PREFIX) endif() if(NOT WIN32) set(PYTHON_INSTALL_DIR lib/python${_PYTHON_PATH_VERSION_SUFFIX}/${PYTHON_PACKAGES_DIR} 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.") else() # Windows setuptools installs to lib/site-packages not lib/python2.7/site-packages set(PYTHON_INSTALL_DIR lib/${PYTHON_PACKAGES_DIR} 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.") endif() catkin-0.8.0/cmake/safe_execute_process.cmake000066400000000000000000000005561361264727400212720ustar00rootroot00000000000000function(safe_execute_process cmd_keyword arg1) set(_cmd ${arg1}) foreach(_arg ${ARGN}) set(_cmd "${_cmd} \"${_arg}\"") endforeach() debug_message(2 "execute_process(${_cmd})") execute_process(${ARGV} RESULT_VARIABLE _res) if(NOT _res EQUAL 0) message(FATAL_ERROR "execute_process(${_cmd}) returned error code ${_res}") endif() endfunction() catkin-0.8.0/cmake/shell.cmake000066400000000000000000000006621361264727400162010ustar00rootroot00000000000000function(shell arg1) set(cmd ${arg1}) foreach(arg ${ARGN}) set(cmd "${cmd} ${arg}") endforeach() execute_process(COMMAND ${arg1} ${ARGN} RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) if(res EQUAL 0) debug_message(2 "execute_process(${cmd}) succeeded returning: ${out}") else() message(FATAL_ERROR "execute_process(${cmd})\n***FAILED with ERROR:***\n${out}") endif() endfunction() catkin-0.8.0/cmake/stamp.cmake000066400000000000000000000006611361264727400162150ustar00rootroot00000000000000# # :param path: file name # # Uses ``configure_file`` to generate a file ``filepath.stamp`` hidden # somewhere in the build tree. This will cause cmake to rebuild its # cache when ``filepath`` is modified. # function(stamp path) get_filename_component(filename "${path}" NAME) configure_file(${path} ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/stamps/${PROJECT_NAME}/${filename}.stamp COPYONLY) endfunction() catkin-0.8.0/cmake/string_starts_with.cmake000066400000000000000000000011161361264727400210260ustar00rootroot00000000000000# # Check if a string starts with a prefix. # # :param str: the string # :type str: string # :param prefix: the prefix # :type prefix: string # :param var: the output variable name # :type var: bool # function(string_starts_with str prefix var) string(LENGTH "${str}" str_length) string(LENGTH "${prefix}" prefix_length) set(value FALSE) if(NOT ${str_length} LESS ${prefix_length}) string(SUBSTRING "${str}" 0 ${prefix_length} str_prefix) if("${str_prefix}" STREQUAL "${prefix}") set(value TRUE) endif() endif() set(${var} ${value} PARENT_SCOPE) endfunction() catkin-0.8.0/cmake/symlink_install/000077500000000000000000000000001361264727400173005ustar00rootroot00000000000000catkin-0.8.0/cmake/symlink_install/catkin_install_logic.cmake000066400000000000000000000026161361264727400244630ustar00rootroot00000000000000# Copyright 2014-2018 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Custom CMake install logic to use symlinks instead of copying resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_install_logic signature) string(TOUPPER "${signature}" signature) if(signature STREQUAL "DIRECTORY") catkin_symlink_install_directory(DIRECTORY ${ARGN}) return() elseif(signature STREQUAL "FILES") catkin_symlink_install_files(FILES ${ARGN}) return() elseif(signature STREQUAL "PROGRAMS") catkin_symlink_install_programs(PROGRAMS ${ARGN}) return() elseif(signature STREQUAL "TARGETS") catkin_symlink_install_targets(TARGETS ${ARGN}) return() endif() # fall back to CMake install() command # if the arguments haven't been handled before _install(${signature} ${ARGN}) endfunction() catkin-0.8.0/cmake/symlink_install/catkin_symlink_install.cmake.in000066400000000000000000000235401361264727400254600ustar00rootroot00000000000000# generated from catkin/cmake/symlink_install/catkin_symlink_install.cmake.in # create empty symlink install manifest before starting install step file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/symlink_install_manifest.txt") # # Reimplement CMake install(DIRECTORY) command to use symlinks instead of # copying resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_directory) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION" "DIRECTORY;PATTERN;PATTERN_EXCLUDE" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_symlink_install_directory() called with " "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # make destination absolute path and ensure that it exists if(NOT IS_ABSOLUTE "${ARG_DESTINATION}") set(ARG_DESTINATION "@CMAKE_INSTALL_PREFIX@/${ARG_DESTINATION}") endif() if(NOT EXISTS "${ARG_DESTINATION}") file(MAKE_DIRECTORY "${ARG_DESTINATION}") endif() # default pattern to include if(NOT ARG_PATTERN) set(ARG_PATTERN "*") endif() # iterate over directories foreach(dir ${ARG_DIRECTORY}) # make dir an absolute path if(NOT IS_ABSOLUTE "${dir}") set(dir "@CMAKE_CURRENT_SOURCE_DIR@/${dir}") endif() if(EXISTS "${dir}") # if directory has no trailing slash # append folder name to destination set(destination "${ARG_DESTINATION}") string(LENGTH "${dir}" length) math(EXPR offset "${length} - 1") string(SUBSTRING "${dir}" ${offset} 1 dir_last_char) if(NOT dir_last_char STREQUAL "/") get_filename_component(destination_name "${dir}" NAME) set(destination "${destination}/${destination_name}") else() # remove trailing slash string(SUBSTRING "${dir}" 0 ${offset} dir) endif() # glob recursive files set(relative_files "") foreach(pattern ${ARG_PATTERN}) file( GLOB_RECURSE include_files RELATIVE "${dir}" "${dir}/${pattern}" ) if(NOT include_files STREQUAL "") list(APPEND relative_files ${include_files}) endif() endforeach() foreach(pattern ${ARG_PATTERN_EXCLUDE}) file( GLOB_RECURSE exclude_files RELATIVE "${dir}" "${dir}/${pattern}" ) if(NOT exclude_files STREQUAL "") list(REMOVE_ITEM relative_files ${exclude_files}) endif() endforeach() list(SORT relative_files) foreach(relative_file ${relative_files}) set(absolute_file "${dir}/${relative_file}") # determine link name for file including destination path set(symlink "${destination}/${relative_file}") # ensure that destination exists get_filename_component(symlink_dir "${symlink}" PATH) if(NOT EXISTS "${symlink_dir}") file(MAKE_DIRECTORY "${symlink_dir}") endif() _catkin_symlink_install_create_symlink("${absolute_file}" "${symlink}") endforeach() else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "catkin_symlink_install_directory() can't find '${dir}'") endif() endif() endforeach() endfunction() # # Reimplement CMake install(FILES) command to use symlinks instead of copying # resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_files) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION;RENAME" "FILES" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_symlink_install_files() called with " "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # make destination an absolute path and ensure that it exists if(NOT IS_ABSOLUTE "${ARG_DESTINATION}") set(ARG_DESTINATION "@CMAKE_INSTALL_PREFIX@/${ARG_DESTINATION}") endif() if(NOT EXISTS "${ARG_DESTINATION}") file(MAKE_DIRECTORY "${ARG_DESTINATION}") endif() if(ARG_RENAME) list(LENGTH ARG_FILES file_count) if(NOT file_count EQUAL 1) message(FATAL_ERROR "catkin_symlink_install_files() called with " "RENAME argument but not with a single file") endif() endif() # iterate over files foreach(file ${ARG_FILES}) # make file an absolute path if(NOT IS_ABSOLUTE "${file}") set(file "@CMAKE_CURRENT_SOURCE_DIR@/${file}") endif() if(EXISTS "${file}") # determine link name for file including destination path get_filename_component(filename "${file}" NAME) if(NOT ARG_RENAME) set(symlink "${ARG_DESTINATION}/${filename}") else() set(symlink "${ARG_DESTINATION}/${ARG_RENAME}") endif() _catkin_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "catkin_symlink_install_files() can't find '${file}'") endif() endif() endforeach() endfunction() # # Reimplement CMake install(PROGRAMS) command to use symlinks instead of copying # resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_programs) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION" "PROGRAMS" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_symlink_install_programs() called with " "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # make destination an absolute path and ensure that it exists if(NOT IS_ABSOLUTE "${ARG_DESTINATION}") set(ARG_DESTINATION "@CMAKE_INSTALL_PREFIX@/${ARG_DESTINATION}") endif() if(NOT EXISTS "${ARG_DESTINATION}") file(MAKE_DIRECTORY "${ARG_DESTINATION}") endif() # iterate over programs foreach(file ${ARG_PROGRAMS}) # make file an absolute path if(NOT IS_ABSOLUTE "${file}") set(file "@CMAKE_CURRENT_SOURCE_DIR@/${file}") endif() if(EXISTS "${file}") # determine link name for file including destination path get_filename_component(filename "${file}" NAME) set(symlink "${ARG_DESTINATION}/${filename}") _catkin_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "catkin_symlink_install_programs() can't find '${file}'") endif() endif() endforeach() endfunction() # # Reimplement CMake install(TARGETS) command to use symlinks instead of copying # resources. # # :param TARGET_FILES: the absolute files, replacing the name of targets passed # in as TARGETS # :type TARGET_FILES: list of files # :param ARGN: the same arguments as the CMake install command except that # keywords identifying the kind of type and the DESTINATION keyword must be # joined with an underscore, e.g. ARCHIVE_DESTINATION. # :type ARGN: various # function(catkin_symlink_install_targets) cmake_parse_arguments(ARG "OPTIONAL" "ARCHIVE_DESTINATION;DESTINATION;LIBRARY_DESTINATION;RUNTIME_DESTINATION" "TARGETS;TARGET_FILES" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_symlink_install_targets() called with " "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # iterate over target files foreach(file ${ARG_TARGET_FILES}) if(NOT IS_ABSOLUTE "${file}") message(FATAL_ERROR "catkin_symlink_install_targets() target file " "'${file}' must be an absolute path") endif() # determine destination of file based on extension set(destination "") get_filename_component(fileext "${file}" EXT) if(fileext STREQUAL ".a" OR fileext STREQUAL ".lib") set(destination "${ARG_ARCHIVE_DESTINATION}") elseif(fileext STREQUAL ".dylib" OR fileext STREQUAL ".so") set(destination "${ARG_LIBRARY_DESTINATION}") elseif(fileext STREQUAL "" OR fileext STREQUAL ".dll" OR fileext STREQUAL ".exe") set(destination "${ARG_RUNTIME_DESTINATION}") endif() if(destination STREQUAL "") set(destination "${ARG_DESTINATION}") endif() # make destination an absolute path and ensure that it exists if(NOT IS_ABSOLUTE "${destination}") set(destination "@CMAKE_INSTALL_PREFIX@/${destination}") endif() if(NOT EXISTS "${destination}") file(MAKE_DIRECTORY "${destination}") endif() if(EXISTS "${file}") # determine link name for file including destination path get_filename_component(filename "${file}" NAME) set(symlink "${destination}/${filename}") _catkin_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "catkin_symlink_install_targets() can't find '${file}'") endif() endif() endforeach() endfunction() function(_catkin_symlink_install_create_symlink absolute_file symlink) # register symlink for being removed during install step file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/symlink_install_manifest.txt" "${symlink}\n") # avoid any work if correct symlink is already in place if(EXISTS "${symlink}" AND IS_SYMLINK "${symlink}") get_filename_component(destination "${symlink}" REALPATH) get_filename_component(real_absolute_file "${absolute_file}" REALPATH) if(destination STREQUAL real_absolute_file) message(STATUS "Up-to-date symlink: ${symlink}") return() endif() endif() message(STATUS "Symlinking: ${symlink}") if(EXISTS "${symlink}" OR IS_SYMLINK "${symlink}") file(REMOVE "${symlink}") endif() execute_process( COMMAND "@CMAKE_COMMAND@" "-E" "create_symlink" "${absolute_file}" "${symlink}" ) # the CMake command does not provide a return code so check manually if(NOT EXISTS "${symlink}" OR NOT IS_SYMLINK "${symlink}") get_filename_component(destination "${symlink}" REALPATH) message(FATAL_ERROR "Could not create symlink '${symlink}' pointing to '${absolute_file}'") endif() endfunction() # end of template message(STATUS "Execute custom install script") # begin of custom install code catkin-0.8.0/cmake/symlink_install/catkin_symlink_install_append_install_code.cmake000066400000000000000000000023111361264727400311130ustar00rootroot00000000000000# Copyright 2014 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Register a CMake script for execution at install time. # # :param ARGN: the list of CMake code lines # :type ARGN: list of strings # :param COMMENTS: an optional list of comments # :type COMMENTS: list of strings # function(catkin_symlink_install_append_install_code) cmake_parse_arguments(ARG "" "" "COMMENTS" ${ARGN}) # append code to install script if(ARG_COMMENTS) file(APPEND "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" "\n# ${ARG_COMMENTS}\n") endif() foreach(code ${ARG_UNPARSED_ARGUMENTS}) file(APPEND "${CATKIN_SYMLINK_INSTALL_INSTALL_SCRIPT}" "${code}\n") endforeach() endfunction() catkin-0.8.0/cmake/symlink_install/catkin_symlink_install_directory.cmake000066400000000000000000000047631361264727400271450ustar00rootroot00000000000000# Copyright 2014 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Reimplement CMake install(DIRECTORY) command to use symlinks instead of # copying resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_directory directory_keyword) if(NOT directory_keyword STREQUAL "DIRECTORY") message(FATAL_ERROR "catkin_symlink_install_directory() first " "argument must be 'DIRECTORY', not '${directory_keyword}'") endif() set(unsupported_keywords "FILE_PERMISSIONS" "DIRECTORY_PERMISSIONS" "USE_SOURCE_PERMISSIONS" "CONFIGURATIONS" "COMPONENT" "FILES_MATCHING" "REGEX" "PERMISSIONS" ) foreach(unsupported_keyword ${unsupported_keywords}) list(FIND ARGN "${unsupported_keyword}" index) if(NOT index EQUAL -1) # fall back to CMake install() command # if the arguments can't be handled _install(DIRECTORY ${ARGN}) break() endif() endforeach() if(index EQUAL -1) # merge 'PATTERN "xxx" EXCLUDE' arguments to 'PATTERN_EXCLUDE "xxx"' set(argn ${ARGN}) list(LENGTH argn length) set(i 0) while(i LESS length) list(GET argn ${i} arg) if(arg STREQUAL "PATTERN") math(EXPR j "${i} + 2") if(j LESS length) list(GET argn ${j} arg) if(arg STREQUAL "EXCLUDE") # replace "PATTERN" with "PATTERN_EXCLUDE" list(REMOVE_AT argn ${i}) list(INSERT argn ${i} "PATTERN_EXCLUDE") # remove "EXCLUDE" list(REMOVE_AT argn ${j}) # get changed length list(LENGTH argn length) endif() endif() endif() math(EXPR i "${i} + 1") endwhile() string(REPLACE ";" "\" \"" argn_quoted "\"${argn}\"") catkin_symlink_install_append_install_code( "catkin_symlink_install_directory(DIRECTORY ${argn_quoted})" COMMENTS "install(DIRECTORY ${argn_quoted})" ) endif() endfunction() catkin-0.8.0/cmake/symlink_install/catkin_symlink_install_files.cmake000066400000000000000000000031651361264727400262360ustar00rootroot00000000000000# Copyright 2014 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Reimplement CMake install(FILES) command to use symlinks instead of copying # resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_files files_keyword) if(NOT files_keyword STREQUAL "FILES") message(FATAL_ERROR "catkin_symlink_install_files() first argument " "must be 'FILES', not '${files_keyword}'") endif() set(unsupported_keywords "PERMISSIONS" "CONFIGURATIONS" "COMPONENT" ) foreach(unsupported_keyword ${unsupported_keywords}) list(FIND ARGN "${unsupported_keyword}" index) if(NOT index EQUAL -1) # fall back to CMake install() command # if the arguments can't be handled _install(FILES ${ARGN}) break() endif() endforeach() if(index EQUAL -1) string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") catkin_symlink_install_append_install_code( "catkin_symlink_install_files(FILES ${argn_quoted})" COMMENTS "install(FILES ${argn_quoted})" ) endif() endfunction() catkin-0.8.0/cmake/symlink_install/catkin_symlink_install_programs.cmake000066400000000000000000000032461361264727400267660ustar00rootroot00000000000000# Copyright 2014 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Reimplement CMake install(PROGRAMS) command to use symlinks instead of copying # resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_programs programs_keyword) if(NOT programs_keyword STREQUAL "PROGRAMS") message(FATAL_ERROR "catkin_symlink_install_programs() first argument " "must be 'PROGRAMS', not '${programs_keyword}'") endif() set(unsupported_keywords "PERMISSIONS" "CONFIGURATIONS" "COMPONENT" "RENAME" ) foreach(unsupported_keyword ${unsupported_keywords}) list(FIND ARGN "${unsupported_keyword}" index) if(NOT index EQUAL -1) # fall back to CMake install() command # if the arguments can't be handled _install(PROGRAMS ${ARGN}) break() endif() endforeach() if(index EQUAL -1) string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") catkin_symlink_install_append_install_code( "catkin_symlink_install_programs(PROGRAMS ${argn_quoted})" COMMENTS "install(PROGRAMS ${argn_quoted})" ) endif() endfunction() catkin-0.8.0/cmake/symlink_install/catkin_symlink_install_targets.cmake000066400000000000000000000076601361264727400266110ustar00rootroot00000000000000# Copyright 2014-2015 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set(__CATKIN_SYMLINK_INSTALL_TARGETS_INDEX "0" CACHE INTERNAL "Index for unique symlink install targets") # # Reimplement CMake install(TARGETS) command to use symlinks instead of copying # resources. # # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(catkin_symlink_install_targets) if(NOT "${ARGV0}" STREQUAL "TARGETS") message(FATAL_ERROR "catkin_symlink_install_targets() first argument " "must be 'TARGETS', not '${ARGV0}'") endif() set(unsupported_keywords "EXPORT" "FRAMEWORK" "BUNDLE" "PRIVATE_HEADER" "PUBLIC_HEADER" "RESOURCE" "INCLUDES" "PERMISSIONS" "CONFIGURATIONS" "COMPONENT" "NAMELINK_ONLY" "NAMELINK_SKIP" ) foreach(unsupported_keyword ${unsupported_keywords}) list(FIND ARGN "${unsupported_keyword}" index) if(NOT index EQUAL -1) # fall back to CMake install() command # if the arguments can't be handled _install(${ARGN}) break() endif() endforeach() if(index EQUAL -1) cmake_parse_arguments(ARG "ARCHIVE;LIBRARY;RUNTIME;OPTIONAL" "DESTINATION" "TARGETS" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_symlink_install_targets() called with " "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # convert target names into absolute files set(target_files "") foreach(target ${ARG_TARGETS}) if(NOT TARGET ${target}) message(FATAL_ERROR "catkin_symlink_install_targets() '${target}' is not a target") endif() get_target_property(is_imported "${target}" IMPORTED) if(is_imported) message(FATAL_ERROR "catkin_symlink_install_targets() " "'${target}' is an imported target") endif() list(APPEND target_files "$") endforeach() string(REPLACE ";" "\" \"" target_files_quoted "\"TARGET_FILES;${target_files}\"") string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") # join destination keyword with kind of target (e.g. ARCHIVE) # to simplify parsing in the next CMake function string(REPLACE "\"ARCHIVE\" \"DESTINATION\"" "\"ARCHIVE_DESTINATION\"" argn_quoted "${argn_quoted}") string(REPLACE "\"LIBRARY\" \"DESTINATION\"" "\"LIBRARY_DESTINATION\"" argn_quoted "${argn_quoted}") string(REPLACE "\"RUNTIME\" \"DESTINATION\"" "\"RUNTIME_DESTINATION\"" argn_quoted "${argn_quoted}") # generate unique files set(generated_file_base "${CMAKE_CURRENT_BINARY_DIR}/catkin_symlink_install_targets_${__CATKIN_SYMLINK_INSTALL_TARGETS_INDEX}") set(generated_file_generator_suffix "${generated_file_base}_$.cmake") set(generated_file_variable_suffix "${generated_file_base}_\${CMAKE_INSTALL_CONFIG_NAME}.cmake") math(EXPR __CATKIN_SYMLINK_INSTALL_TARGETS_INDEX "${__CATKIN_SYMLINK_INSTALL_TARGETS_INDEX} + 1") set(__CATKIN_SYMLINK_INSTALL_TARGETS_INDEX "${__CATKIN_SYMLINK_INSTALL_TARGETS_INDEX}" CACHE INTERNAL "Index for unique symlink install targets") file(GENERATE OUTPUT "${generated_file_generator_suffix}" CONTENT "catkin_symlink_install_targets(${target_files_quoted} ${argn_quoted})\n") catkin_symlink_install_append_install_code( "include(\"${generated_file_variable_suffix}\")" COMMENTS "install(${argn_quoted})" ) endif() endfunction() catkin-0.8.0/cmake/symlink_install/install.cmake000066400000000000000000000001011361264727400217400ustar00rootroot00000000000000# trigger the custom install logic catkin_install_logic(${ARGN}) catkin-0.8.0/cmake/templates/000077500000000000000000000000001361264727400160625ustar00rootroot00000000000000catkin-0.8.0/cmake/templates/Doxyfile.in000066400000000000000000002017471361264727400202100ustar00rootroot00000000000000# Doxyfile 1.7.1 # generated from catkin/cmake/template/Doxyfile.in # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PROJECT_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = api # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST = YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. The create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @doc_sources@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. # INPUT_FILTER = *.hpp # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. # FILTER_PATTERNS = *.py=/usr/bin/doxypy # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = YES #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. # INCLUDE_PATH = ../include # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. # INCLUDE_FILE_PATTERNS = *.hpp # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans.ttf # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES catkin-0.8.0/cmake/templates/__init__.py.in000066400000000000000000000017511361264727400206040ustar00rootroot00000000000000# -*- coding: utf-8 -*- # generated from catkin/cmake/template/__init__.py.in # keep symbol table as clean as possible by deleting all unnecessary symbols from os import path as os_path from pkgutil import extend_path from sys import path as sys_path __extended_path = '@PACKAGE_PYTHONPATH@'.split(';') for p in reversed(__extended_path): sys_path.insert(0, p) del p del sys_path __path__ = extend_path(__path__, __name__) del extend_path __execfiles = [] for p in __extended_path: src_init_file = os_path.join(p, __name__ + '.py') if os_path.isfile(src_init_file): __execfiles.append(src_init_file) else: src_init_file = os_path.join(p, __name__, '__init__.py') if os_path.isfile(src_init_file): __execfiles.append(src_init_file) del src_init_file del p del os_path del __extended_path for __execfile in __execfiles: with open(__execfile, 'r') as __fh: exec(__fh.read()) del __fh del __execfile del __execfiles catkin-0.8.0/cmake/templates/_setup_util.py.in000077500000000000000000000317101361264727400214020ustar00rootroot00000000000000#!@PYTHON_EXECUTABLE@ # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """This file generates shell code for the setup.SHELL scripts to set environment variables.""" from __future__ import print_function import argparse import copy import errno import os import platform import sys CATKIN_MARKER_FILE = '.catkin' system = platform.system() IS_DARWIN = (system == 'Darwin') IS_WINDOWS = (system == 'Windows') PATH_TO_ADD_SUFFIX = ['@CATKIN_GLOBAL_BIN_DESTINATION@'] if IS_WINDOWS: # while catkin recommends putting dll's into bin, 3rd party packages often put dll's into lib # since Windows finds dll's via the PATH variable, prepend it with path to lib PATH_TO_ADD_SUFFIX.extend([@CATKIN_LIB_ENVIRONMENT_PATHS@]) # subfolder of workspace prepended to CMAKE_PREFIX_PATH ENV_VAR_SUBFOLDERS = { 'CMAKE_PREFIX_PATH': '', 'LD_LIBRARY_PATH' if not IS_DARWIN else 'DYLD_LIBRARY_PATH': @CATKIN_LIB_ENVIRONMENT_PATHS@, 'PATH': PATH_TO_ADD_SUFFIX, 'PKG_CONFIG_PATH': @CATKIN_PKGCONFIG_ENVIRONMENT_PATHS@, 'PYTHONPATH': '@PYTHON_INSTALL_DIR@', } def rollback_env_variables(environ, env_var_subfolders): """ Generate shell code to reset environment variables. by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH. This does not cover modifications performed by environment hooks. """ lines = [] unmodified_environ = copy.copy(environ) for key in sorted(env_var_subfolders.keys()): subfolders = env_var_subfolders[key] if not isinstance(subfolders, list): subfolders = [subfolders] value = _rollback_env_variable(unmodified_environ, key, subfolders) if value is not None: environ[key] = value lines.append(assignment(key, value)) if lines: lines.insert(0, comment('reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH')) return lines def _rollback_env_variable(environ, name, subfolders): """ For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder. :param subfolders: list of str '' or subfoldername that may start with '/' :returns: the updated value of the environment variable. """ value = environ[name] if name in environ else '' env_paths = [path for path in value.split(os.pathsep) if path] value_modified = False for subfolder in subfolders: if subfolder: if subfolder.startswith(os.path.sep) or (os.path.altsep and subfolder.startswith(os.path.altsep)): subfolder = subfolder[1:] if subfolder.endswith(os.path.sep) or (os.path.altsep and subfolder.endswith(os.path.altsep)): subfolder = subfolder[:-1] for ws_path in _get_workspaces(environ, include_fuerte=True, include_non_existing=True): path_to_find = os.path.join(ws_path, subfolder) if subfolder else ws_path path_to_remove = None for env_path in env_paths: env_path_clean = env_path[:-1] if env_path and env_path[-1] in [os.path.sep, os.path.altsep] else env_path if env_path_clean == path_to_find: path_to_remove = env_path break if path_to_remove: env_paths.remove(path_to_remove) value_modified = True new_value = os.pathsep.join(env_paths) return new_value if value_modified else None def _get_workspaces(environ, include_fuerte=False, include_non_existing=False): """ Based on CMAKE_PREFIX_PATH return all catkin workspaces. :param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool`` """ # get all cmake prefix paths env_name = 'CMAKE_PREFIX_PATH' value = environ[env_name] if env_name in environ else '' paths = [path for path in value.split(os.pathsep) if path] # remove non-workspace paths workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE)) or (include_fuerte and path.startswith('/opt/ros/fuerte')) or (include_non_existing and not os.path.exists(path))] return workspaces def prepend_env_variables(environ, env_var_subfolders, workspaces): """Generate shell code to prepend environment variables for the all workspaces.""" lines = [] lines.append(comment('prepend folders of workspaces to environment variables')) paths = [path for path in workspaces.split(os.pathsep) if path] prefix = _prefix_env_variable(environ, 'CMAKE_PREFIX_PATH', paths, '') lines.append(prepend(environ, 'CMAKE_PREFIX_PATH', prefix)) for key in sorted(key for key in env_var_subfolders.keys() if key != 'CMAKE_PREFIX_PATH'): subfolder = env_var_subfolders[key] prefix = _prefix_env_variable(environ, key, paths, subfolder) lines.append(prepend(environ, key, prefix)) return lines def _prefix_env_variable(environ, name, paths, subfolders): """ Return the prefix to prepend to the environment variable NAME. Adding any path in NEW_PATHS_STR without creating duplicate or empty items. """ value = environ[name] if name in environ else '' environ_paths = [path for path in value.split(os.pathsep) if path] checked_paths = [] for path in paths: if not isinstance(subfolders, list): subfolders = [subfolders] for subfolder in subfolders: path_tmp = path if subfolder: path_tmp = os.path.join(path_tmp, subfolder) # skip nonexistent paths if not os.path.exists(path_tmp): continue # exclude any path already in env and any path we already added if path_tmp not in environ_paths and path_tmp not in checked_paths: checked_paths.append(path_tmp) prefix_str = os.pathsep.join(checked_paths) if prefix_str != '' and environ_paths: prefix_str += os.pathsep return prefix_str def assignment(key, value): if not IS_WINDOWS: return 'export %s="%s"' % (key, value) else: return 'set %s=%s' % (key, value) def comment(msg): if not IS_WINDOWS: return '# %s' % msg else: return 'REM %s' % msg def prepend(environ, key, prefix): if key not in environ or not environ[key]: return assignment(key, prefix) if not IS_WINDOWS: return 'export %s="%s$%s"' % (key, prefix, key) else: return 'set %s=%s%%%s%%' % (key, prefix, key) def find_env_hooks(environ, cmake_prefix_path): """Generate shell code with found environment hooks for the all workspaces.""" lines = [] lines.append(comment('found environment hooks in workspaces')) generic_env_hooks = [] generic_env_hooks_workspace = [] specific_env_hooks = [] specific_env_hooks_workspace = [] generic_env_hooks_by_filename = {} specific_env_hooks_by_filename = {} generic_env_hook_ext = 'bat' if IS_WINDOWS else 'sh' specific_env_hook_ext = environ['CATKIN_SHELL'] if not IS_WINDOWS and 'CATKIN_SHELL' in environ and environ['CATKIN_SHELL'] else None # remove non-workspace paths workspaces = [path for path in cmake_prefix_path.split(os.pathsep) if path and os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))] for workspace in reversed(workspaces): env_hook_dir = os.path.join(workspace, 'etc', 'catkin', 'profile.d') if os.path.isdir(env_hook_dir): for filename in sorted(os.listdir(env_hook_dir)): if filename.endswith('.%s' % generic_env_hook_ext): # remove previous env hook with same name if present if filename in generic_env_hooks_by_filename: i = generic_env_hooks.index(generic_env_hooks_by_filename[filename]) generic_env_hooks.pop(i) generic_env_hooks_workspace.pop(i) # append env hook generic_env_hooks.append(os.path.join(env_hook_dir, filename)) generic_env_hooks_workspace.append(workspace) generic_env_hooks_by_filename[filename] = generic_env_hooks[-1] elif specific_env_hook_ext is not None and filename.endswith('.%s' % specific_env_hook_ext): # remove previous env hook with same name if present if filename in specific_env_hooks_by_filename: i = specific_env_hooks.index(specific_env_hooks_by_filename[filename]) specific_env_hooks.pop(i) specific_env_hooks_workspace.pop(i) # append env hook specific_env_hooks.append(os.path.join(env_hook_dir, filename)) specific_env_hooks_workspace.append(workspace) specific_env_hooks_by_filename[filename] = specific_env_hooks[-1] env_hooks = generic_env_hooks + specific_env_hooks env_hooks_workspace = generic_env_hooks_workspace + specific_env_hooks_workspace count = len(env_hooks) lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_COUNT', count)) for i in range(count): lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d' % i, env_hooks[i])) lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d_WORKSPACE' % i, env_hooks_workspace[i])) return lines def _parse_arguments(args=None): parser = argparse.ArgumentParser(description='Generates code blocks for the setup.SHELL script.') parser.add_argument('--extend', action='store_true', help='Skip unsetting previous environment variables to extend context') parser.add_argument('--local', action='store_true', help='Only consider this prefix path and ignore other prefix path in the environment') return parser.parse_known_args(args=args)[0] if __name__ == '__main__': try: try: args = _parse_arguments() except Exception as e: print(e, file=sys.stderr) sys.exit(1) if not args.local: # environment at generation time CMAKE_PREFIX_PATH = '@CMAKE_PREFIX_PATH_AS_IS@'.split(';') else: # don't consider any other prefix path than this one CMAKE_PREFIX_PATH = [] # prepend current workspace if not already part of CPP base_path = os.path.dirname(__file__) # CMAKE_PREFIX_PATH uses forward slash on all platforms, but __file__ is platform dependent # base_path on Windows contains backward slashes, need to be converted to forward slashes before comparison if os.path.sep != '/': base_path = base_path.replace(os.path.sep, '/') if base_path not in CMAKE_PREFIX_PATH: CMAKE_PREFIX_PATH.insert(0, base_path) CMAKE_PREFIX_PATH = os.pathsep.join(CMAKE_PREFIX_PATH) environ = dict(os.environ) lines = [] if not args.extend: lines += rollback_env_variables(environ, ENV_VAR_SUBFOLDERS) lines += prepend_env_variables(environ, ENV_VAR_SUBFOLDERS, CMAKE_PREFIX_PATH) lines += find_env_hooks(environ, CMAKE_PREFIX_PATH) print('\n'.join(lines)) # need to explicitly flush the output sys.stdout.flush() except IOError as e: # and catch potential "broken pipe" if stdout is not writable # which can happen when piping the output to a file but the disk is full if e.errno == errno.EPIPE: print(e, file=sys.stderr) sys.exit(2) raise sys.exit(0) catkin-0.8.0/cmake/templates/cfg-extras.context.py.in000066400000000000000000000030541361264727400225710ustar00rootroot00000000000000# generated from catkin/cmake/template/cfg-extras.context.py.in DEVELSPACE = '@DEVELSPACE@' == 'TRUE' INSTALLSPACE = '@INSTALLSPACE@' == 'TRUE' CATKIN_DEVEL_PREFIX = '@CATKIN_DEVEL_PREFIX@' CATKIN_GLOBAL_BIN_DESTINATION = '@CATKIN_GLOBAL_BIN_DESTINATION@' CATKIN_GLOBAL_ETC_DESTINATION = '@CATKIN_GLOBAL_ETC_DESTINATION@' CATKIN_GLOBAL_INCLUDE_DESTINATION = '@CATKIN_GLOBAL_INCLUDE_DESTINATION@' CATKIN_GLOBAL_LIB_DESTINATION = '@CATKIN_GLOBAL_LIB_DESTINATION@' CATKIN_GLOBAL_LIBEXEC_DESTINATION = '@CATKIN_GLOBAL_LIBEXEC_DESTINATION@' CATKIN_GLOBAL_PYTHON_DESTINATION = '@CATKIN_GLOBAL_PYTHON_DESTINATION@' CATKIN_GLOBAL_SHARE_DESTINATION = '@CATKIN_GLOBAL_SHARE_DESTINATION@' CATKIN_PACKAGE_BIN_DESTINATION = '@CATKIN_PACKAGE_BIN_DESTINATION@' CATKIN_PACKAGE_ETC_DESTINATION = '@CATKIN_PACKAGE_ETC_DESTINATION@' CATKIN_PACKAGE_INCLUDE_DESTINATION = '@CATKIN_PACKAGE_INCLUDE_DESTINATION@' CATKIN_PACKAGE_LIB_DESTINATION = '@CATKIN_PACKAGE_LIB_DESTINATION@' CATKIN_PACKAGE_LIBEXEC_DESTINATION = '@CATKIN_PACKAGE_LIBEXEC_DESTINATION@' CATKIN_PACKAGE_PYTHON_DESTINATION = '@CATKIN_PACKAGE_PYTHON_DESTINATION@' CATKIN_PACKAGE_SHARE_DESTINATION = '@CATKIN_PACKAGE_SHARE_DESTINATION@' CMAKE_BINARY_DIR = '@CMAKE_BINARY_DIR@' CMAKE_CURRENT_BINARY_DIR = '@CMAKE_CURRENT_BINARY_DIR@' CMAKE_CURRENT_SOURCE_DIR = '@CMAKE_CURRENT_SOURCE_DIR@' CMAKE_INSTALL_PREFIX = '@CMAKE_INSTALL_PREFIX@' CMAKE_SOURCE_DIR = '@CMAKE_SOURCE_DIR@' PKG_CMAKE_DIR = '@PKG_CMAKE_DIR@' PROJECT_NAME = '@PROJECT_NAME@' PROJECT_BINARY_DIR = '@PROJECT_BINARY_DIR@' PROJECT_SOURCE_DIR = '@PROJECT_SOURCE_DIR@' catkin-0.8.0/cmake/templates/env-hook.context.py.in000066400000000000000000000030321361264727400222500ustar00rootroot00000000000000# generated from catkin/cmake/template/env-hook.context.py.in DEVELSPACE = @DEVELSPACE@ INSTALLSPACE = @INSTALLSPACE@ CATKIN_DEVEL_PREFIX = '@CATKIN_DEVEL_PREFIX@' CATKIN_GLOBAL_BIN_DESTINATION = '@CATKIN_GLOBAL_BIN_DESTINATION@' CATKIN_GLOBAL_ETC_DESTINATION = '@CATKIN_GLOBAL_ETC_DESTINATION@' CATKIN_GLOBAL_INCLUDE_DESTINATION = '@CATKIN_GLOBAL_INCLUDE_DESTINATION@' CATKIN_GLOBAL_LIB_DESTINATION = '@CATKIN_GLOBAL_LIB_DESTINATION@' CATKIN_GLOBAL_LIBEXEC_DESTINATION = '@CATKIN_GLOBAL_LIBEXEC_DESTINATION@' CATKIN_GLOBAL_PYTHON_DESTINATION = '@CATKIN_GLOBAL_PYTHON_DESTINATION@' CATKIN_GLOBAL_SHARE_DESTINATION = '@CATKIN_GLOBAL_SHARE_DESTINATION@' CATKIN_PACKAGE_BIN_DESTINATION = '@CATKIN_PACKAGE_BIN_DESTINATION@' CATKIN_PACKAGE_ETC_DESTINATION = '@CATKIN_PACKAGE_ETC_DESTINATION@' CATKIN_PACKAGE_INCLUDE_DESTINATION = '@CATKIN_PACKAGE_INCLUDE_DESTINATION@' CATKIN_PACKAGE_LIB_DESTINATION = '@CATKIN_PACKAGE_LIB_DESTINATION@' CATKIN_PACKAGE_LIBEXEC_DESTINATION = '@CATKIN_PACKAGE_LIBEXEC_DESTINATION@' CATKIN_PACKAGE_PYTHON_DESTINATION = '@CATKIN_PACKAGE_PYTHON_DESTINATION@' CATKIN_PACKAGE_SHARE_DESTINATION = '@CATKIN_PACKAGE_SHARE_DESTINATION@' CMAKE_BINARY_DIR = '@CMAKE_BINARY_DIR@' CMAKE_CURRENT_BINARY_DIR = '@CMAKE_CURRENT_BINARY_DIR@' CMAKE_CURRENT_SOURCE_DIR = '@CMAKE_CURRENT_SOURCE_DIR@' CMAKE_INSTALL_PREFIX = '@CMAKE_INSTALL_PREFIX@' CMAKE_SOURCE_DIR = '@CMAKE_SOURCE_DIR@' PROJECT_NAME = '@PROJECT_NAME@' PROJECT_BINARY_DIR = '@PROJECT_BINARY_DIR@' PROJECT_SOURCE_DIR = '@PROJECT_SOURCE_DIR@' PYTHON_EXECUTABLE = '@PYTHON_EXECUTABLE@' catkin-0.8.0/cmake/templates/env.bat.in000066400000000000000000000004621361264727400177510ustar00rootroot00000000000000@echo off REM generated from catkin/cmake/templates/env.bat.in if "%1"=="" ( echo "Usage: env.bat COMMANDS" echo "Calling env.bat without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually." exit 1 ) else ( call "@SETUP_DIR@/@SETUP_FILENAME@.bat" %* ) catkin-0.8.0/cmake/templates/env.sh.in000077500000000000000000000010201361264727400176070ustar00rootroot00000000000000#!/usr/bin/env sh # generated from catkin/cmake/templates/env.sh.in if [ $# -eq 0 ] ; then /bin/echo "Usage: env.sh COMMANDS" /bin/echo "Calling env.sh without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually." exit 1 fi # ensure to not use different shell type which was set before CATKIN_SHELL=sh # source @SETUP_FILENAME@.sh from same directory as this file _CATKIN_SETUP_DIR=$(cd "`dirname "$0"`" > /dev/null && pwd) . "$_CATKIN_SETUP_DIR/@SETUP_FILENAME@.sh" exec "$@" catkin-0.8.0/cmake/templates/generate_cached_setup.py.in000066400000000000000000000023051361264727400233420ustar00rootroot00000000000000# -*- coding: utf-8 -*- from __future__ import print_function import os import stat import sys # find the import for catkin's python package - either from source space or from an installed underlay if os.path.exists(os.path.join('@catkin_EXTRAS_DIR@', 'catkinConfig.cmake.in')): sys.path.insert(0, os.path.join('@catkin_EXTRAS_DIR@', '..', 'python')) try: from catkin.environment_cache import generate_environment_script except ImportError: # search for catkin package in all workspaces and prepend to path for workspace in '@CATKIN_WORKSPACES@'.split(';'): python_path = os.path.join(workspace, '@CATKIN_GLOBAL_PYTHON_DESTINATION@') if os.path.isdir(os.path.join(python_path, 'catkin')): sys.path.insert(0, python_path) break from catkin.environment_cache import generate_environment_script code = generate_environment_script('@CATKIN_DEVEL_PREFIX@/env.@script_ext@') output_filename = '@SETUP_DIR@/@SETUP_FILENAME@.@script_ext@' with open(output_filename, 'w') as f: # print('Generate script for cached setup "%s"' % output_filename) f.write('\n'.join(code)) mode = os.stat(output_filename).st_mode os.chmod(output_filename, mode | stat.S_IXUSR) catkin-0.8.0/cmake/templates/local_setup.bash.in000066400000000000000000000004331361264727400216400ustar00rootroot00000000000000#!/usr/bin/env bash # generated from catkin/cmake/templates/local_setup.bash.in CATKIN_SHELL=bash # source setup.sh from same directory as this file _CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd) . "$_CATKIN_SETUP_DIR/setup.sh" --extend --local catkin-0.8.0/cmake/templates/local_setup.bat.in000066400000000000000000000002641361264727400214730ustar00rootroot00000000000000@echo off REM generated from catkin/cmake/template/local_setup.bat.in set _CATKIN_SETUP_DIR=@SETUP_DIR@ call %_CATKIN_SETUP_DIR%/setup.bat --extend --local set _CATKIN_SETUP_DIR= catkin-0.8.0/cmake/templates/local_setup.sh.in000066400000000000000000000005261361264727400213400ustar00rootroot00000000000000#!/usr/bin/env sh # generated from catkin/cmake/template/local_setup.sh.in # since this file is sourced either use the provided _CATKIN_SETUP_DIR # or fall back to the destination set at configure time : ${_CATKIN_SETUP_DIR:=@SETUP_DIR@} CATKIN_SETUP_UTIL_ARGS="--extend --local" . "$_CATKIN_SETUP_DIR/setup.sh" unset CATKIN_SETUP_UTIL_ARGS catkin-0.8.0/cmake/templates/local_setup.zsh.in000066400000000000000000000004451361264727400215320ustar00rootroot00000000000000#!/usr/bin/env zsh # generated from catkin/cmake/templates/local_setup.zsh.in CATKIN_SHELL=zsh # source setup.sh from same directory as this file _CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd) emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh" --extend --local' catkin-0.8.0/cmake/templates/order_packages.context.py.in000066400000000000000000000006571361264727400235050ustar00rootroot00000000000000# generated from catkin/cmake/template/order_packages.context.py.in source_root_dir = '@CMAKE_CURRENT_SOURCE_DIR@' whitelisted_packages = '@CATKIN_WHITELIST_PACKAGES@'.split(';') if '@CATKIN_WHITELIST_PACKAGES@' != '' else [] blacklisted_packages = '@CATKIN_BLACKLIST_PACKAGES@'.split(';') if '@CATKIN_BLACKLIST_PACKAGES@' != '' else [] underlay_workspaces = '@CATKIN_WORKSPACES@'.split(';') if '@CATKIN_WORKSPACES@' != '' else [] catkin-0.8.0/cmake/templates/pkg.context.pc.in000066400000000000000000000010611361264727400212550ustar00rootroot00000000000000# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "@CATKIN_PACKAGE_PREFIX@" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "@PROJECT_PKG_CONFIG_INCLUDE_DIRS@".split(';') if "@PROJECT_PKG_CONFIG_INCLUDE_DIRS@" != "" else [] PROJECT_CATKIN_DEPENDS = "@_PROJECT_CATKIN_DEPENDS@".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "@PKG_CONFIG_LIBRARIES_WITH_PREFIX@".split(';') if "@PKG_CONFIG_LIBRARIES_WITH_PREFIX@" != "" else [] PROJECT_NAME = "@PROJECT_NAME@" PROJECT_SPACE_DIR = "@PROJECT_SPACE_DIR@" PROJECT_VERSION = "@PROJECT_VERSION@" catkin-0.8.0/cmake/templates/pkgConfig-version.cmake.in000066400000000000000000000006661361264727400230730ustar00rootroot00000000000000# generated from catkin/cmake/template/pkgConfig-version.cmake.in set(PACKAGE_VERSION "@PROJECT_VERSION@") set(PACKAGE_VERSION_EXACT False) set(PACKAGE_VERSION_COMPATIBLE False) if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") set(PACKAGE_VERSION_EXACT True) set(PACKAGE_VERSION_COMPATIBLE True) endif() if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}") set(PACKAGE_VERSION_COMPATIBLE True) endif() catkin-0.8.0/cmake/templates/pkgConfig.cmake.in000066400000000000000000000222771361264727400214120ustar00rootroot00000000000000# generated from catkin/cmake/template/pkgConfig.cmake.in # append elements to a list and remove existing duplicates from the list # copied from catkin/cmake/list_append_deduplicate.cmake to keep pkgConfig # self contained macro(_list_append_deduplicate listname) if(NOT "${ARGN}" STREQUAL "") if(${listname}) list(REMOVE_ITEM ${listname} ${ARGN}) endif() list(APPEND ${listname} ${ARGN}) endif() endmacro() # append elements to a list if they are not already in the list # copied from catkin/cmake/list_append_unique.cmake to keep pkgConfig # self contained macro(_list_append_unique listname) foreach(_item ${ARGN}) list(FIND ${listname} ${_item} _index) if(_index EQUAL -1) list(APPEND ${listname} ${_item}) endif() endforeach() endmacro() # pack a list of libraries with optional build configuration keywords # copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig # self contained macro(_pack_libraries_with_build_configuration VAR) set(${VAR} "") set(_argn ${ARGN}) list(LENGTH _argn _count) set(_index 0) while(${_index} LESS ${_count}) list(GET _argn ${_index} lib) if("${lib}" MATCHES "^(debug|optimized|general)$") math(EXPR _index "${_index} + 1") if(${_index} EQUAL ${_count}) message(FATAL_ERROR "_pack_libraries_with_build_configuration() the list of libraries '${ARGN}' ends with '${lib}' which is a build configuration keyword and must be followed by a library") endif() list(GET _argn ${_index} library) list(APPEND ${VAR} "${lib}${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}") else() list(APPEND ${VAR} "${lib}") endif() math(EXPR _index "${_index} + 1") endwhile() endmacro() # unpack a list of libraries with optional build configuration keyword prefixes # copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig # self contained macro(_unpack_libraries_with_build_configuration VAR) set(${VAR} "") foreach(lib ${ARGN}) string(REGEX REPLACE "^(debug|optimized|general)${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" lib "${lib}") list(APPEND ${VAR} "${lib}") endforeach() endmacro() if(@PROJECT_NAME@_CONFIG_INCLUDED) return() endif() set(@PROJECT_NAME@_CONFIG_INCLUDED TRUE) # set variables for source/devel/install prefixes if("@DEVELSPACE@" STREQUAL "TRUE") set(@PROJECT_NAME@_SOURCE_PREFIX @CMAKE_CURRENT_SOURCE_DIR@) set(@PROJECT_NAME@_DEVEL_PREFIX @CATKIN_DEVEL_PREFIX@) set(@PROJECT_NAME@_INSTALL_PREFIX "") set(@PROJECT_NAME@_PREFIX ${@PROJECT_NAME@_DEVEL_PREFIX}) else() set(@PROJECT_NAME@_SOURCE_PREFIX "") set(@PROJECT_NAME@_DEVEL_PREFIX "") set(@PROJECT_NAME@_INSTALL_PREFIX @CMAKE_INSTALL_PREFIX@) set(@PROJECT_NAME@_PREFIX ${@PROJECT_NAME@_INSTALL_PREFIX}) endif() # warn when using a deprecated package if(NOT "@PROJECT_DEPRECATED@" STREQUAL "") set(_msg "WARNING: package '@PROJECT_NAME@' is deprecated") # append custom deprecation text if available if(NOT "@PROJECT_DEPRECATED@" STREQUAL "TRUE") set(_msg "${_msg} (@PROJECT_DEPRECATED@)") endif() message("${_msg}") endif() # flag project as catkin-based to distinguish if a find_package()-ed project is a catkin project set(@PROJECT_NAME@_FOUND_CATKIN_PROJECT TRUE) if(NOT "@PROJECT_CMAKE_CONFIG_INCLUDE_DIRS@ " STREQUAL " ") set(@PROJECT_NAME@_INCLUDE_DIRS "") set(_include_dirs "@PROJECT_CMAKE_CONFIG_INCLUDE_DIRS@") if(NOT "@PROJECT_URL_BUGTRACKER@ " STREQUAL " ") set(_report "Check the issue tracker '@PROJECT_URL_BUGTRACKER@' and consider creating a ticket if the problem has not been reported yet.") elseif(NOT "@PROJECT_URL_WEBSITE@ " STREQUAL " ") set(_report "Check the website '@PROJECT_URL_WEBSITE@' for information and consider reporting the problem.") else() set(_report "Report the problem to the maintainer '@PROJECT_MAINTAINER@' and request to fix the problem.") endif() foreach(idir ${_include_dirs}) if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir}) set(include ${idir}) elseif("${idir} " STREQUAL "@CATKIN_GLOBAL_INCLUDE_DESTINATION@ ") get_filename_component(include "${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@" ABSOLUTE) if(NOT IS_DIRECTORY ${include}) message(FATAL_ERROR "Project '@PROJECT_NAME@' specifies '${idir}' as an include dir, which is not found. It does not exist in '${include}'. ${_report}") endif() else() message(FATAL_ERROR "Project '@PROJECT_NAME@' specifies '${idir}' as an include dir, which is not found. It does neither exist as an absolute directory nor in '@PKG_INCLUDE_PREFIX@/${idir}'. ${_report}") endif() _list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS ${include}) endforeach() endif() set(libraries "@PKG_CONFIG_LIBRARIES@") foreach(library ${libraries}) # keep build configuration keywords, target names and absolute libraries as-is if("${library}" MATCHES "^(debug|optimized|general)$") list(APPEND @PROJECT_NAME@_LIBRARIES ${library}) elseif(${library} MATCHES "^-l") list(APPEND @PROJECT_NAME@_LIBRARIES ${library}) elseif(${library} MATCHES "^-") # This is a linker flag/option (like -pthread) # There's no standard variable for these, so create an interface library to hold it if(NOT @PROJECT_NAME@_NUM_DUMMY_TARGETS) set(@PROJECT_NAME@_NUM_DUMMY_TARGETS 0) endif() # Make sure the target name is unique set(interface_target_name "catkin::@PROJECT_NAME@::wrapped-linker-option${@PROJECT_NAME@_NUM_DUMMY_TARGETS}") while(TARGET "${interface_target_name}") math(EXPR @PROJECT_NAME@_NUM_DUMMY_TARGETS "${@PROJECT_NAME@_NUM_DUMMY_TARGETS}+1") set(interface_target_name "catkin::@PROJECT_NAME@::wrapped-linker-option${@PROJECT_NAME@_NUM_DUMMY_TARGETS}") endwhile() add_library("${interface_target_name}" INTERFACE IMPORTED) if("${CMAKE_VERSION}" VERSION_LESS "3.13.0") set_property( TARGET "${interface_target_name}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${library}") else() target_link_options("${interface_target_name}" INTERFACE "${library}") endif() list(APPEND @PROJECT_NAME@_LIBRARIES "${interface_target_name}") elseif(TARGET ${library}) list(APPEND @PROJECT_NAME@_LIBRARIES ${library}) elseif(IS_ABSOLUTE ${library}) list(APPEND @PROJECT_NAME@_LIBRARIES ${library}) else() set(lib_path "") set(lib "${library}-NOTFOUND") # since the path where the library is found is returned we have to iterate over the paths manually foreach(path @PKG_CONFIG_LIB_PATHS@) find_library(lib ${library} PATHS ${path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) if(lib) set(lib_path ${path}) break() endif() endforeach() if(lib) _list_append_unique(@PROJECT_NAME@_LIBRARY_DIRS ${lib_path}) list(APPEND @PROJECT_NAME@_LIBRARIES ${lib}) else() # as a fall back for non-catkin libraries try to search globally find_library(lib ${library}) if(NOT lib) message(FATAL_ERROR "Project '${PROJECT_NAME}' tried to find library '${library}'. The library is neither a target nor built/installed properly. Did you compile project '@PROJECT_NAME@'? Did you find_package() it before the subdirectory containing its code is included?") endif() list(APPEND @PROJECT_NAME@_LIBRARIES ${lib}) endif() endif() endforeach() set(@PROJECT_NAME@_EXPORTED_TARGETS "@PKG_EXPORTED_TARGETS@") # create dummy targets for exported code generation targets to make life of users easier foreach(t ${@PROJECT_NAME@_EXPORTED_TARGETS}) if(NOT TARGET ${t}) add_custom_target(${t}) endif() endforeach() set(depends "@PROJECT_DEPENDENCIES@") foreach(depend ${depends}) string(REPLACE " " ";" depend_list ${depend}) # the package name of the dependency must be kept in a unique variable so that it is not overwritten in recursive calls list(GET depend_list 0 @PROJECT_NAME@_dep) list(LENGTH depend_list count) if(${count} EQUAL 1) # simple dependencies must only be find_package()-ed once if(NOT ${@PROJECT_NAME@_dep}_FOUND) find_package(${@PROJECT_NAME@_dep} REQUIRED NO_MODULE) endif() else() # dependencies with components must be find_package()-ed again list(REMOVE_AT depend_list 0) find_package(${@PROJECT_NAME@_dep} REQUIRED NO_MODULE ${depend_list}) endif() _list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS ${${@PROJECT_NAME@_dep}_INCLUDE_DIRS}) # merge build configuration keywords with library names to correctly deduplicate _pack_libraries_with_build_configuration(@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIBRARIES}) _pack_libraries_with_build_configuration(_libraries ${${@PROJECT_NAME@_dep}_LIBRARIES}) _list_append_deduplicate(@PROJECT_NAME@_LIBRARIES ${_libraries}) # undo build configuration keyword merging after deduplication _unpack_libraries_with_build_configuration(@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIBRARIES}) _list_append_unique(@PROJECT_NAME@_LIBRARY_DIRS ${${@PROJECT_NAME@_dep}_LIBRARY_DIRS}) list(APPEND @PROJECT_NAME@_EXPORTED_TARGETS ${${@PROJECT_NAME@_dep}_EXPORTED_TARGETS}) endforeach() set(pkg_cfg_extras "@PKG_CFG_EXTRAS@") foreach(extra ${pkg_cfg_extras}) if(NOT IS_ABSOLUTE ${extra}) set(extra ${@PROJECT_NAME@_DIR}/${extra}) endif() include(${extra}) endforeach() catkin-0.8.0/cmake/templates/python_distutils_install.bat.in000066400000000000000000000012101361264727400243240ustar00rootroot00000000000000@echo off if DEFINED DESTDIR ( echo "Destdir.............%DESTDIR%" set DESTDIR_ARG="--root=%DESTDIR%" ) cd "@INSTALL_CMD_WORKING_DIRECTORY@" mkdir "@CMAKE_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@" set "PYTHONPATH=@CMAKE_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@;@CMAKE_BINARY_DIR@\@PYTHON_INSTALL_DIR@" set "CATKIN_BINARY_DIR=@CMAKE_BINARY_DIR@" "@PYTHON_EXECUTABLE@" ^ "@CMAKE_CURRENT_SOURCE_DIR@\setup.py" ^ build --build-base "@CMAKE_CURRENT_BINARY_DIR@" ^ install %DESTDIR_ARG% @SETUPTOOLS_ARG_EXTRA@ ^ --prefix="@SETUPTOOLS_INSTALL_PREFIX@" ^ --install-scripts="@SETUPTOOLS_INSTALL_PREFIX@\@CATKIN_GLOBAL_BIN_DESTINATION@" catkin-0.8.0/cmake/templates/python_distutils_install.sh.in000077500000000000000000000022151361264727400242010ustar00rootroot00000000000000#!/bin/sh if [ -n "$DESTDIR" ] ; then case $DESTDIR in /*) # ok ;; *) /bin/echo "DESTDIR argument must be absolute... " /bin/echo "otherwise python's distutils will bork things." exit 1 esac DESTDIR_ARG="--root=$DESTDIR" fi echo_and_run() { echo "+ $@" ; "$@" ; } echo_and_run cd "@INSTALL_CMD_WORKING_DIRECTORY@" # ensure that Python install destination exists echo_and_run mkdir -p "$DESTDIR@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@" # Note that PYTHONPATH is pulled from the environment to support installing # into one location when some dependencies were installed in another # location, #123. echo_and_run /usr/bin/env \ PYTHONPATH="@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@:@CMAKE_BINARY_DIR@/@PYTHON_INSTALL_DIR@:$PYTHONPATH" \ CATKIN_BINARY_DIR="@CMAKE_BINARY_DIR@" \ "@PYTHON_EXECUTABLE@" \ "@CMAKE_CURRENT_SOURCE_DIR@/setup.py" \ build --build-base "@CMAKE_CURRENT_BINARY_DIR@" \ install \ $DESTDIR_ARG \ @SETUPTOOLS_ARG_EXTRA@ --prefix="@CMAKE_INSTALL_PREFIX@" --install-scripts="@CMAKE_INSTALL_PREFIX@/@CATKIN_GLOBAL_BIN_DESTINATION@" catkin-0.8.0/cmake/templates/python_win32_wrapper.cpp.in000066400000000000000000000164141361264727400233040ustar00rootroot00000000000000// // Software License Agreement (BSD License) // // Copyright (c) 2011, Yujin Robot // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Yujin Robot nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // /* * @file python_win32_wrapper.cpp * * @brief Launch a Python script located in the same location and have the same name as the compiled executable * * @date March 2011 */ #ifdef _WIN32 #include #include int main(int argc, char* argv[]) try { const auto GetCurrentModuleName = []() -> std::string { char moduleName[MAX_PATH]; // retrieves the path of the executable file of the current process auto result = ::GetModuleFileName(nullptr, moduleName, MAX_PATH); if (!result || result == MAX_PATH) { // If the function fails, the return value is 0 // If the buffer is too small to hold the module name, the return value is MAX_PATH throw ::GetLastError(); } #if defined(DEBUG) fprintf(stderr, "[DEBUG] current module name: %s\n", moduleName); #endif return moduleName; }; const auto FindPythonScript = [](const std::string& exeName) -> std::string { // implement a heuristic here to execute a Python script of the same name // when the executable's name is .exe, assume the Python script to be // e.g. script.exe -> script, script.py.exe -> script.py // note: script.exe will not execute script.py const std::string exeExtension = ".exe"; if (exeName.size() <= exeExtension.size() || exeName.substr(exeName.size() - exeExtension.size()) != exeExtension) { throw L"Invalid name."; } auto scriptName = exeName.substr(0, exeName.size() - exeExtension.size()); #if defined(DEBUG) fprintf(stderr, "[DEBUG] Python script name: %s\n", scriptName.c_str()); #endif // use quoted string to ensure the correct path is used return "\"" + scriptName + "\""; }; const auto GetPythonExecutable = []() -> std::string { std::string pythonExecutable = "@PYTHON_EXECUTABLE@"; #if defined(DEBUG) fprintf(stderr, "[DEBUG] Python executable: %s\n", pythonExecutable.c_str()); #endif // use quoted string to indicate where the file name ends and the arguments begin return "\"" + pythonExecutable + "\""; }; const auto ExecuteCommand = [](std::string command, bool printError = false) -> unsigned long { #if defined(DEBUG) fprintf(stderr, "[DEBUG] command: %s\n", command.c_str()); #endif STARTUPINFO startup_info; PROCESS_INFORMATION process_info; ::memset(&startup_info, 0, sizeof(startup_info)); ::memset(&process_info, 0, sizeof(process_info)); startup_info.cb = sizeof(startup_info); if (!::CreateProcess( nullptr, // program to execute (nullptr = execute command line) &command[0], // command line to execute nullptr, // process security attributes nullptr, // thread security attributes false, // determines if handles from parent process are inherited 0, // no creation flags nullptr, // enviornment (nullptr = use parent's) nullptr, // current directory (nullptr = use parent's) &startup_info, // startup info &process_info // process info )) { const auto error = ::GetLastError(); switch (error) { case ERROR_FILE_NOT_FOUND: { if (printError) { fprintf(stderr, "Error! Python executable in [%s] cannot be found.\n", command.c_str()); } break; } default: if (printError) { fprintf(stderr, "Error! CreateProcess for [%s] failed with error code: %ld\n", command.c_str(), error); } break; } throw error; } ::WaitForSingleObject(process_info.hProcess, INFINITE); unsigned long exitCode = NO_ERROR; ::GetExitCodeProcess(process_info.hProcess, &exitCode); ::CloseHandle(process_info.hProcess); ::CloseHandle(process_info.hThread); #if defined(DEBUG) fprintf(stderr, "[DEBUG] process exist code: %ld\n", exitCode); #endif return exitCode; }; #if defined(DEBUG) fprintf(stderr, "[DEBUG] argv:\n"); for (auto i = 0; i < argc; ++i) { fprintf(stderr, "[DEBUG] %d:\t%s\n", i, argv[i]); } #endif auto pythonExecutable = GetPythonExecutable(); try { // check if the Python executable specified at configure time could be found ExecuteCommand(pythonExecutable + " -c \"import sys; sys.exit(0)\""); } catch (...) { if (::GetLastError() == ERROR_FILE_NOT_FOUND) { // Python executable cannot be found, fall back to use Python executable registered in runtime environment pythonExecutable = "python"; } else { throw; } } const auto pythonScript = FindPythonScript(GetCurrentModuleName()); std::string command = pythonExecutable + " " + pythonScript; for (auto i = 1; i < argc; ++i) { command += " "; // use quoted strings to handle spaces within each argument command += " \"" + std::string(argv[i]) + "\""; } return ExecuteCommand(command, true); } catch (...) { fprintf(stderr, "Failed to execute the Python script...\n"); return 1; } #else #error This wrapper should only be created on Windows. int main() { // deliberately add syntax error when the file is not supposed to get compiled return 0 } #endif catkin-0.8.0/cmake/templates/relay.py.in000066400000000000000000000007541361264727400201630ustar00rootroot00000000000000# -*- coding: utf-8 -*- # generated from catkin/cmake/template/relay.py.in # creates a relay to a python script source file, acting as that file. # The purpose is that of a symlink python_script = '@PYTHON_SCRIPT@' with open(python_script, 'r') as fh: context = { '__builtins__': __builtins__, '__doc__': None, '__file__': python_script, '__name__': __name__, '__package__': None, } exec(compile(fh.read(), python_script, 'exec'), context) catkin-0.8.0/cmake/templates/rosinstall.in000066400000000000000000000000631361264727400206030ustar00rootroot00000000000000- setup-file: local-name: @SETUP_DIR@/setup.sh catkin-0.8.0/cmake/templates/safe_execute_install.cmake.in000066400000000000000000000002631361264727400236600ustar00rootroot00000000000000execute_process(COMMAND "@INSTALL_SCRIPT@" RESULT_VARIABLE res) if(NOT res EQUAL 0) message(FATAL_ERROR "execute_process(@INSTALL_SCRIPT@) returned error code ${res}") endif() catkin-0.8.0/cmake/templates/script.bash.in000077500000000000000000000001411361264727400206310ustar00rootroot00000000000000#!/usr/bin/env bash # generated from catkin/cmake/templates/script.bash.in "@BASH_SCRIPT@" "$@" catkin-0.8.0/cmake/templates/script.bat.in000066400000000000000000000001321361264727400204570ustar00rootroot00000000000000@echo off REM generated from catkin/cmake/templates/script.bat.in call "@BAT_SCRIPT@" %* catkin-0.8.0/cmake/templates/script.in000077500000000000000000000000111361264727400177110ustar00rootroot00000000000000@SCRIPT@ catkin-0.8.0/cmake/templates/script.py.in000077500000000000000000000010031361264727400203420ustar00rootroot00000000000000#!@PYTHON_EXECUTABLE@ # -*- coding: utf-8 -*- # generated from catkin/cmake/template/script.py.in # creates a relay to a python script source file, acting as that file. # The purpose is that of a symlink python_script = '@PYTHON_SCRIPT@' with open(python_script, 'r') as fh: context = { '__builtins__': __builtins__, '__doc__': None, '__file__': python_script, '__name__': __name__, '__package__': None, } exec(compile(fh.read(), python_script, 'exec'), context) catkin-0.8.0/cmake/templates/script.sh.in000077500000000000000000000001341361264727400203300ustar00rootroot00000000000000#!/usr/bin/env sh # generated from catkin/cmake/templates/script.sh.in "@EXECUTABLE@" "$@" catkin-0.8.0/cmake/templates/setup.bash.in000066400000000000000000000004041361264727400204640ustar00rootroot00000000000000#!/usr/bin/env bash # generated from catkin/cmake/templates/setup.bash.in CATKIN_SHELL=bash # source setup.sh from same directory as this file _CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd) . "$_CATKIN_SETUP_DIR/setup.sh" catkin-0.8.0/cmake/templates/setup.bat.in000066400000000000000000000051721361264727400203240ustar00rootroot00000000000000@echo off REM generated from catkin/cmake/template/setup.bat.in REM Sets various environment variables and sources additional environment hooks. REM It tries it's best to undo changes from a previously sourced setup file before. REM Supported command line options: REM --extend: skips the undoing of changes from a previously sourced setup file REM --local: only considers this workspace but not the chained ones set _SETUP_UTIL=@SETUP_DIR@/_setup_util.py if NOT EXIST "%_SETUP_UTIL%" ( echo "Missing Python script: %_SETUP_UTIL%" exit 22 ) REM set the Python executable set _PYTHON="@PYTHON_EXECUTABLE@" REM compute Python home and normalize Python executable path set PYTHONHOME= set _PYTHONEXE= for /f "usebackq tokens=*" %%a in ('%_PYTHON%') do ( set PYTHONHOME=%%~dpa set _PYTHONEXE=%%~nxa set _PYTHON="%%~dpa%%~nxa" ) REM add Python home to PATH if necessary to avoid using the wrong Python executable setlocal enabledelayedexpansion set _PYTHON_FOUND= for %%i in (%_PYTHONEXE%) do ( set _PYTHON_FOUND="%%~$PATH:i" ) REM delayed expansion is needed since there could be special characters in the PATH variable if not "!_PYTHON_FOUND!" == "!_PYTHON!" ( set PATH=%PYTHONHOME%;%PYTHONHOME%Scripts;!PATH! ) endlocal & set PATH=%PATH% REM generate pseudo random temporary filename :GenerateTempFilename REM replace leading space of time with zero set _SETUP_TMP=%Time: =0% REM remove time delimiters set _SETUP_TMP=%_SETUP_TMP::=% set _SETUP_TMP=%_SETUP_TMP:.=% set _SETUP_TMP=%_SETUP_TMP:,=% set _SETUP_TMP=%Temp%\setup.%_SETUP_TMP%.bat if EXIST %_SETUP_TMP% do goto GenerateTempFilename type NUL > "%_SETUP_TMP%" if NOT EXIST %_SETUP_TMP% ( echo "Could not create temporary file: %_SETUP_TMP%" exit 1 ) REM invoke Python script to generate necessary exports of environment variables %_PYTHON% "%_SETUP_UTIL%" %* > %_SETUP_TMP% if NOT EXIST %_SETUP_TMP% ( echo "Could not create temporary file: %_SETUP_TMP%" return 1 ) call %_SETUP_TMP% del %_SETUP_TMP% REM source all environment hooks set _HOOK_COUNT=0 :hook_loop if %_HOOK_COUNT% LSS %_CATKIN_ENVIRONMENT_HOOKS_COUNT% ( REM set workspace for environment hook call set CATKIN_ENV_HOOK_WORKSPACE=%%_CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%_WORKSPACE%% set _CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%_WORKSPACE= REM call environment hook call %%_CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%%% set _CATKIN_ENVIRONMENT_HOOKS_%_HOOK_COUNT%= set CATKIN_ENV_HOOK_WORKSPACE= set /a _HOOK_COUNT=%_HOOK_COUNT%+1 goto :hook_loop ) REM unset temporary variables set _SETUP_UTIL= set _PYTHON= set _PYTHONEXE= set _PYTHON_FOUND= set _SETUP_TMP= set _CATKIN_ENVIRONMENT_HOOKS_COUNT= set _HOOK_COUNT= catkin-0.8.0/cmake/templates/setup.sh.in000066400000000000000000000053211361264727400201640ustar00rootroot00000000000000#!/usr/bin/env sh # generated from catkin/cmake/template/setup.sh.in # Sets various environment variables and sources additional environment hooks. # It tries it's best to undo changes from a previously sourced setup file before. # Supported command line options: # --extend: skips the undoing of changes from a previously sourced setup file # --local: only considers this workspace but not the chained ones # In plain sh shell which doesn't support arguments for sourced scripts you can # set the environment variable `CATKIN_SETUP_UTIL_ARGS=--extend/--local` instead. # since this file is sourced either use the provided _CATKIN_SETUP_DIR # or fall back to the destination set at configure time : ${_CATKIN_SETUP_DIR:=@SETUP_DIR@} _SETUP_UTIL="$_CATKIN_SETUP_DIR/_setup_util.py" unset _CATKIN_SETUP_DIR if [ ! -f "$_SETUP_UTIL" ]; then echo "Missing Python script: $_SETUP_UTIL" return 22 fi # detect if running on Darwin platform _UNAME=`uname -s` _IS_DARWIN=0 if [ "$_UNAME" = "Darwin" ]; then _IS_DARWIN=1 fi unset _UNAME # make sure to export all environment variables export CMAKE_PREFIX_PATH if [ $_IS_DARWIN -eq 0 ]; then export LD_LIBRARY_PATH else export DYLD_LIBRARY_PATH fi unset _IS_DARWIN export PATH export PKG_CONFIG_PATH export PYTHONPATH # remember type of shell if not already set if [ -z "$CATKIN_SHELL" ]; then CATKIN_SHELL=sh fi # invoke Python script to generate necessary exports of environment variables # use TMPDIR if it exists, otherwise fall back to /tmp if [ -d "${TMPDIR:-}" ]; then _TMPDIR="${TMPDIR}" else _TMPDIR=/tmp fi _SETUP_TMP=`mktemp "${_TMPDIR}/setup.sh.XXXXXXXXXX"` unset _TMPDIR if [ $? -ne 0 -o ! -f "$_SETUP_TMP" ]; then echo "Could not create temporary file: $_SETUP_TMP" return 1 fi CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ ${CATKIN_SETUP_UTIL_ARGS:-} >> "$_SETUP_TMP" _RC=$? if [ $_RC -ne 0 ]; then if [ $_RC -eq 2 ]; then echo "Could not write the output of '$_SETUP_UTIL' to temporary file '$_SETUP_TMP': may be the disk if full?" else echo "Failed to run '\"$_SETUP_UTIL\" $@': return code $_RC" fi unset _RC unset _SETUP_UTIL rm -f "$_SETUP_TMP" unset _SETUP_TMP return 1 fi unset _RC unset _SETUP_UTIL . "$_SETUP_TMP" rm -f "$_SETUP_TMP" unset _SETUP_TMP # source all environment hooks _i=0 while [ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]; do eval _envfile=\$_CATKIN_ENVIRONMENT_HOOKS_$_i unset _CATKIN_ENVIRONMENT_HOOKS_$_i eval _envfile_workspace=\$_CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE unset _CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE # set workspace for environment hook CATKIN_ENV_HOOK_WORKSPACE=$_envfile_workspace . "$_envfile" unset CATKIN_ENV_HOOK_WORKSPACE _i=$((_i + 1)) done unset _i unset _CATKIN_ENVIRONMENT_HOOKS_COUNT catkin-0.8.0/cmake/templates/setup.zsh.in000066400000000000000000000004161361264727400203560ustar00rootroot00000000000000#!/usr/bin/env zsh # generated from catkin/cmake/templates/setup.zsh.in CATKIN_SHELL=zsh # source setup.sh from same directory as this file _CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd) emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh"' catkin-0.8.0/cmake/test/000077500000000000000000000000001361264727400150435ustar00rootroot00000000000000catkin-0.8.0/cmake/test/catkin_download_test_data.cmake000066400000000000000000000027071361264727400232430ustar00rootroot00000000000000_generate_function_if_testing_is_disabled("catkin_download_test_data") # # Download a file containing test data from a URL. # # It is commonly used to download larger data files for unit tests # which should not be stored in the repository. # # .. note:: It is not recommended to rely on downloaded data during # a configure / make cycle since this prevents building the package # when no network connectivity is available. # # .. note:: The target will be registered as a dependency # of the "tests" and "download_extra_data" targets, but not of "all" target. # # .. note:: If the tests should be run on the ROS buildfarm the URL # must be publically and reliably accessible. # # :param target: the target name # :type target: string # :param url: the url to download # :type url: string # :param DESTINATION: the directory where the file is downloaded to # (default: ${PROJECT_BINARY_DIR}) # :type DESTINATION: string # :param FILENAME: the filename of the downloaded file # (default: the basename of the url) # :type FILENAME: string # :param MD5: the expected md5 hash to compare against # (default: empty, skipping the check) # :type MD5: string # # Additionally, option REQUIRED can be specified. # # @public function(catkin_download_test_data target url) _warn_if_skip_testing("catkin_download_test_data") catkin_download("${target}" "${url}" ${ARGN} EXCLUDE_FROM_ALL) if(TARGET tests) add_dependencies(tests ${target}) endif() endfunction() catkin-0.8.0/cmake/test/download_checkmd5.py000066400000000000000000000132151361264727400207710ustar00rootroot00000000000000from __future__ import print_function import errno import hashlib import os import sys try: from urllib.request import addinfourl, BaseHandler, build_opener, Request, URLError except ImportError: from urllib2 import addinfourl, BaseHandler, build_opener, Request, URLError from argparse import ArgumentParser NAME = 'download_checkmd5.py' class HTTPRangeHandler(BaseHandler): def http_error_206(self, req, fp, code, msg, hdrs): r = addinfourl(fp, hdrs, req.get_full_url()) r.code = code r.msg = msg return r def http_error_416(self, req, fp, code, msg, hdrs): raise URLError('Requested Range Not Satisfiable') def download_with_resume(uri, dest): handler = HTTPRangeHandler() opener = build_opener(handler) offset = 0 content_length = None accept_ranges = False while True: req = Request(uri) if offset: req.add_header('Range', 'bytes=%d-' % offset) src_file = None try: src_file = opener.open(req) headers = src_file.info() if not offset: # on first connection check server capabilities if 'Content-Length' in headers: content_length = int(headers['Content-Length']) if 'Accept-Ranges' in headers: accept_ranges = headers['Accept-Ranges'] != 'none' else: # on resume verify that server understood range header and responded accordingly if 'Content-Range' not in headers: raise IOError('Download aborted and server does not support resuming download') if int(headers['Content-Range'][len('bytes '):].split('-')[0]) != offset: raise IOError('Download aborted because server replied with different content range then requested') sys.stdout.write(' resume from %d...' % offset) sys.stdout.flush() with open(dest, 'ab' if offset else 'wb') as dst_file: progress = False while True: data = src_file.read(8192) if not data: break progress = True dst_file.write(data) offset += len(data) if not progress: # if no bytes have been received abort download raise IOError("No progress when trying to download '%s'" % uri) except Exception: if src_file: src_file.close() raise # when content length is unknown it is assumed that the download is complete if content_length is None: break # or when enough data has been downloaded (> is especially a valid case) if offset >= content_length: break if not accept_ranges: raise IOError('Server does not accept ranges to resume download') def download_md5(uri, dest): """Download file from uri to file dest.""" # Create intermediate directories as necessary, #2970 dirname = os.path.dirname(dest) if len(dirname): try: os.makedirs(dirname) except OSError as e: if e.errno != errno.EEXIST: raise sys.stdout.write('Downloading %s to %s...' % (uri, dest)) sys.stdout.flush() try: download_with_resume(uri, dest) sys.stdout.write(' done.\n') except Exception as e: # delete partially downloaded data if os.path.exists(dest): os.unlink(dest) sys.stdout.write(' failed (%s)!\n' % e) raise def checkmd5(dest, md5sum=None): """ Check file at dest against md5. :returns (boolean, hexdigest): True if dest contents matches md5sum """ if not os.path.exists(dest): return False, 'null' with open(dest, 'rb') as f: md5value = hashlib.md5() while True: buf = f.read(4096) if not buf: break md5value.update(buf) hexdigest = md5value.hexdigest() print('Checking md5sum on %s' % (dest)) return hexdigest == md5sum, hexdigest def main(argv=sys.argv[1:]): """Dowloads URI to file dest and checks md5 if given.""" parser = ArgumentParser(description='Dowloads URI to file dest. If md5sum is given, checks md5sum. If file existed and mismatch, downloads and checks again') parser.add_argument('uri') parser.add_argument('dest') parser.add_argument('md5sum', nargs='?') parser.add_argument('--ignore-error', action='store_true', help='Ignore download errors') args = parser.parse_args(argv) uri = args.uri if '://' not in uri: uri = 'file://' + uri fresh = False if not os.path.exists(args.dest): try: download_md5(uri, args.dest) except Exception: if args.ignore_error: return 0 raise fresh = True if args.md5sum: result, hexdigest = checkmd5(args.dest, args.md5sum) if result is False and fresh is False: print('WARNING: md5sum mismatch (%s != %s); re-downloading file %s' % (hexdigest, args.md5sum, args.dest)) os.remove(args.dest) try: download_md5(uri, args.dest) except Exception: if args.ignore_error: return 0 raise result, hexdigest = checkmd5(args.dest, args.md5sum) if result is False: return 'ERROR: md5sum mismatch (%s != %s) on %s; aborting' % (hexdigest, args.md5sum, args.dest) return 0 if __name__ == '__main__': sys.exit(main()) catkin-0.8.0/cmake/test/gtest.cmake000066400000000000000000000437711361264727400172070ustar00rootroot00000000000000_generate_function_if_testing_is_disabled( "catkin_add_gtest" "catkin_add_gmock") # # Add a GTest based test target. # # An executable target is created with the source files, it is linked # against GTest and added to the set of unit tests. # # .. note:: The test can be executed by calling the binary directly # or using: ``make run_tests_${PROJECT_NAME}_gtest_${target}`` # # :param target: the target name # :type target: string # :param source_files: a list of source files used to build the test # executable # :type source_files: list of strings # :param TIMEOUT: currently not supported # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory when executing the # executable # :type WORKING_DIRECTORY: string # # @public # function(catkin_add_gtest target) _catkin_add_google_test("gtest" ${target} ${ARGN}) endfunction() # # Add a GMock based test target. # # An executable target is created with the source files, it is linked # against GTest and GMock and added to the set of unit tests. # # .. note:: The test can be executed by calling the binary directly # or using: ``make run_tests_${PROJECT_NAME}_gtest_${target}`` # # :param target: the target name # :type target: string # :param source_files: a list of source files used to build the test # executable # :type source_files: list of strings # :param TIMEOUT: currently not supported # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory when executing the # executable # :type WORKING_DIRECTORY: string # # @public # function(catkin_add_gmock target) _catkin_add_google_test("gmock" ${target} ${ARGN}) endfunction() # # This is an internal function, use catkin_add_gtest or catkin_add_gmock # instead. # # :param type: "gtest" or "gmock" # # The remaining arguments are the same as for catkin_add_gtest and # catkin_add_gmock. # function(_catkin_add_google_test type target) if (NOT "${type}" STREQUAL "gtest" AND NOT "${type}" STREQUAL "gmock") message(FATAL_ERROR "Invalid use of _catkin_add_google_test function, " "first argument must be 'gtest' or 'gmock'") endif() _warn_if_skip_testing("catkin_add_${type}") # XXX look for optional TIMEOUT argument, #2645 cmake_parse_arguments(ARG "" "TIMEOUT;WORKING_DIRECTORY" "" ${ARGN}) if(ARG_TIMEOUT) message(WARNING "TIMEOUT argument to catkin_add_${type}() is ignored") endif() _catkin_add_executable_with_google_test(${type} ${target} ${ARG_UNPARSED_ARGUMENTS} EXCLUDE_FROM_ALL) if(TARGET ${target}) # make sure the target is built before running tests add_dependencies(tests ${target}) # XXX we DONT use rosunit to call the executable to get process control, #1629, #3112 get_target_property(_target_path ${target} RUNTIME_OUTPUT_DIRECTORY) set(cmd "${_target_path}/${target} --gtest_output=xml:${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}/gtest-${target}.xml") catkin_run_tests_target("gtest" ${target} "gtest-${target}.xml" COMMAND ${cmd} DEPENDENCIES ${target} WORKING_DIRECTORY ${ARG_WORKING_DIRECTORY}) endif() endfunction() # # Add a GTest executable target. # # An executable target is created with the source files, it is linked # against GTest. # If you also want to register the executable as a test use # ``catkin_add_gtest()`` instead. # # :param target: the target name # :type target: string # :param source_files: a list of source files used to build the test # executable # :type source_files: list of strings # # Additionally, the option EXCLUDE_FROM_ALL can be specified. # @public # function(catkin_add_executable_with_gtest target) _catkin_add_executable_with_google_test("gtest" ${target} ${ARGN}) endfunction() # # Add a GMock executable target. # # An executable target is created with the source files, it is linked # against GTest and GMock. # If you also want to register the executable as a test use # ``catkin_add_gtest()`` instead. # # :param target: the target name # :type target: string # :param source_files: a list of source files used to build the test # executable # :type source_files: list of strings # # Additionally, the option EXCLUDE_FROM_ALL can be specified. # @public # function(catkin_add_executable_with_gmock target) _catkin_add_executable_with_google_test("gmock" ${target} ${ARGN}) endfunction() # # This is an internal function, use catkin_add_executable_with_gtest # or catkin_add_executable_with_gmock instead. # # :param type: "gtest" or "gmock" # # The remaining arguments are the same as for # catkin_add_executable_with_gtest and # catkin_add_executable_with_gmock. # function(_catkin_add_executable_with_google_test type target) if (NOT "${type}" STREQUAL "gtest" AND NOT "${type}" STREQUAL "gmock") message(FATAL_ERROR "Invalid use of _catkin_add_executable_google_test function, first argument must be 'gtest' or 'gmock'") endif() string(TOUPPER "${type}" type_upper) if(NOT ${type_upper}_FOUND AND NOT ${type_upper}_FROM_SOURCE_FOUND) message(WARNING "skipping ${type} '${target}' in project '${PROJECT_NAME}' because ${type} was not found") return() endif() if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) message(FATAL_ERROR "catkin_add_executable_with_${type}() must be called after catkin_package() so that default output directories for the executables are defined") endif() cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "" ${ARGN}) if ("${type}" STREQUAL "gmock") # gmock requires gtest headers and libraries list(APPEND GMOCK_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}) list(APPEND GMOCK_LIBRARY_DIRS ${GTEST_LIBRARY_DIRS}) list(APPEND GMOCK_LIBRARIES ${GTEST_LIBRARIES}) endif() # create the executable, with basic + gtest/gmock build flags include_directories(${${type_upper}_INCLUDE_DIRS}) link_directories(${${type_upper}_LIBRARY_DIRS}) add_executable(${target} ${ARG_UNPARSED_ARGUMENTS}) if(ARG_EXCLUDE_FROM_ALL) set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL TRUE) endif() assert(${type_upper}_LIBRARIES) target_link_libraries(${target} ${${type_upper}_LIBRARIES} ${THREADS_LIBRARY}) endfunction() # Internal function for finding gtest or gmock sources function(_catkin_find_google_source type include_paths src_paths found base_dir include_dir lib_dir libs main_libs) # Find the gtest headers find_file(_${type}_INCLUDES "${type}.h" PATHS ${include_paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Find the gtest sources find_file(_${type}_SOURCES "${type}.cc" PATHS ${src_paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # If we found gtest, set the variables accordingly if(_${type}_INCLUDES AND _${type}_SOURCES) get_filename_component(SOURCE_DIR ${_${type}_SOURCES} PATH) get_filename_component(BASE_DIR ${SOURCE_DIR} PATH) get_filename_component(INCLUDE_DIR ${_${type}_INCLUDES} PATH) get_filename_component(INCLUDE_DIR ${INCLUDE_DIR} PATH) set(${found} TRUE PARENT_SCOPE) set(${base_dir} ${BASE_DIR} PARENT_SCOPE) set(${include_dir} ${INCLUDE_DIR} PARENT_SCOPE) set(${lib_dir} ${CMAKE_BINARY_DIR}/${type} PARENT_SCOPE) set(${libs} "${type}" PARENT_SCOPE) set(${main_libs} "${type}_main" PARENT_SCOPE) endif() endfunction() # Find Google Test (GTest and optionally GMock) source-only install. # # Google recommends distributing GTest and GMock as source only, to be built with the same # flags as that which is being tested. # # :param[in] gtest_path: Base path to search for gtest sources and includes, eg /usr # :param[in] googletest_path: Base path to search for googletest-packaged gtest/gmock, # eg, /usr/src/googletest # :param[out] gtest_found: Whether or not GTest was found in the paths provided # :param[out] gtest_include_dir: The include path to access GTest's headers # :param[out] gtest_lib_dir: The library path to access GTest's libraries # :param[out] gtest_libs: GTest's libraries # :param[out] gtest_main_libs: GTest's main libraries # :param[out] gmock_found: Whether or not GMock was found in the paths provided # :param[out] gmock_include_dir: The include path to access GMock's headers # :param[out] gmock_lib_dir: The library path to access GMock's libraries # :param[out] gmock_libs: GMock's libraries # :param[out] gmock_main_libs: GMock's main libraries # :param[out] base_dir: The base directory containing Google Test and/or GMock CMakeLists.txt # function(catkin_find_google_test_source gtest_path googletest_path gtest_found gtest_include_dir gtest_lib_dir gtest_libs gtest_main_libs gmock_found gmock_include_dir gmock_lib_dir gmock_libs gmock_main_libs base_dir ) # Path to gtest from the libgtest-dev Debian package. set(_gtest_include_paths "${gtest_path}/include/gtest") set(_gtest_source_paths "${gtest_path}/src/gtest/src") # Path to gtest from the googletest Debian package. list(APPEND _gtest_include_paths "${googletest_path}/googletest/include/gtest") list(APPEND _gtest_source_paths "${googletest_path}/googletest/googletest/src") if(CATKIN_TOPLEVEL) # Ensure current workspace is searched before system path list(INSERT _gtest_include_paths 0 "${CMAKE_SOURCE_DIR}/googletest/googletest/include/gtest") list(INSERT _gtest_source_paths 0 "${CMAKE_SOURCE_DIR}/googletest/googletest/src") endif() _catkin_find_google_source("gtest" "${_gtest_include_paths}" "${_gtest_source_paths}" _gtest_found _gtest_base_dir _gtest_include_dir _gtest_lib_dir _gtest_libs _gtest_main_libs) set(${gtest_found} ${_gtest_found} PARENT_SCOPE) set(${gtest_base_dir} ${_gtest_base_dir} PARENT_SCOPE) set(${gtest_include_dir} ${_gtest_include_dir} PARENT_SCOPE) set(${gtest_lib_dir} ${_gtest_lib_dir} PARENT_SCOPE) set(${gtest_libs} ${_gtest_libs} PARENT_SCOPE) set(${gtest_main_libs} ${_gtest_main_libs} PARENT_SCOPE) set(${base_dir} ${_gtest_base_dir} PARENT_SCOPE) # Path to gmock from the google-mock Debian package before v1.8.0. set(_gmock_include_paths "${gtest_path}/include/gmock") set(_gmock_source_paths "${gtest_path}/src/gmock/src") # Path to gmock from the googletest Debian package. list(APPEND _gmock_include_paths "${googletest_path}/googlemock/include/gmock") list(APPEND _gmock_source_paths "${googletest_path}/googlemock/src") if(CATKIN_TOPLEVEL) # Ensure current workspace is searched before system path list(INSERT _gmock_include_paths 0 "${CMAKE_SOURCE_DIR}/googletest/googlemock/include/gmock") list(INSERT _gmock_source_paths 0 "${CMAKE_SOURCE_DIR}/googletest/googlemock/src") endif() _catkin_find_google_source("gmock" "${_gmock_include_paths}" "${_gmock_source_paths}" _gmock_found _gmock_base_dir _gmock_include_dir _gmock_lib_dir _gmock_libs _gmock_main_libs) if(_gmock_found) set(${gmock_found} ${_gmock_found} PARENT_SCOPE) set(${gmock_base_dir} ${_gmock_base_dir} PARENT_SCOPE) set(${gmock_include_dir} ${_gmock_include_dir} PARENT_SCOPE) set(${gmock_lib_dir} ${_gmock_lib_dir} PARENT_SCOPE) set(${gmock_libs} ${_gmock_libs} PARENT_SCOPE) set(${gmock_main_libs} ${_gmock_main_libs} PARENT_SCOPE) #Overwrite gtest base_dir with gmock's set(${base_dir} ${_gmock_base_dir} PARENT_SCOPE) endif() # In googletest 1.8, gmock and gtest were merged inside googletest # In this case, including gmock builds gmock twice, so instead we need to include googletest # which will include gtest and gmock once if(_gtest_found) get_filename_component(_gtest_base_dir_realpath ${_gtest_base_dir} REALPATH) get_filename_component(_global_base_dir ${_gtest_base_dir_realpath} PATH) if(EXISTS "${_global_base_dir}/CMakeLists.txt") set(${base_dir} ${_global_base_dir} PARENT_SCOPE) endif() endif() endfunction() find_package(GMock QUIET) find_package(GTest QUIET) if(NOT GMOCK_FOUND OR NOT GTEST_FOUND) # If we find one but not the other, see if we can get both from source # only add gmock/gtest directory once per workspace if(NOT TARGET gtest AND NOT TARGET gmock) # Path to base of legacy libgtest-dev and google-mock packages. set(_gtest_path "/usr") # Path to base of new googletest package, which includes both gtest and gmock. set(_googletest_path "/usr/src/googletest") catkin_find_google_test_source("${_gtest_path}" "${_googletest_path}" gtest_found gtest_include_dir gtest_lib_dir gtest_libs gtest_main_libs gmock_found gmock_include_dir gmock_lib_dir gmock_libs gmock_main_libs base_dir) if (gtest_found AND gmock_found) if(GMOCK_FOUND OR GTEST_FOUND) message(STATUS "Forcing gtest/gmock from source, though one was otherwise available.") endif() set(FORCE_GTEST_GMOCK_FROM_SOURCE TRUE) endif() endif() endif() if(FORCE_GTEST_GMOCK_FROM_SOURCE OR (NOT GMOCK_FOUND AND NOT GTEST_FOUND)) if(gtest_found) set(GTEST_FROM_SOURCE_FOUND ${gtest_found} CACHE INTERNAL "") set(GTEST_FROM_SOURCE_INCLUDE_DIRS ${gtest_include_dir} CACHE INTERNAL "") set(GTEST_FROM_SOURCE_LIBRARY_DIRS ${gtest_lib_dir} CACHE INTERNAL "") set(GTEST_FROM_SOURCE_LIBRARIES ${gtest_libs} CACHE INTERNAL "") set(GTEST_FROM_SOURCE_MAIN_LIBRARIES ${gtest_main_libs} CACHE INTERNAL "") message(STATUS "Found gtest sources under '${base_dir}': gtests will be built") endif() if(gmock_found) set(GMOCK_FROM_SOURCE_FOUND ${gmock_found} CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_INCLUDE_DIRS ${gmock_include_dir} CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_LIBRARY_DIRS ${gmock_lib_dir} CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_LIBRARIES ${gmock_libs} CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_MAIN_LIBRARIES ${gmock_main_libs} CACHE INTERNAL "") message(STATUS "Found gmock sources under '${base_dir}': gmock will be built") endif() if(base_dir) # overwrite CMake install command to skip install rules for gtest targets # which have been added in version 1.8.0 _use_custom_install() set(_CATKIN_SKIP_INSTALL_RULES TRUE) add_subdirectory(${base_dir} ${gtest_lib_dir}) set(_CATKIN_SKIP_INSTALL_RULES FALSE) set_target_properties(${gtest_libs} ${gtest_main_libs} PROPERTIES EXCLUDE_FROM_ALL 1) if(gmock_found) set_target_properties(${gmock_libs} ${gmock_main_libs} PROPERTIES EXCLUDE_FROM_ALL 1) endif() endif() if(GMOCK_FROM_SOURCE_FOUND) # set the same variables as find_package() # do NOT set in the cache since when using gmock/gtest from source # we must always add the subdirectory to have their targets defined set(GMOCK_FOUND ${GMOCK_FROM_SOURCE_FOUND}) set(GMOCK_INCLUDE_DIRS ${GMOCK_FROM_SOURCE_INCLUDE_DIRS}) set(GMOCK_LIBRARY_DIRS ${GMOCK_FROM_SOURCE_LIBRARY_DIRS}) set(GMOCK_LIBRARIES ${GMOCK_FROM_SOURCE_LIBRARIES}) set(GMOCK_MAIN_LIBRARIES ${GMOCK_FROM_SOURCE_MAIN_LIBRARIES}) set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES}) endif() if(GTEST_FROM_SOURCE_FOUND) # set the same variables as find_package() # do NOT set in the cache since when using gtest from source # we must always add the subdirectory to have their targets defined set(GTEST_FOUND ${GTEST_FROM_SOURCE_FOUND}) set(GTEST_INCLUDE_DIRS ${GTEST_FROM_SOURCE_INCLUDE_DIRS}) set(GTEST_LIBRARY_DIRS ${GTEST_FROM_SOURCE_LIBRARY_DIRS}) set(GTEST_LIBRARIES ${GTEST_FROM_SOURCE_LIBRARIES}) set(GTEST_MAIN_LIBRARIES ${GTEST_FROM_SOURCE_MAIN_LIBRARIES}) set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) endif() else() if(GMOCK_FOUND) message(STATUS "Found gmock: gmock and gtests will be built") set(GMOCK_FOUND ${GMOCK_FOUND} CACHE INTERNAL "") set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS} CACHE INTERNAL "") set(GMOCK_LIBRARIES ${GMOCK_LIBRARIES} CACHE INTERNAL "") set(GMOCK_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARIES} CACHE INTERNAL "") set(GMOCK_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} CACHE INTERNAL "") set(GTEST_FOUND ${GMOCK_FOUND} CACHE INTERNAL "") set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS} CACHE INTERNAL "") set(GTEST_LIBRARY_DIRS ${GMOCK_LIBRARY_DIRS} CACHE INTERNAL "") set(GTEST_LIBRARIES ${GMOCK_LIBRARIES} CACHE INTERNAL "") set(GTEST_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARIES} CACHE INTERNAL "") set(GTEST_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} CACHE INTERNAL "") elseif(GTEST_FOUND) message(STATUS "Found gtest: gtests will be built") set(GTEST_FOUND ${GTEST_FOUND} CACHE INTERNAL "") set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} CACHE INTERNAL "") set(GTEST_LIBRARIES ${GTEST_LIBRARIES} CACHE INTERNAL "") set(GTEST_MAIN_LIBRARIES ${GTEST_MAIN_LIBRARIES} CACHE INTERNAL "") set(GTEST_BOTH_LIBRARIES ${GTEST_BOTH_LIBRARIES} CACHE INTERNAL "") endif() endif() if(NOT GTEST_FOUND) if(CATKIN_TOPLEVEL) message(STATUS "gtest not found, C++ tests can not be built. Please install the gtest headers globally in your system or checkout gtest (by running 'git clone https://github.com/google/googletest.git -b release-1.8.0' in the source space '${CMAKE_SOURCE_DIR}' of your workspace) to enable gtests") else() message(STATUS "gtest not found, C++ tests can not be built. Please install the gtest headers globally in your system to enable gtests") endif() endif() if(GMOCK_FOUND AND NOT TARGET gmock) add_library(gmock UNKNOWN IMPORTED) set_target_properties(gmock PROPERTIES IMPORTED_LOCATION "${GMOCK_LIBRARIES}") endif() if(GMOCK_FOUND AND NOT TARGET gmock_main) add_library(gmock_main UNKNOWN IMPORTED) set_target_properties(gmock_main PROPERTIES IMPORTED_LOCATION "${GMOCK_MAIN_LIBRARIES}") endif() if(GTEST_FOUND AND NOT TARGET gtest) add_library(gtest SHARED IMPORTED) set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${GTEST_LIBRARIES}") endif() if(GTEST_FOUND AND NOT TARGET gtest_main) add_library(gtest_main SHARED IMPORTED) set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION "${GTEST_MAIN_LIBRARIES}") endif() # For Visual C++, need to increase variadic template size to build gtest if(GTEST_FOUND) if(WIN32) add_definitions(/D _VARIADIC_MAX=10) endif() endif() catkin-0.8.0/cmake/test/nosetests.cmake000066400000000000000000000111161361264727400200740ustar00rootroot00000000000000_generate_function_if_testing_is_disabled("catkin_add_nosetests") # # Add Python nose tests. # # Nose collects tests from the directory ``dir`` automatically. # # .. note:: The test can be executed by calling ``nosetests`` # directly or using: # `` make run_tests_${PROJECT_NAME}_nosetests_${dir}`` # (where slashes in the ``dir`` are replaced with periods) # # :param path: a relative or absolute directory to search for # nosetests in or a relative or absolute file containing tests # :type path: string # :param DEPENDENCIES: the targets which must be built before executing # the test # :type DEPENDENCIES: list of strings # :param TIMEOUT: the timeout for individual tests in seconds # (default: 60) # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory when executing the # tests (this option can only be used when the ``path`` argument is a # file but not when it is a directory) # :type WORKING_DIRECTORY: string # # @public # function(catkin_add_nosetests path) _warn_if_skip_testing("catkin_add_nosetests") if(NOT NOSETESTS) message(STATUS "skipping nosetests(${path}) in project '${PROJECT_NAME}'") return() endif() cmake_parse_arguments(_nose "" "TIMEOUT;WORKING_DIRECTORY" "DEPENDENCIES" ${ARGN}) if(NOT _nose_TIMEOUT) set(_nose_TIMEOUT 60) endif() if(NOT _nose_TIMEOUT GREATER 0) message(FATAL_ERROR "nosetests() TIMEOUT argument must be a valid number of seconds greater than zero") endif() # check that the directory exists set(_path_name _path_name-NOTFOUND) if(IS_ABSOLUTE ${path}) set(_path_name ${path}) else() find_file(_path_name ${path} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) if(NOT _path_name) message(FATAL_ERROR "Can't find nosetests path '${path}'") endif() endif() # check if coverage reports are being requested if("$ENV{CATKIN_TEST_COVERAGE}" STREQUAL "1") set(_covarg " --with-coverage") endif() # strip PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR prefix from output_file_name set(output_file_name ${path}) _strip_path_prefix(output_file_name "${output_file_name}" "${PROJECT_SOURCE_DIR}") _strip_path_prefix(output_file_name "${output_file_name}" "${PROJECT_BINARY_DIR}") if("${output_file_name}" STREQUAL "") set(output_file_name ".") endif() string(REPLACE "/" "." output_file_name ${output_file_name}) string(REPLACE ":" "." output_file_name ${output_file_name}) set(output_path ${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}) # make --xunit-file argument an absolute path (https://github.com/nose-devs/nose/issues/779) get_filename_component(output_path "${output_path}" ABSOLUTE) set(cmd "\"${CMAKE_COMMAND}\" -E make_directory ${output_path}") if(IS_DIRECTORY ${_path_name}) set(tests "--where=${_path_name}") else() set(tests "${_path_name}") endif() set(cmd ${cmd} "${NOSETESTS} -P --process-timeout=${_nose_TIMEOUT} ${tests} --with-xunit --xunit-file=${output_path}/nosetests-${output_file_name}.xml${_covarg}") catkin_run_tests_target("nosetests" ${output_file_name} "nosetests-${output_file_name}.xml" COMMAND ${cmd} DEPENDENCIES ${_nose_DEPENDENCIES} WORKING_DIRECTORY ${_nose_WORKING_DIRECTORY}) endfunction() find_program(NOSETESTS NAMES "nosetests${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" "nosetests-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" "nosetests${PYTHON_VERSION_MAJOR}" "nosetests-${PYTHON_VERSION_MAJOR}" "nosetests") if(NOSETESTS) message(STATUS "Using Python nosetests: ${NOSETESTS}") else() if("${PYTHON_VERSION_MAJOR}" STREQUAL "3") message(STATUS "nosetests not found, Python tests can not be run (try installing package 'python3-nose')") else() message(STATUS "nosetests not found, Python tests can not be run (try installing package 'python-nose')") endif() endif() function(_strip_path_prefix var value prefix) if("${value}" STREQUAL "${prefix}" OR "${value}" STREQUAL "${prefix}/") set(${var} "" PARENT_SCOPE) else() set(result "${value}") string(LENGTH "${prefix}/" prefix_length) string(LENGTH "${value}" var_length) if(${var_length} GREATER ${prefix_length}) string(SUBSTRING "${value}" 0 ${prefix_length} var_prefix) if("${var_prefix}" STREQUAL "${prefix}/") # passing length -1 does not work for CMake < 2.8.5 # http://public.kitware.com/Bug/view.php?id=10740 string(LENGTH "${value}" _rest) math(EXPR _rest "${_rest} - ${prefix_length}") string(SUBSTRING "${value}" ${prefix_length} ${_rest} result) endif() endif() set(${var} "${result}" PARENT_SCOPE) endif() endfunction() catkin-0.8.0/cmake/test/remove_test_results.py000066400000000000000000000016471361264727400215420ustar00rootroot00000000000000from __future__ import print_function import argparse import os import sys def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser( description='Remove all test result files found within a given path.') parser.add_argument('path', help='The path to recursively process') args = parser.parse_args(argv) print("Removing test result files from '%s'" % os.path.abspath(args.path)) if not os.path.exists(args.path): return 0 for dirpath, dirnames, filenames in os.walk(args.path): # do not recurse into folders starting with a dot dirnames[:] = [d for d in dirnames if not d.startswith('.')] for filename in [f for f in filenames if f.endswith('.xml')]: filename_abs = os.path.join(dirpath, filename) print("- removing '%s'" % filename_abs) os.remove(filename_abs) return 0 if __name__ == '__main__': sys.exit(main()) catkin-0.8.0/cmake/test/run_tests.py000066400000000000000000000027341361264727400174510ustar00rootroot00000000000000from __future__ import print_function import argparse import subprocess import sys from catkin.test_results import ensure_junit_result_exist, remove_junit_result def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser(description='Runs the test command passed as an argument and verifies that the expected result file has been generated.') parser.add_argument('results', help='The path to the xunit result file') parser.add_argument('command', nargs='+', help='The test command to execute') parser.add_argument('--working-dir', nargs='?', help='The working directory for the executed command') parser.add_argument('--return-code', action='store_true', default=False, help='Set the return code based on the success of the test command') args = parser.parse_args(argv) remove_junit_result(args.results) work_dir_msg = ' with working directory "%s"' % args.working_dir if args.working_dir is not None else '' cmds_msg = ''.join(['\n %s' % cmd for cmd in args.command]) print('-- run_tests.py: execute commands%s%s' % (work_dir_msg, cmds_msg)) rc = 0 for cmd in args.command: rc = subprocess.call(cmd, cwd=args.working_dir, shell=True) if rc: break print('-- run_tests.py: verify result "%s"' % args.results) no_errors = ensure_junit_result_exist(args.results) if not no_errors: rc = 1 if args.return_code: return rc return 0 if __name__ == '__main__': sys.exit(main()) catkin-0.8.0/cmake/test/tests.cmake000066400000000000000000000172771361264727400172250ustar00rootroot00000000000000option(CATKIN_ENABLE_TESTING "Catkin enable testing" ON) option(CATKIN_SKIP_TESTING "Catkin skip testing" OFF) # check if testing is explicity skipped if(CATKIN_SKIP_TESTING) set(CATKIN_ENABLE_TESTING OFF) message(STATUS "Using CATKIN_SKIP_TESTING: ${CATKIN_SKIP_TESTING} (implying CATKIN_ENABLE_TESTING=${CATKIN_ENABLE_TESTING})") else() message(STATUS "Using CATKIN_ENABLE_TESTING: ${CATKIN_ENABLE_TESTING}") endif() # creates dummy functions in case testing has been explicitly disabled (and not only skipping) # which outputs an error message when being invoked macro(_generate_function_if_testing_is_disabled) if(DEFINED CATKIN_ENABLE_TESTING AND NOT CATKIN_ENABLE_TESTING AND NOT CATKIN_SKIP_TESTING) foreach(_arg ${ARGN}) function(${_arg}) message(FATAL_ERROR "${_arg}() is not available when tests are not enabled. The CMake code should only use it inside a conditional block which checks that testing is enabled:\n" "if(CATKIN_ENABLE_TESTING)\n" " ${_arg}(...)\n" "endif()\n") endfunction() endforeach() return() endif() endmacro() # checks if a function has been called while testing is skipped # and outputs a warning message macro(_warn_if_skip_testing funcname) if(DEFINED CATKIN_ENABLE_TESTING AND NOT CATKIN_ENABLE_TESTING) message(WARNING "${funcname}() should only be used inside a conditional block which checks that testing is enabled:\n" "if(CATKIN_ENABLE_TESTING)\n" " ${funcname}(...)\n" "endif()\n") endif() endmacro() if(DEFINED CATKIN_ENABLE_TESTING AND NOT CATKIN_ENABLE_TESTING AND NOT CATKIN_SKIP_TESTING) return() endif() # do not enable ctest's on the farm, since they are automatically executed by the current rules files # and since the tests have not been build rostests would hang forever if(NOT CATKIN_BUILD_BINARY_PACKAGE) # do not enable ctest's for dry packages, since they have a custom test target which must not be overwritten if(NOT ROSBUILD_init_called) message(STATUS "Call enable_testing()") enable_testing() if(DEFINED CATKIN_ENABLE_TESTING) # configure CTest not to truncate the dashboard summary file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake" "set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 0)\n" "set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 0)\n") # create dart configuration from template site_name(SITE) configure_file( ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in ${PROJECT_BINARY_DIR}/CTestConfiguration.ini) endif() else() message(STATUS "Skip enable_testing() for dry packages") endif() else() message(STATUS "Skip enable_testing() when building binary package") endif() # allow overriding CATKIN_TEST_RESULTS_DIR when explicitly passed to CMake as a command line argument if(DEFINED CATKIN_TEST_RESULTS_DIR) set(CATKIN_TEST_RESULTS_DIR ${CATKIN_TEST_RESULTS_DIR} CACHE INTERNAL "") else() set(CATKIN_TEST_RESULTS_DIR ${CMAKE_BINARY_DIR}/test_results CACHE INTERNAL "") endif() message(STATUS "Using CATKIN_TEST_RESULTS_DIR: ${CATKIN_TEST_RESULTS_DIR}") file(MAKE_DIRECTORY ${CATKIN_TEST_RESULTS_DIR}) # create target to build tests if(NOT TARGET tests) add_custom_target(tests) endif() # create target to run all tests # it uses the dot-prefixed test targets to depend on building all tests and cleaning test results before the tests are executed if(NOT TARGET run_tests) add_custom_target(run_tests) endif() # create target to clean all test results if(NOT TARGET clean_test_results) add_custom_target(clean_test_results COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}") endif() # # Create a test target, integrate it with the run_tests infrastructure # and post-process the junit result. # # All test results go under ${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME} # # This function is only used internally by the various # catkin_add_*test() functions. # function(catkin_run_tests_target type name xunit_filename) cmake_parse_arguments(_testing "" "WORKING_DIRECTORY" "COMMAND;DEPENDENCIES" ${ARGN}) if(_testing_UNPARSED_ARGUMENTS) message(FATAL_ERROR "catkin_run_tests_target() called with unused arguments: ${_testing_UNPARSED_ARGUMENTS}") endif() # Friendly error message for ros/catkin#961 if(TARGET run_tests_${PROJECT_NAME} AND NOT TARGET _run_tests_${PROJECT_NAME}) message(FATAL_ERROR "catkin_run_tests_target() needs to create a target called `run_tests_${PROJECT_NAME}`, but it already exists. Please rename the existing `run_tests_${PROJECT_NAME}` target/executable/library to something else.") endif() # create meta target to trigger all tests of a project if(NOT TARGET run_tests_${PROJECT_NAME}) add_custom_target(run_tests_${PROJECT_NAME}) # create hidden meta target which depends on hidden test targets which depend on clean_test_results add_custom_target(_run_tests_${PROJECT_NAME}) # run_tests depends on this hidden target hierarchy to clear test results before running all tests add_dependencies(run_tests _run_tests_${PROJECT_NAME}) endif() # create meta target to trigger all tests of a specific type of a project if(NOT TARGET run_tests_${PROJECT_NAME}_${type}) add_custom_target(run_tests_${PROJECT_NAME}_${type}) add_dependencies(run_tests_${PROJECT_NAME} run_tests_${PROJECT_NAME}_${type}) # hidden meta target which depends on hidden test targets which depend on clean_test_results add_custom_target(_run_tests_${PROJECT_NAME}_${type}) add_dependencies(_run_tests_${PROJECT_NAME} _run_tests_${PROJECT_NAME}_${type}) endif() if(NOT DEFINED CATKIN_ENABLE_TESTING OR CATKIN_ENABLE_TESTING) # create target for test execution set(results ${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}/${xunit_filename}) if (_testing_WORKING_DIRECTORY) set(working_dir_arg "--working-dir" ${_testing_WORKING_DIRECTORY}) endif() assert(CATKIN_ENV) set(cmd_wrapper ${CATKIN_ENV} ${PYTHON_EXECUTABLE} ${catkin_EXTRAS_DIR}/test/run_tests.py ${results} ${working_dir_arg}) # for ctest the command needs to return non-zero if any test failed set(cmd ${cmd_wrapper} "--return-code" ${_testing_COMMAND}) add_test(NAME _ctest_${PROJECT_NAME}_${type}_${name} COMMAND ${cmd}) # for the run_tests target the command needs to return zero so that testing is not aborted set(cmd ${cmd_wrapper} ${_testing_COMMAND}) add_custom_target(run_tests_${PROJECT_NAME}_${type}_${name} COMMAND ${cmd} VERBATIM ) else() # create empty dummy target set(cmd "${CMAKE_COMMAND}" "-E" "echo" "Skipping test target \\'run_tests_${PROJECT_NAME}_${type}_${name}\\'. Enable testing via -DCATKIN_ENABLE_TESTING.") add_custom_target(run_tests_${PROJECT_NAME}_${type}_${name} ${cmd}) endif() add_dependencies(run_tests_${PROJECT_NAME}_${type} run_tests_${PROJECT_NAME}_${type}_${name}) if(_testing_DEPENDENCIES) add_dependencies(run_tests_${PROJECT_NAME}_${type}_${name} ${_testing_DEPENDENCIES}) endif() # hidden test target which depends on building all tests and cleaning test results add_custom_target(_run_tests_${PROJECT_NAME}_${type}_${name} COMMAND ${cmd} VERBATIM ) add_dependencies(_run_tests_${PROJECT_NAME}_${type} _run_tests_${PROJECT_NAME}_${type}_${name}) # create target to clean project specific test results if(NOT TARGET clean_test_results_${PROJECT_NAME}) add_custom_target(clean_test_results_${PROJECT_NAME} COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}" VERBATIM ) endif() add_dependencies(_run_tests_${PROJECT_NAME}_${type}_${name} clean_test_results_${PROJECT_NAME} tests ${_testing_DEPENDENCIES}) endfunction() catkin-0.8.0/cmake/tools/000077500000000000000000000000001361264727400152245ustar00rootroot00000000000000catkin-0.8.0/cmake/tools/bz2.cmake000066400000000000000000000031011361264727400167160ustar00rootroot00000000000000# # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # find_package(Bzip2) catkin-0.8.0/cmake/tools/doxygen.cmake000066400000000000000000000050721361264727400177070ustar00rootroot00000000000000# # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ## # doxygen( ) # TARGET_NAME -> The cmake target to create. # SEARCH_DIRS -> a CMake List of directories to search for doxygenated files. # find_program(DOXYGEN_EXECUTABLE doxygen) if (DOXYGEN_EXECUTABLE) set(DOXYGEN_FOUND TRUE CACHE BOOL "Doxygen found") endif() if(NOT TARGET doxygen) add_custom_target(doxygen) endif() function(catkin_doxygen TARGET_NAME SEARCH_DIRS) foreach(dir ${SEARCH_DIRS}) file(GLOB_RECURSE _doc_sources ${dir}/*) list(APPEND doc_sources ${_doc_sources}) endforeach() string(REPLACE ";" " " doc_sources "${doc_sources}") configure_file(${catkin_EXTRAS_DIR}/templates/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(${TARGET_NAME} COMMENT "Generating API documentation with Doxygen" VERBATIM ) add_custom_command(TARGET ${TARGET_NAME} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_dependencies(doxygen ${TARGET_NAME}) endfunction() catkin-0.8.0/cmake/tools/libraries.cmake000066400000000000000000000015171361264727400202060ustar00rootroot00000000000000# BUILD_SHARED_LIBS is a global cmake variable (usually defaults to on) # that determines the build type of libraries: # http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS # It defaults to shared. # # Our only current major use case for static libraries is # via the mingw cross compiler, though embedded builds # could be feasibly built this way also (largely untested). # Make sure this is already defined as a cached variable (@sa platform/windows.cmake) if(NOT DEFINED BUILD_SHARED_LIBS) option(BUILD_SHARED_LIBS "Build dynamically-linked binaries" ON) endif() function(configure_shared_library_build_settings) if(BUILD_SHARED_LIBS) message(STATUS "BUILD_SHARED_LIBS is on") add_definitions(-DROS_BUILD_SHARED_LIBS=1) else() message(STATUS "BUILD_SHARED_LIBS is off") endif() endfunction() catkin-0.8.0/cmake/tools/rt.cmake000066400000000000000000000044221361264727400166550ustar00rootroot00000000000000# # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # message("CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}") # message("CMAKE_LIBRARY_ARCHITECTURE: ${CMAKE_LIBRARY_ARCHITECTURE}") # message("CMAKE_SYSTEM_LIBRARY_PATH: ${CMAKE_SYSTEM_LIBRARY_PATH}") # message("CMAKE_VERSION=${CMAKE_VERSION}") if(NOT (APPLE OR WIN32 OR MINGW OR ANDROID)) if (${CMAKE_VERSION} VERSION_LESS 2.8.4) # cmake later than 2.8.0 appears to have a better find_library # that knows about the ABI of the compiler. For lucid we just # depend on the linker to find it for us. set(RT_LIBRARY rt CACHE FILEPATH "Hacked find of rt for cmake < 2.8.4") else() find_library(RT_LIBRARY rt) assert_file_exists(${RT_LIBRARY} "RT Library") endif() #message(STATUS "RT_LIBRARY: ${RT_LIBRARY}") endif() catkin-0.8.0/cmake/tools/threads.cmake000066400000000000000000000032231361264727400176600ustar00rootroot00000000000000# # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # find_package(Threads) set(THREADS_LIBRARY ${CMAKE_THREAD_LIBS_INIT} CACHE FILEPATH "Threads library") catkin-0.8.0/cmake/toplevel.cmake000066400000000000000000000041611361264727400167220ustar00rootroot00000000000000# toplevel CMakeLists.txt for a catkin workspace # catkin/cmake/toplevel.cmake cmake_minimum_required(VERSION 3.0.2) set(CATKIN_TOPLEVEL TRUE) # search for catkin within the workspace set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") execute_process(COMMAND ${_cmd} RESULT_VARIABLE _res OUTPUT_VARIABLE _out ERROR_VARIABLE _err OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) # searching fot catkin resulted in an error string(REPLACE ";" " " _cmd_str "${_cmd}") message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") endif() # include catkin from workspace or via find_package() if(_res EQUAL 0) set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") # include all.cmake without add_subdirectory to let it operate in same scope include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) add_subdirectory("${_out}") else() # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument # or CMAKE_PREFIX_PATH from the environment if(NOT DEFINED CMAKE_PREFIX_PATH) if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") if(NOT WIN32) string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) else() set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) endif() endif() endif() # list of catkin workspaces set(catkin_search_path "") foreach(path ${CMAKE_PREFIX_PATH}) if(EXISTS "${path}/.catkin") list(FIND catkin_search_path ${path} _index) if(_index EQUAL -1) list(APPEND catkin_search_path ${path}) endif() endif() endforeach() # search for catkin in all workspaces set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) find_package(catkin QUIET NO_POLICY_SCOPE PATHS ${catkin_search_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) unset(CATKIN_TOPLEVEL_FIND_PACKAGE) if(NOT catkin_FOUND) 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.") endif() endif() catkin_workspace() catkin-0.8.0/doc/000077500000000000000000000000001361264727400135515ustar00rootroot00000000000000catkin-0.8.0/doc/.gitignore000066400000000000000000000000061361264727400155350ustar00rootroot00000000000000build catkin-0.8.0/doc/Makefile000066400000000000000000000125371361264727400152210ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm dev_guide/generated_cmake_api.rst -rm -rf $(BUILDDIR)/* cmakeapi: ./generate_cmake_rst.py -o dev_guide/generated_cmake_api.rst ../cmake html: cmakeapi $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: cmakeapi $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: cmakeapi $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: cmakeapi $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: cmakeapi $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: cmakeapi $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: cmakeapi $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/catkin.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/catkin.qhc" devhelp: cmakeapi $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/catkin" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/catkin" @echo "# devhelp" epub: cmakeapi $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: cmakeapi $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: cmakeapi $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: cmakeapi $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: cmakeapi $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: cmakeapi $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: cmakeapi $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: python read file $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." upload: html # set write permission for group so that everybody can overwrite existing files on the webserver chmod -R g+w $(BUILDDIR)/html/ # set sticky-bit for group on folders so that the group "www" is kept when overwriting existing files on the webserver find $(BUILDDIR)/html/ -type d | xargs chmod g+s #scp -pr $(BUILDDIR)/html/ wgs32.willowgarage.com:/var/www/www.ros.org/html/doc/api/catkin #scp -pr $(BUILDDIR)/html/ wgs32.willowgarage.com:/var/www/www.ros.org/html/doc/fuerte/api/catkin scp -pr $(BUILDDIR)/html/ root@wgs32.willowgarage.com:/var/www/www.ros.org/html/doc/groovy/api/catkin catkin-0.8.0/doc/adv_user_guide/000077500000000000000000000000001361264727400165365ustar00rootroot00000000000000catkin-0.8.0/doc/adv_user_guide/adv_user_guide.rst000066400000000000000000000003101361264727400222470ustar00rootroot00000000000000Advanced Users Guide ==================== This section of the documentation is provided for advanced users. .. toctree:: :maxdepth: 2 catkin_migration_indigo catkin_migration builddocs catkin-0.8.0/doc/adv_user_guide/builddocs.rst000066400000000000000000000031301361264727400212350ustar00rootroot00000000000000How to build the docs ===================== catkin provides (and uses) some plugins to `Sphinx `_ to build documentation. These plugins can be used to provide a common look and feel to the generated documentation. The first time you want to build catkin-controlled documentation (including catkin's own documentation), you'll need to setup your environment. Setup ----- #. Install ``python-catkin-sphinx`` via apt-get:: sudo apt-get install python-catkin-sphinx #. Alternatively the package is also available via PyPi for non-Debian platforms. Now you can build documentation for projects that use the ``ros-theme``. For example, to build catkin's documentation:: git clone git://github.com/ros/catkin.git cd catkin/doc make html Usage ----- Ros theme ^^^^^^^^^ To use the ``ros-theme`` in your own project's documentation, add the following line to your ``conf.py``:: import catkin_sphinx html_theme_path.append(os.path.join(os.path.dirname(catkin_sphinx.__file__), 'theme')) # Use ROS theme html_theme = 'ros-theme' Shell prompts ^^^^^^^^^^^^^ If you want to document shell prompts (e.g. install instructions), use:: extensions = extensions + ['catkin_sphinx.ShLexer'] and document your snippets using:: .. code-block:: catkin-sh $ sudo pip install mystuff Cmake macro documentation ^^^^^^^^^^^^^^^^^^^^^^^^^ If you also want to generate docs for cmake files, add:: extensions = extensions + ['catkin_sphinx.cmake'] this will enable the sphinx "``.. cmake:macro::``" directive. catkin-0.8.0/doc/adv_user_guide/catkin_migration.rst000066400000000000000000000141301361264727400226110ustar00rootroot00000000000000Migrating from Fuerte catkin ============================ Catkin still changes a lot, so a migration from catkin in fuerte to catkin in groovy is necessary. Changes to catkin in Groovy are not designed to be backwards compatible to catkin in Fuerte. The main difference to know is that in fuerte, the atomic unit of build was a stack declared in a ``stack.xml`` file, whereas in groovy, ``stacks`` do no exist anymore, and the atomic unit is a package declared in a ``package.xml`` file. If in fuerte you had a stack with several subprojects acting as packages, this should be migrated to one metapackage and several packages for groovy. If instead you had a stack with sources, this can become a single catkin package. Metapackages are not required for packages, they may just be helpful to define a relationship between packages, and for installing your packages it might be easier to just give the name of a metapackage than to list all your packages. To update an already catkinized ROS stack from the Fuerte-version of catkin to Groovy the following steps are necessary: Make a metapackage for the stack -------------------------------- The version of Catkin for ROS groovy does not support the idea of a "stack" of packages which get wrapped up together into a Debian (or similar) installable package. Instead, catkin packages now get built into separate installable Debian (or similar) packages. To maintain compatibility with software which has a dependency on the stack name, you need to make a new catkin package which is a "metapackage". This package has the same name as the stack and contains no source code, only a list of dependencies containing all the packages which used to be in the stack. For example, say our old stack was named "stick" and it had 2 packages: "pickage" and "peckage". The directories would look like this:: /stick/stack.xml /stick/CMakeLists.xml /stick/pickage/... (pickage files) /stick/peckage/... (peckage files) The new version adds a new "stick" metapackage subdirectory under /stick, along with a package.xml and CMakeLists.txt file:: /stick/stick/package.xml /stick/stick/CMakeLists.xml /stick/pickage/... (pickage files) /stick/peckage/... (peckage files) The contents of the /stick/stick/package.xml must look like this:: stick 0.1.1 Metapackage relevant to sticks. Lucy Coder BSD http://www.example.com/stick catkin pickage peckage The contents of the /stick/stick/CMakeLists.txt looks like this:: cmake_minimum_required(VERSION 3.0.2) project(stick) find_package(catkin REQUIRED) catkin_metapackage() Note that the package.xml for stick has a buildtool depend on catkin. This is required because the CMakeLists.txt for a metapackage contains a catkin macro (catkin_metapackage), therefore catkin is required at build time. This is the only non-run_depend allowed in the package.xml of a metapackage. The rest of these instructions refer to changes within regular (not meta-) catkin packages. Migrate packages ---------------- In fuerte, catkin had no strong notion of packages, only stacks, and package manifests were at most kept for backwards compatibility with rosbuild. In groovy, it was decided to instead drop the notion of stacks (for metapackages), and make packages the atomic unit of build. 1. Rename ``manifest.xml`` to ``package.xml``, or create new ``package.xml``. 2. Adapt the contents of ``package.xml`` * add a name tag * add a maintainer tag 3. Create/Update `CMakeLists.txt`` files * Instead of ``find_package(ROS ...)`` use ``find_package(catkin ...)``. Make sure to update the corresponding variables like ``ROS_INLCUDE_DIRS`` to ``catkin_INCLUDE_DIRS``. Do not search a component called ``catkin``. * ``catkin_package(...)`` should be called near the beginning of the CMake, directly after ``find_package``-ing catkin and other dependencies. Unlike the old ``catkin_project()`` macro, ``catkin_package()`` doesn't need the name of the package it is part of. * Switch to renamed catkin functions: * ``add_gtest`` => ``catkin_add_gtest`` Do not use path-like string for the target name. The first argument must be a valid CMake target name. * ``add_nosetests`` => ``catkin_add_nosetests`` * Update install() invocations to use the new FHS compliant destinations (see :ref:`variables`). Always specify the necessary destinations explicitly. Specify ``DESTINATION``, ``ARCHIVE DESTINATION``, ``LIBRARY DESTINATION`` and ``RUNTIME DESTINATION`` as required. * Remove manually ``install()`` invocations for ``stack.xml`` and ``manifest.xml`` files (this is handled by catkin automatically). * After creating a GTest target using ``catkin_add_gtest(target ...)`` you should test for the existence of the target before trying to use it (i.e. by calling ``target_link_libraries(target ..,)``):: % if(TARGET target) % target_link_libraries(target ...) % endif() This handles the case gracefully when GTest is not available. CMake extra files ----------------- CMake extra files must now work in devel space as well as in installspace. The templates can determine the different invocation cases using the variables ``@DEVELSPACE@`` and ``@INSTALLSPACE@``. Custom find_package() config files ---------------------------------- The ``find_package()`` config have been renamed from ``-config.cmake.in`` to ``Config.cmake.in``. Note that the project name is no longer converted to lower case but used as-is. Custom environment hooks ------------------------ The names of the templates for the environment hooks for devel space and installspace have been unified. There is only one template for both. The templates can determine the different invocation cases using the variables ``@DEVELSPACE@`` and ``@INSTALLSPACE@``. catkin-0.8.0/doc/adv_user_guide/catkin_migration_indigo.rst000066400000000000000000000016071361264727400241470ustar00rootroot00000000000000Updating a catkin package for Indigo ==================================== If your catkin package is working in Groovy/Hydro it should be easy to get it working in Indigo too. Removed deprecated functions ---------------------------- The following CMake functions and macros which were deprecated before have been removed from catkin in Indigo. Please replace them with their replacement: * ``add_gtest(..)`` => ``catkin_add_gtest(..)`` * ``add_nosetests(..)`` => ``catkin_add_nosetests(..)`` * ``download_test_data(url md5)`` => ``catkin_download_test_data(target url MD5 md5)`` * ``parse_arguments(..)`` => ``cmake_parse_arguments(..)`` Removed Eigen CMake config file ------------------------------- The previously provided CMake config file for Eigen has been removed. Instead you might want to use the CMake module provided by the `cmake_modules `_ package. catkin-0.8.0/doc/conf.py000066400000000000000000000163511361264727400150560ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # robuild documentation build configuration file, created by # sphinx-quickstart on Mon May 11 08:53:19 2009. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys import time from xml.etree.ElementTree import ElementTree import catkin_sphinx # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.graphviz', 'sphinx.ext.intersphinx', 'catkin_sphinx.ShLexer', 'catkin_sphinx.cmake', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode'] todo_include_todos = True # include path to python files hidden in cmake folder sys.path.insert(0, '../cmake') sys.path.insert(0, '../python') # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' show_sphinx = False # The master toctree document. master_doc = 'index' # General information about the project. project = u'catkin' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. try: root = ElementTree(None, os.path.join('..', 'package.xml')) version = root.findtext('version') author_names = [a.text for a in root.findall('author')] copyright = u'2010-%s, %s' % (time.strftime('%Y'), ', '.join(author_names)) except Exception as e: raise RuntimeError('Could not extract version and authors from package.xml:\n%s' % e) # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. show_authors = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [os.path.join(os.path.dirname(catkin_sphinx.__file__), 'theme')] # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'ros-theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = { 'rightsidebar' : 'true' } # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = 'catkin' # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. html_logo = 'ros.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". ##html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # # tds: We don't use this, we use the git timestamp # # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'catkin-cmakedoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'catkin.tex', r'Catkin', r'troy d. straszheim', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True intersphinx_mapping = { 'genmsg': ('http://docs.ros.org/indigo/api/genmsg/html', None), 'vcstools': ('http://docs.ros.org/independent/api/vcstools/html', None), 'rosinstall': ('http://docs.ros.org/independent/api/rosinstall/html', None), 'rospkg': ('http://docs.ros.org/independent/api/rospkg/html', None), 'rosdep': ('http://docs.ros.org/independent/api/rosdep/html', None), } rst_epilog=""" """ catkin-0.8.0/doc/dependencies.dot000066400000000000000000000013501361264727400167060ustar00rootroot00000000000000digraph G { graph [ rankdir=BT, nodesep=2 ]; catkin->python; catkin->cmake; genmsg->catkin; langs [ label = " languages | {gencpp | genpy | ... | genlisp}" shape = "record" ]; langs:all ->genmsg; std_msgs -> langs:all common_msgs -> langs:all roscpp_core [ label = " roscpp_core | {rostime | cpp_common | roscpp_serialization | roscpp_traits}" shape = "record" ] ros_comm [ label = " ros_comm | { rosgraph_msgs | xmlrpcpp | rosconsole | roscpp }" shape = "record" ] ros_comm:stack -> catkin ros_comm:stack -> roscpp_core:stack ros_comm:stack -> langs:all roscpp_core:stack -> catkin } catkin-0.8.0/doc/dev_guide/000077500000000000000000000000001361264727400155045ustar00rootroot00000000000000catkin-0.8.0/doc/dev_guide/api/000077500000000000000000000000001361264727400162555ustar00rootroot00000000000000catkin-0.8.0/doc/dev_guide/api/catkin.rst000066400000000000000000000021011361264727400202520ustar00rootroot00000000000000catkin Package ============== :mod:`find_in_workspaces` Module -------------------------------- .. automodule:: catkin.find_in_workspaces :members: :undoc-members: :show-inheritance: :mod:`init_workspace` Module ---------------------------- .. automodule:: catkin.init_workspace :members: :undoc-members: :show-inheritance: :mod:`package_version` Module ----------------------------- .. automodule:: catkin.package_version :members: :undoc-members: :show-inheritance: :mod:`test_results` Module -------------------------- .. automodule:: catkin.test_results :members: :undoc-members: :show-inheritance: :mod:`tidy_xml` Module ---------------------- .. automodule:: catkin.tidy_xml :members: :undoc-members: :show-inheritance: :mod:`workspace` Module ----------------------- .. automodule:: catkin.workspace :members: :undoc-members: :show-inheritance: :mod:`workspace_vcs` Module --------------------------- .. automodule:: catkin.workspace_vcs :members: :undoc-members: :show-inheritance: catkin-0.8.0/doc/dev_guide/api/index.rst000066400000000000000000000004451361264727400201210ustar00rootroot00000000000000Catkin Python API ================= Contents: .. toctree:: :maxdepth: 2 catkin Scripts used by cmake macros: .. toctree:: :maxdepth: 2 interrogate_setup_dot_py parse_package_xml Indices and tables ------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search` catkin-0.8.0/doc/dev_guide/api/interrogate_setup_dot_py.rst000066400000000000000000000002431361264727400241270ustar00rootroot00000000000000interrogate_setup_dot_py Module =============================== .. automodule:: interrogate_setup_dot_py :members: :undoc-members: :show-inheritance: catkin-0.8.0/doc/dev_guide/api/parse_package_xml.rst000066400000000000000000000002161361264727400224530ustar00rootroot00000000000000parse_package_xml Module ======================== .. automodule:: parse_package_xml :members: :undoc-members: :show-inheritance: catkin-0.8.0/doc/dev_guide/code_generation.rst000066400000000000000000000006771361264727400213750ustar00rootroot00000000000000Code Generation =============== ROS messages ------------ An example for code generation is the generation of language bindings for ROS messages. Catkin parses ``package.xml`` files for declarations of message-generators. Those will be build first by catkin. Other than that, it is up to packages to use genmsg by including it in the ``CMakeLists.txt`` and calling the cmake macros defined in genmsg. See project :ref:`genmsg `. catkin-0.8.0/doc/dev_guide/dev_guide.rst000066400000000000000000000003521361264727400201710ustar00rootroot00000000000000Developers Guide ================ This section of the documentation is provided for developers of catkin itself. .. toctree:: :maxdepth: 2 sketch layout code_generation generated_cmake_api maintainer api/index catkin-0.8.0/doc/dev_guide/generated_cmake_api.rst000066400000000000000000000773561361264727400222070ustar00rootroot00000000000000Extracted CMake API reference ============================= This page was auto-generated from cmake source files using generate_cmake_rst.py .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. !!!!!! Auto-generated file, do not modify .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. contents:: :local: Public CMake functions / macros ------------------------------- * :cmake:macro:`add_python_executable` * :cmake:macro:`catkin_add_env_hooks` * :cmake:macro:`catkin_add_executable_with_gmock` * :cmake:macro:`catkin_add_executable_with_gtest` * :cmake:macro:`catkin_add_gmock` * :cmake:macro:`catkin_add_gtest` * :cmake:macro:`catkin_add_nosetests` * :cmake:macro:`catkin_download` * :cmake:macro:`catkin_download_test_data` * :cmake:macro:`catkin_filter_libraries_for_build_configuration` * :cmake:macro:`catkin_install_python` * :cmake:macro:`catkin_metapackage` * :cmake:macro:`catkin_pack_libraries_with_build_configuration` * :cmake:macro:`catkin_package` * :cmake:macro:`catkin_package_xml` * :cmake:macro:`catkin_python_setup` * :cmake:macro:`catkin_replace_imported_library_targets` * :cmake:macro:`catkin_unpack_libraries_with_build_configuration` .. _`add_python_executable_ref`: `add_python_executable` ~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: add_python_executable() *[function defined in platform/windows.cmake]* Add Python executable wrapper around Python scripts on Windows. Python scripts with (or without) .py extension are not executable on Windows due to lack of shebang support. :param SCRIPT_NAME: Python script name that needs a wrapper :type SCRIPT_NAME: string :param TARGET_NAME: build target name :type TARGET_NAME: string :param DESTINATION: install destination for the build target :type DESTINATION: string .. _`catkin_add_env_hooks_ref`: `catkin_add_env_hooks` ~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_env_hooks(file_prefix) *[function defined in catkin_add_env_hooks.cmake]* Register environment hooks which are executed by the setup script. For each shell in ``SHELLS``, the macro searches for one of the following files in the directory ``DIRECTORY``: ``.``, ``...em``, ``..em``, ``...in`` or ``..in``. Plain shells, will be copied to, templates are expanded to ``etc/catkin/profile.d/``, where it will be read by global generated ``setup.``. The templates can also distinguish between devel- and installspace using the boolean variables ``DEVELSPACE`` and ``INSTALLSPACE`` which are either ``true`` or ``false``. E.g. @[if DEVELSPACE]@ ... @[end if]@ for .em .. note:: Note that the extra extensions must appear in the filename but must not appear in the argument. .. note:: These files will share a single directory with other packages that choose to install env hooks. Be careful to give the file a unique name. Typically ``NN.name.`` is used, where NN can define when something should be run (the files are read in alphanumeric order) and the name serves to disambiguate in the event of collisions. Example:: catkin_add_env_hooks(my_prefix SHELLS bash tcsh zsh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks) looks for files env-hooks/my_prefix.[bash|tcsh|zsh]((.(devel|install)space)?.[em|in])? The environment hooks are installed into two destinations: * ``etc/catkin/profile.d`` where they can be sourced efficiently by the catkin generated ``setup.`` scripts * ``share/${PROJECT_NAME}/catkin_env_hook`` where they can be sourced efficiently on a per-package base :param file_prefix: the filename prefix :type file_prefix: string :param SHELLS: the shell extensions (e.g.: sh bat bash zsh tcsh) :type SHELLS: list of strings :param DIRECTORY: the directory (default: ${CMAKE_CURRENT_SOURCE_DIR}) :type DIRECTORY: string :param SKIP_INSTALL: if specified the env hooks are only generated in the devel space but not installed :type SKIP_INSTALL: option .. _`catkin_add_executable_with_gmock_ref`: `catkin_add_executable_with_gmock` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_executable_with_gmock(target) *[function defined in test/gtest.cmake]* Add a GMock executable target. An executable target is created with the source files, it is linked against GTest and GMock. If you also want to register the executable as a test use ``catkin_add_gtest()`` instead. :param target: the target name :type target: string :param source_files: a list of source files used to build the test executable :type source_files: list of strings Additionally, the option EXCLUDE_FROM_ALL can be specified. .. _`catkin_add_executable_with_gtest_ref`: `catkin_add_executable_with_gtest` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_executable_with_gtest(target) *[function defined in test/gtest.cmake]* Add a GTest executable target. An executable target is created with the source files, it is linked against GTest. If you also want to register the executable as a test use ``catkin_add_gtest()`` instead. :param target: the target name :type target: string :param source_files: a list of source files used to build the test executable :type source_files: list of strings Additionally, the option EXCLUDE_FROM_ALL can be specified. .. _`catkin_add_gmock_ref`: `catkin_add_gmock` ~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_gmock(target) *[function defined in test/gtest.cmake]* Add a GMock based test target. An executable target is created with the source files, it is linked against GTest and GMock and added to the set of unit tests. .. note:: The test can be executed by calling the binary directly or using: ``make run_tests_${PROJECT_NAME}_gtest_${target}`` :param target: the target name :type target: string :param source_files: a list of source files used to build the test executable :type source_files: list of strings :param TIMEOUT: currently not supported :type TIMEOUT: integer :param WORKING_DIRECTORY: the working directory when executing the executable :type WORKING_DIRECTORY: string .. _`catkin_add_gtest_ref`: `catkin_add_gtest` ~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_gtest(target) *[function defined in test/gtest.cmake]* Add a GTest based test target. An executable target is created with the source files, it is linked against GTest and added to the set of unit tests. .. note:: The test can be executed by calling the binary directly or using: ``make run_tests_${PROJECT_NAME}_gtest_${target}`` :param target: the target name :type target: string :param source_files: a list of source files used to build the test executable :type source_files: list of strings :param TIMEOUT: currently not supported :type TIMEOUT: integer :param WORKING_DIRECTORY: the working directory when executing the executable :type WORKING_DIRECTORY: string .. _`catkin_add_nosetests_ref`: `catkin_add_nosetests` ~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_add_nosetests(path) *[function defined in test/nosetests.cmake]* Add Python nose tests. Nose collects tests from the directory ``dir`` automatically. .. note:: The test can be executed by calling ``nosetests`` directly or using: `` make run_tests_${PROJECT_NAME}_nosetests_${dir}`` (where slashes in the ``dir`` are replaced with periods) :param path: a relative or absolute directory to search for nosetests in or a relative or absolute file containing tests :type path: string :param DEPENDENCIES: the targets which must be built before executing the test :type DEPENDENCIES: list of strings :param TIMEOUT: the timeout for individual tests in seconds (default: 60) :type TIMEOUT: integer :param WORKING_DIRECTORY: the working directory when executing the tests (this option can only be used when the ``path`` argument is a file but not when it is a directory) :type WORKING_DIRECTORY: string .. _`catkin_download_ref`: `catkin_download` ~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_download(target, url) *[function defined in catkin_download.cmake]* Download a file containing data from a URL. It is commonly used to download larger data files which should not be stored in the repository. .. note:: It is not recommended to rely on downloaded data during a configure / make cycle since this prevents building the package when no network connectivity is available. .. note:: The target will be registered as a dependency of the "download_extra_data" target. :param target: the target name :type target: string :param url: the url to download :type url: string :param DESTINATION: the directory where the file is downloaded to (default: ${PROJECT_BINARY_DIR}) :type DESTINATION: string :param FILENAME: the filename of the downloaded file (default: the basename of the url) :type FILENAME: string :param MD5: the expected md5 hash to compare against (default: empty, skipping the check) :type MD5: string Additionally, options EXCLUDE_FROM_ALL and REQUIRED can be specified. .. _`catkin_download_test_data_ref`: `catkin_download_test_data` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_download_test_data(target, url) *[function defined in test/catkin_download_test_data.cmake]* :param DESTINATION: the directory where the file is downloaded to (default: ${PROJECT_BINARY_DIR}) :type DESTINATION: string :param FILENAME: the filename of the downloaded file (default: the basename of the url) :type FILENAME: string :param MD5: the expected md5 hash to compare against (default: empty, skipping the check) :type MD5: string Additionally, option REQUIRED can be specified. .. _`catkin_filter_libraries_for_build_configuration_ref`: `catkin_filter_libraries_for_build_configuration` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_filter_libraries_for_build_configuration(VAR) *[function defined in catkin_libraries.cmake]* Filter libraries based on optional build configuration keywords. :param VAR: the output variable name :type VAR: string :param ARGN: a list of libraries :type ARGN: list of strings :param BUILD_TYPE: a keyword for the build type (default: ``CMAKE_BUILD_TYPE``) :type BUILD_TYPE: list of strings .. _`catkin_install_python_ref`: `catkin_install_python` ~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_install_python(signature) *[function defined in catkin_install_python.cmake]* Install Python files and update their shebang lines to use a different Python executable. The signature: catkin_install_python(PROGRAMS files... DESTINATION [OPTIONAL]) See the documentation for CMake install() function for more information. .. _`catkin_metapackage_ref`: `catkin_metapackage` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_metapackage() *[function defined in catkin_metapackage.cmake]* It installs the package.xml file of a metapackage. .. note:: It must be called once for each metapackage. Best practice is to call this macro early in your root CMakeLists.txt, immediately after calling ``project()`` and ``find_package(catkin REQUIRED)``. :param DIRECTORY: the path to the package.xml file if not in the same location as the CMakeLists.txt file :type DIRECTORY: string .. _`catkin_pack_libraries_with_build_configuration_ref`: `catkin_pack_libraries_with_build_configuration` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_pack_libraries_with_build_configuration(VAR) *[function defined in catkin_libraries.cmake]* Pack a list of libraries with optional build configuration keywords. Each keyword is joined with its library using a separator. A packed library list can be deduplicated correctly. :param VAR: the output variable name :type VAR: string :param ARGN: a list of libraries :type ARGN: list of strings .. _`catkin_package_ref`: `catkin_package` ~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_package() *[macro defined in catkin_package.cmake]* It installs the package.xml file, and it generates code for ``find_package`` and ``pkg-config`` so that other packages can get information about this package. For this purpose the information about include directories, libraries, further dependencies and CMake variables are used. .. note:: It must be called once for each package. It is indirectly calling``catkin_destinations()`` which will provide additional output variables. Please make sure to call ``catkin_package()`` before using those variables. :param INCLUDE_DIRS: ``CMAKE_CURRENT_SOURCE_DIR``-relative paths to C/C++ includes :type INCLUDE_DIRS: list of strings :param LIBRARIES: names of library targets that will appear in the ``catkin_LIBRARIES`` and ``${PROJECT_NAME}_LIBRARIES`` of other projects that search for you via ``find_package``. Currently this will break if the logical target names are not the same as the installed names. :type LIBRARIES: list of strings :param CATKIN_DEPENDS: a list of catkin projects which this project depends on. It is used when client code finds this project via ``find_package()`` or ``pkg-config``. Each project listed will in turn be ``find_package``\ -ed or is states as ``Requires`` in the .pc file. Therefore their ``INCLUDE_DIRS`` and ``LIBRARIES`` will be appended to ours. Only catkin projects should be used where it be guarantee that they are *find_packagable* and have pkg-config files. :type CATKIN_DEPENDS: list of strings :param DEPENDS: a list of CMake projects which this project depends on. Since they might not be *find_packagable* or lack a pkg-config file their ``INCLUDE_DIRS`` and ``LIBRARIES`` are passed directly. This requires that it has been ``find_package``\ -ed before and all variables (``_FOUND``, ``_INCLUDE_DIRS``, etc.) have the same case as this argument. :type DEPENDS: list of strings :param CFG_EXTRAS: a CMake file containing extra stuff that should be accessible to users of this package after ``find_package``\ -ing it. This file must live in the subdirectory ``cmake`` or be an absolute path. All passed extra files must have unique basenames since they are being installed into a single folder. Various additional file extension are possible: for a plain cmake file just ``.cmake``, for files expanded using CMake's ``configure_file()`` use ``.cmake.in`` or for files expanded by empy use ``.cmake.em``. The templates can distinguish between devel- and installspace using the boolean variables ``DEVELSPACE`` and ``INSTALLSPACE``. For templated files it is also possible to use the extensions ``.cmake.develspace.(in|em)`` or ``.cmake.installspace.(em|in)`` to generate the files only for a specific case. If the global variable ${PROJECT_NAME}_CFG_EXTRAS is set it will be prepended to the explicitly passed argument. :type CFG_EXTRAS: string :param EXPORTED_TARGETS: a list of target names which usually generate code. Downstream packages can depend on these targets to ensure that code is generated before it is being used. The generated CMake config file will ensure that the targets exists. If the global variable ${PROJECT_NAME}_EXPORTED_TARGETS is set it will be prepended to the explicitly passed argument. :type EXPORTED_TARGETS: list of strings :param SKIP_CMAKE_CONFIG_GENERATION: the option to skip the generation of the CMake config files for the package :type SKIP_CMAKE_CONFIG_GENERATION: bool :param SKIP_PKG_CONFIG_GENERATION: the option to skip the generation of the pkg-config file for the package :type SKIP_PKG_CONFIG_GENERATION: bool Example: :: catkin_package( INCLUDE_DIRS include LIBRARIES projlib1 projlib2 CATKIN_DEPENDS roscpp DEPENDS Eigen CFG_EXTRAS proj-extras[.cmake|.cmake.in|.cmake(.develspace|.installspace)?.em] ) .. _`catkin_package_xml_ref`: `catkin_package_xml` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_package_xml() *[macro defined in catkin_package_xml.cmake]* Parse package.xml from ``CMAKE_CURRENT_SOURCE_DIR`` and make several information available to CMake. .. note:: It is called automatically by ``catkin_package()`` if not called manually before. It must be called once in each package, after calling ``project()`` where the project name must match the package name. The macro should only be called manually if the variables are use to parameterize ``catkin_package()``. :param DIRECTORY: the directory of the package.xml (default ``${CMAKE_CURRENT_SOURCE_DIR}``). :type DIRECTORY: string :outvar _VERSION: the version number :outvar _MAINTAINER: the name and email of the maintainer(s) :outvar _PACKAGE_FORMAT: the format version of the manifest :outvar __DEPENDS: the dependencies of a specific type, the following types are available: BUILD, BUILD_EXPORT, BUILDTOOL, BUILDTOOL_EXPORT, EXEC, RUN, TEST, DOC :outvar __DEPENDS__VERSION_: for each dependency which has a version range specified the version number is provided, the following version types are available: LT, LTE, EQ, GTE, GT :outvar _URL_WEBSITE: the url(s) of type `website` :outvar _URL_BUGTRACKER: the url(s) of type `bugtracker` :outvar _URL_REPOSITORY: the url(s) of type `repository` :outvar _DEPRECATED: `TRUE` if the package is deprecated :outvar _CATKIN_CURRENT_PACKAGE: the name of the package from the manifest .. note:: It is calling ``catkin_destinations()`` which will provide additional output variables. .. _`catkin_python_setup_ref`: `catkin_python_setup` ~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_python_setup() *[function defined in catkin_python_setup.cmake]* This macro will interrogate the Python setup.py file in ``${${PROJECT_NAME}_SOURCE_DIR}``, and then creates forwarding Python :term:`pkgutil` infrastructure in devel space accordingly for the scripts and packages declared in setup.py. Doing so enables mixing :term:`generated code` in devel space with :term:`static code` from sourcespace within a single Python package. In addition, it adds the install command of distutils/setuputils to the install target. .. note:: If the project also uses genmsg message generation via ``generate_messages()`` this function must be called before. .. _`catkin_replace_imported_library_targets_ref`: `catkin_replace_imported_library_targets` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_replace_imported_library_targets(VAR) *[function defined in catkin_libraries.cmake]* Replace imported library target names with the library name. :param VAR: the output variable name :type VAR: string :param ARGN: a list of libraries :type ARGN: list of strings .. _`catkin_unpack_libraries_with_build_configuration_ref`: `catkin_unpack_libraries_with_build_configuration` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_unpack_libraries_with_build_configuration(VAR) *[function defined in catkin_libraries.cmake]* Unpack a list of libraries with optional build configuration keyword prefixes. Libraries prefixed with a keyword are split into the keyword and the library. :param VAR: the output variable name :type VAR: string :param ARGN: a list of libraries :type ARGN: list of strings Non-public CMake functions / macros ----------------------------------- * :cmake:macro:`_catkin_add_executable_with_google_test` * :cmake:macro:`_catkin_add_google_test` * :cmake:macro:`_generate_function_if_testing_is_disabled` * :cmake:macro:`_set_cmake_policy_to_new_if_available` * :cmake:macro:`_warn_if_skip_testing` * :cmake:macro:`catkin_destinations` * :cmake:macro:`catkin_install_logic` * :cmake:macro:`catkin_run_tests_target` * :cmake:macro:`catkin_symlink_install_append_install_code` * :cmake:macro:`catkin_symlink_install_directory` * :cmake:macro:`catkin_symlink_install_files` * :cmake:macro:`catkin_symlink_install_programs` * :cmake:macro:`catkin_symlink_install_targets` * :cmake:macro:`catkin_workspace` * :cmake:macro:`list_append_deduplicate` * :cmake:macro:`list_append_unique` * :cmake:macro:`stamp` * :cmake:macro:`string_starts_with` .. _`_catkin_add_executable_with_google_test_ref`: `_catkin_add_executable_with_google_test` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _catkin_add_executable_with_google_test(type, target) *[function defined in test/gtest.cmake]* This is an internal function, use catkin_add_executable_with_gtest or catkin_add_executable_with_gmock instead. :param type: "gtest" or "gmock" The remaining arguments are the same as for catkin_add_executable_with_gtest and catkin_add_executable_with_gmock. .. _`_catkin_add_google_test_ref`: `_catkin_add_google_test` ~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _catkin_add_google_test(type, target) *[function defined in test/gtest.cmake]* This is an internal function, use catkin_add_gtest or catkin_add_gmock instead. :param type: "gtest" or "gmock" The remaining arguments are the same as for catkin_add_gtest and catkin_add_gmock. .. _`_generate_function_if_testing_is_disabled_ref`: `_generate_function_if_testing_is_disabled` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _generate_function_if_testing_is_disabled() *[macro defined in test/tests.cmake]* creates dummy functions in case testing has been explicitly disabled (and not only skipping) which outputs an error message when being invoked .. _`_set_cmake_policy_to_new_if_available_ref`: `_set_cmake_policy_to_new_if_available` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _set_cmake_policy_to_new_if_available(policy) *[macro defined in all.cmake]* enable all new policies (if available) .. _`_warn_if_skip_testing_ref`: `_warn_if_skip_testing` ~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _warn_if_skip_testing(funcname) *[macro defined in test/tests.cmake]* checks if a function has been called while testing is skipped and outputs a warning message .. _`catkin_destinations_ref`: `catkin_destinations` ~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_destinations() *[macro defined in catkin_destinations.cmake]* Set several path suffixes for install destinations. :outvar CATKIN_PACKAGE_BIN_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_BIN_DESTINATION`. :outvar CATKIN_PACKAGE_ETC_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_ETC_DESTINATION`. :outvar CATKIN_PACKAGE_INCLUDE_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_INCLUDE_DESTINATION`. :outvar CATKIN_PACKAGE_LIB_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_LIB_DESTINATION`. :outvar CATKIN_PACKAGE_PYTHON_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_PYTHON_DESTINATION`. :outvar CATKIN_PACKAGE_SHARE_DESTINATION: See :cmake:data:`CATKIN_PACKAGE_SHARE_DESTINATION`. :outvar CATKIN_GLOBAL_BIN_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_BIN_DESTINATION`. :outvar CATKIN_GLOBAL_ETC_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_ETC_DESTINATION`. :outvar CATKIN_GLOBAL_INCLUDE_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_INCLUDE_DESTINATION`. :outvar CATKIN_GLOBAL_LIB_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_LIB_DESTINATION`. :outvar CATKIN_GLOBAL_LIBEXEC_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_LIBEXEC_DESTINATION`. :outvar CATKIN_GLOBAL_PYTHON_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_PYTHON_DESTINATION`. :outvar CATKIN_GLOBAL_SHARE_DESTINATION: See :cmake:data:`CATKIN_GLOBAL_SHARE_DESTINATION`. .. _`catkin_install_logic_ref`: `catkin_install_logic` ~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_install_logic(signature) *[function defined in symlink_install/catkin_install_logic.cmake]* Custom CMake install logic to use symlinks instead of copying resources. :param ARGN: the same arguments as the CMake install command. :type ARGN: various .. _`catkin_run_tests_target_ref`: `catkin_run_tests_target` ~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_run_tests_target(type, name, xunit_filename) *[function defined in test/tests.cmake]* Create a test target, integrate it with the run_tests infrastructure and post-process the junit result. All test results go under ${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME} This function is only used internally by the various catkin_add_*test() functions. .. _`catkin_symlink_install_append_install_code_ref`: `catkin_symlink_install_append_install_code` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_symlink_install_append_install_code() *[function defined in symlink_install/catkin_symlink_install_append_install_code.cmake]* Register a CMake script for execution at install time. :param ARGN: the list of CMake code lines :type ARGN: list of strings :param COMMENTS: an optional list of comments :type COMMENTS: list of strings .. _`catkin_symlink_install_directory_ref`: `catkin_symlink_install_directory` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_symlink_install_directory(directory_keyword) *[function defined in symlink_install/catkin_symlink_install_directory.cmake]* Reimplement CMake install(DIRECTORY) command to use symlinks instead of copying resources. :param ARGN: the same arguments as the CMake install command. :type ARGN: various .. _`catkin_symlink_install_files_ref`: `catkin_symlink_install_files` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_symlink_install_files(files_keyword) *[function defined in symlink_install/catkin_symlink_install_files.cmake]* Reimplement CMake install(FILES) command to use symlinks instead of copying resources. :param ARGN: the same arguments as the CMake install command. :type ARGN: various .. _`catkin_symlink_install_programs_ref`: `catkin_symlink_install_programs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_symlink_install_programs(programs_keyword) *[function defined in symlink_install/catkin_symlink_install_programs.cmake]* Reimplement CMake install(PROGRAMS) command to use symlinks instead of copying resources. :param ARGN: the same arguments as the CMake install command. :type ARGN: various .. _`catkin_symlink_install_targets_ref`: `catkin_symlink_install_targets` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_symlink_install_targets() *[function defined in symlink_install/catkin_symlink_install_targets.cmake]* Reimplement CMake install(TARGETS) command to use symlinks instead of copying resources. :param ARGN: the same arguments as the CMake install command. :type ARGN: various .. _`catkin_workspace_ref`: `catkin_workspace` ~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_workspace() *[function defined in catkin_workspace.cmake]* Search all subfolders in the workspace for ``package.xml`` files. Based on the dependencies specified in the ``build_depends``, ``buildtool_depends`` and (as of package format version 2) ``test_depends`` tags it performs a topological sort and calls ``add_subdirectory()`` for each directory. The functions is only called in catkin's ``toplevel.cmake``, which is usually symlinked to the workspace root directory (which contains multiple packages). .. _`list_append_deduplicate_ref`: `list_append_deduplicate` ~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: list_append_deduplicate(listname) *[macro defined in list_append_deduplicate.cmake]* Append elements to a list and remove existing duplicates from the list. .. note:: Using CMake's ``list(APPEND ..)`` and ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its implementation uses a set internally which makes the operation unstable. .. _`list_append_unique_ref`: `list_append_unique` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: list_append_unique(listname) *[macro defined in list_append_unique.cmake]* Append elements to a list if they are not already in the list. .. note:: Using CMake's ``list(APPEND ..)`` and ``list(REMOVE_DUPLICATES ..)`` is not sufficient since its implementation uses a set internally which makes the operation unstable. .. _`stamp_ref`: `stamp` ~~~~~~~ .. cmake:macro:: stamp(path) *[function defined in stamp.cmake]* :param path: file name Uses ``configure_file`` to generate a file ``filepath.stamp`` hidden somewhere in the build tree. This will cause cmake to rebuild its cache when ``filepath`` is modified. .. _`string_starts_with_ref`: `string_starts_with` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: string_starts_with(str, prefix, var) *[function defined in string_starts_with.cmake]* Check if a string starts with a prefix. :param str: the string :type str: string :param prefix: the prefix :type prefix: string :param var: the output variable name :type var: bool Not documented CMake functions / macros --------------------------------------- .. _`_catkin_package_ref`: `_catkin_package` ~~~~~~~~~~~~~~~~~ .. cmake:macro:: _catkin_package() *[function defined in catkin_package.cmake]* .. _`_catkin_package_xml_ref`: `_catkin_package_xml` ~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _catkin_package_xml(dest_dir) *[macro defined in catkin_package_xml.cmake]* .. _`_strip_path_prefix_ref`: `_strip_path_prefix` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _strip_path_prefix(var, value, prefix) *[function defined in test/nosetests.cmake]* .. _`_use_custom_install_ref`: `_use_custom_install` ~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: _use_custom_install() *[function defined in custom_install.cmake]* .. _`assert_ref`: `assert` ~~~~~~~~ .. cmake:macro:: assert(VAR) *[function defined in assert.cmake]* .. _`assert_file_exists_ref`: `assert_file_exists` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: assert_file_exists(FILENAME, MESSAGE) *[function defined in assert.cmake]* .. _`assert_unset_ref`: `assert_unset` ~~~~~~~~~~~~~~ .. cmake:macro:: assert_unset(VAR) *[function defined in assert.cmake]* .. _`atomic_configure_file_ref`: `atomic_configure_file` ~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: atomic_configure_file(input, output) *[function defined in atomic_configure_file.cmake]* .. _`catkin_doxygen_ref`: `catkin_doxygen` ~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_doxygen(TARGET_NAME, SEARCH_DIRS) *[function defined in tools/doxygen.cmake]* .. _`catkin_generate_environment_ref`: `catkin_generate_environment` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: catkin_generate_environment() *[function defined in catkin_generate_environment.cmake]* .. _`catkin_stack_ref`: `catkin_stack` ~~~~~~~~~~~~~~ .. cmake:macro:: catkin_stack() *[function defined in legacy.cmake]* .. _`configure_shared_library_build_settings_ref`: `configure_shared_library_build_settings` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: configure_shared_library_build_settings() *[function defined in tools/libraries.cmake]* .. _`debug_message_ref`: `debug_message` ~~~~~~~~~~~~~~~ .. cmake:macro:: debug_message(level) *[function defined in debug_message.cmake]* .. _`em_expand_ref`: `em_expand` ~~~~~~~~~~~ .. cmake:macro:: em_expand(context_in, context_out, em_file_in, file_out) *[function defined in em_expand.cmake]* .. _`find_program_required_ref`: `find_program_required` ~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: find_program_required(ARG_VAR, ARG_PROGRAM_NAME) *[function defined in find_program_required.cmake]* .. _`find_python_module_ref`: `find_python_module` ~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: find_python_module(module) *[function defined in empy.cmake]* .. _`list_insert_in_workspace_order_ref`: `list_insert_in_workspace_order` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: list_insert_in_workspace_order(listname) *[function defined in list_insert_in_workspace_order.cmake]* .. _`safe_execute_process_ref`: `safe_execute_process` ~~~~~~~~~~~~~~~~~~~~~~ .. cmake:macro:: safe_execute_process(cmd_keyword, arg1) *[function defined in safe_execute_process.cmake]* .. _`shell_ref`: `shell` ~~~~~~~ .. cmake:macro:: shell(arg1) *[function defined in shell.cmake]* catkin-0.8.0/doc/dev_guide/layout.rst000066400000000000000000000110301361264727400175460ustar00rootroot00000000000000Pre- and Post-installation Disk Layout reference ================================================ .. highlight:: catkin-sh .. rubric:: Source directory This page describes the intended layout of build and install folders, in particular with respect to the Filesystem Hierarchy standard (FHS). e.g. for package 'pkg':: src/ pkg/ CMakeLists.txt package.xml # contains inter-package and system dependencies # as specified in `REP 127 `_ include/ pkg/ header.hpp otherheader.hpp msg/ PkgMsg.msg src/ pkg/ __init__.py module.py CMakeLists.txt source.cpp srv/ PkgSrv.srv .. todo:: Mention what happens with a ``manifest.xml`` file for backward compatibility with rosbuild .. rubric:: Build directory :: build/ CATKIN_IGNORE # an empty file to guide catkin to not search in subfolders for package.xml files CMakeCache.txt cmake_install.cmake Makefile devel/ # the layout of that folder follows the (see install directory) .catkin # identifies folder as a catkin devel/install space # it contains a semicolon separated list of source folders if the workspace is a devel space env.sh setup.bash setup.sh setup.zsh _setup_util.py # functions for the setup shell scripts bin/ # just "anointed" central binaries (i.e. rosrun) etc/ # environment hooks, configuration files catkin/ profile.d/ 10.ros.sh # e.g. defining the ROS_MASTER_URI langs/ # to determine which message generators are available roscpp # contains "C++" rospy # contains "Python" include/ # header files of generated code lib/ # all compiled libraries go here pkgconfig/ # generated .pc files for all packages pythonX.Y/ dist-packages/ pkg/ # generated Python code __init__.py # generated file to relay imports into src directory of that package pkg/ # compiled binaries of that package share/ # all package-specific but architecture independent files pkg/ # one folder per package cmake/ # generated pkgConfig.cmake and pkgConfig-version.cmake for find_package() CMakeFiles/ pkgN/ # the usual CMake-generated stuff catkin_generated/ # files generated by catkin cmake/ CMakeFiles cmake_install.cmake installspace/ # files generated by catkin which will be installed Makefile ... .. rubric:: Install directory The layout of the install directory follows the `Filesystem Hierarchy Standard (FHS) `_. :: /opt/ros/groovy/ # defined by the CMAKE_INSTALL_PREFIX # very similar to the devel space folder # therefore in the following only the differences are mentioned .catkin # identifies folder as a catkin devel/install space # the file is empty which indicates that it is an installspace lib/ pythonX.Y/ dist-packages/ pkg/ # besides the generated Python code # contains the Python source code of package include/ # besides the generated header files # contains all header files from the source directories share/ pkg/ # further resources (i.e. icons) copied from source directory manifest.xml # provide export information for legacy rosmake based stacks/packages action/ msg/ Foo.msg Bar.msg something.launch # the rest is as the package installs it stacks/ dry_stack1 # packages built via legacy rosmake dry_stack2 # packages built via legacy rosmake catkin-0.8.0/doc/dev_guide/maintainer.rst000066400000000000000000000007471361264727400203750ustar00rootroot00000000000000Catkin Maintainers guide ------------------------ This information is useful for maintainers of catkin itself only. Upload catkin documentation --------------------------- To build and upload a new version of catkin's documentation to `ros.org `_, (this is specific to catkin itself, and requires that you have appropriate credentials configured):: git clone git://github.com/ros/catkin.git cd catkin/doc make html make upload catkin-0.8.0/doc/dev_guide/sketch.rst000066400000000000000000000171571361264727400175320ustar00rootroot00000000000000Design sketch ============= * There is only one invocation of CMake (and make) to build a source directory containing N packages. * This install target obeys the environment variable ``DESTDIR`` for ease of packaging. * Build Parameters: * The standard set of CMake variables, especially ``CMAKE_INSTALL_PREFIX``, ``CMAKE_BUILD_TYPE``, ``CMAKE_TOOLCHAIN_FILE`` etc. * Assorted others as needed by individual packages, i.e. to enable/disable certain features or dependencies. * For build, there is no search of ROS_PACKAGE_PATH: the packages to be built are the subdirectories (potentially recursive) of the ``CMAKE_SOURCE_DIR``. * The source folders of a devel space are listed in the .catkin file in the devel space folder. This can be more than one folder in cases where several build folders share the same devel space. * For backward compatibility, sourcing a devel space setup.*sh also sets the ROS_PACKAGE_PATH env variable preprending for each workspace the contents of .catkin. This allows searching for package contents in package sources. * Catkin does only knows about packages: it simply examines the subdirectories under ``CMAKE_SOURCE_DIR`` for buildable projects (indicated by the presence of a file ``package.xml`` (see `REP 127 `_). It determines the dependency ordering of packages by examining these files. * The ability to build only specific targets or sets of targets are provided through cmake's "natural" mechanisms (Meaning ``$ make foo`` only builds target foo) * The build does not modify the source directories in any way. * The build does not depend on any compiled code (i.e. ``rospack``) for ease of compiling on windows, cross-compiling for ARM, etc. (but may depend on python scripts) * Packages use standard CMake macros, modulo a few that are provided by catkin. * The build system depends only on CMake and Python. * Downloading, untarring, patching and especially the wanton use of ``sed`` and/or handcoded Makefiles is considered to be in the very poorest taste. Exception: for now, Sphinx-generated Makefiles used to generate documentation are okay. * The build process creates a buildpace folder that has the same layout as an installation, so development cycles do not need to invoke ``make install`` frequently, if the developer decides to use that devel space directly. Main trickery ------------- .. rubric:: Dependency ordering of packages During the CMake run the main source directory is scanned for packages to build. Each package indicates that it is buildable, and what its dependencies in the ``package.xml`` file. Catkin considers the ``build`` and ``buildtool`` dependencies as specified in the `REP 127 `_, topologically sorts the packages and calls ``add_subdirectory()`` on each package in order. .. rubric:: Generation of ``find_package`` infrastructure Each package calls :cmake:macro:`catkin_package` which generates ``find_package`` files; this is for other packages to use. Each package does a ``find_package`` of each other; in this way, packages can build with their dependencies in the same devel space, or already installed on the system. Different versions of these files are created for use in the devel space, and in the installation. The stress-test for this scheme is message generation; different language generators must implement a specific CMake interface which is used by ``genmsg``. See also :ref:`find_package_internals`. .. rubric:: Python path forwarding A special thunk (via the standard python package `pkgutil `_ is generated and put in ``CMAKE_BINARY_DIR/lib/pythonX.Y/dist-packages/PACKAGENAME/__init__.py``, which extends the ``PYTHONPATH`` to include ``CMAKE_SOURCE_DIR/path/to/PACKAGENAME/src``. This way the devel space PYTHONPATH only needs to contain ``CMAKE_BINARY_DIR/lib/pythonX.Y/dist-packages``. Caveat: it will also need to contain generated Python code in that folder in devel space. At installation time, this thunk-__init__.py disappears and the static python library source is installed alongside the generated message code in the same directory. .. rubric:: Environment generation When CMake runs, it knows the locations of the ``CMAKE_BINARY_DIR`` and so forth, it generates an environment file (in ``CMAKE_BINARY_DIR/devel``). Projects may extend this environment via :cmake:macro:`catkin_add_env_hooks`. Configure process ----------------- The following sketches the sequence of cmake scripts invoked and what they do. Calling cmake with the source folder is processed like this: Workspace ^^^^^^^^^ 1. *toplevel.cmake*: The top-level CMakeLists.txt is loaded by Catkin, this should be a symbolic link to catin/cmake/toplevel.cmake. 1. attempts to find catkin's sources by traversing locations in this oder: a. In the source folder direct subfolder 'catkin' (using ${CMAKE_SOURCE_DIR}/catkin) b. Workspace folders listed in CMAKE_PREFIX_PATH 2. loads catkin macros from the first catkin location found that way 1. *all.cmake*: 1. set global destination variables 1. updates .catkin file in devel space 1. set CATKIN_WORKSPACES based on CMAKE_PREFIX_PATH entries 1. enables new cmake policies 1. invokes catkin_generate_environment() 1. *catkin_generate_environment*: 1. creates empty catkin marker file .catkin in installspace 2. creates environment setup files 3. exits with catkin_workspace() 2. *catkin_workspace.cmake*: 1. creates output folders (lib, bin, ...) in build folder 2. generates helper scripts (python cmake) in build/catkin_generated 3. invokes generated helper-script order_packages.cmake 1. *order_packages.cmake*: This writes into variables the list of packages in this workspace, ordered by dependencies 4. loads CMakeLists.txt in each package in sequence package ^^^^^^^ This depends on the actual CMakeLists.txt of course, and any standard cmake project is allowed, so we sketch here only the case when the catkin macros are used as intended. 1. *CMakeLists.txt*: 1. find_package(catkin REQUIRED [COMPONENTS ...]) 1. finds catkin, then calls find_package() with each of the components 2. (optionally) catkin_python_setup() 1. generate relay scripts in devel space pointing to scripts in source 2. generate relay __init__.py files for any package mentioned 3. prepare installation based on values in setup.py 3. (optionally) use genmsg to create msg/srv 1. add_message_files and/or add service_files 1. declare install target for .msg/.srv files 2. generate_messages() 1. generate \*-msg-paths.cmake files 2. generate __init__.py unless catkin_python_setup did 4. catkin_package() 1. *catkin_package.cmake*: 1. invokes catkin_package_xml() 1. *catkin_package_xml.cmake* parse package.xml and sets cmake variable accordingly (version, maintainer, dependencies) 2. sets package-wide destination variables for usage by the user 3. sets global variable ${PROJECT_NAME}_DIR 4. evaluates arguments to catkin_package() 5. generates files in devel space and build folder a. devel space is a folder mimicking an installation 1. generates a manifest.xml file for rosbuild backwards compatibility 2. generates .pc, XXXConfig.cmake, Config-version.cmake, ... files b. build folder contains files that will be installed by moving to install prefix 1. generates .pc, XXXConfig.cmake, Config-version.cmake, ... files 6. declares files to be commonly installed 5. (optionally) catkin_add_env_hooks 1. copies files / configures templates into develspace, mark for installation catkin-0.8.0/doc/generate_cmake_rst.py000077500000000000000000000170401361264727400177520ustar00rootroot00000000000000#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import argparse import json import os import re import sys """Simple superficial API doc generator for .cmake files""" def crawl_for_cmake(path, excluded_files=None): """Crawls over path, looking for files named *.cmake, returns tuple of full and relative path.""" cmake_files = [] for (parentdir, _, files) in os.walk(path): for filename in files: if not filename.endswith('.cmake') or \ (excluded_files and filename in excluded_files): continue fullpath = os.path.join(parentdir, filename) relpath = os.path.relpath(fullpath, path) cmake_files.append((fullpath, relpath)) return cmake_files def generate_rst(files, skip_private=False, skip_undocumented=False): """ Each of the CMake files is traversed line by line, looking for lines like function(...) or macro(...). For each of these, multiple lines of reStructured text are added documenting the function. """ public = {} documented = {} undocumented = {} for (fullpath, relpath) in files: last_block = [] last_block_public = False with open(fullpath, 'r') as f: lines = f.readlines() for line in lines: if line.startswith('#'): line = line.lstrip('#') if line.strip() == '@public': last_block_public = True else: last_block.append(line.rstrip('\n')) else: declaration = re.match(r'[a-zA-Z]+ *\([a-zA-Z0-9_ ]+\)', line) if declaration is None: last_block = [] last_block_public = False else: tokens = line.split('(') dec_type = tokens[0].strip() dec_args = tokens[1].strip().rstrip(')').split(' ') if dec_type == 'function' or dec_type == 'macro': rst = [] # directives defined in catkin-sphinx dec_line = '.. _`%s_ref`:\n\n`%s`\n%s\n\n.. cmake:macro:: %s(%s)' % (dec_args[0], dec_args[0], '~' * (len(dec_args[0]) + 2), dec_args[0], ', '.join(dec_args[1:])) rst.append(dec_line) rst.append('') rst.append(' *[%s defined in %s]*' % (dec_type, relpath)) if last_block: rst.append('') rst.extend(last_block) if dec_args[0] in documented or dec_args[0] in undocumented: raise RuntimeError('Function/macro with same name "%s" exists multiple times' % dec_args[0]) if last_block_public: public[dec_args[0]] = rst elif last_block: documented[dec_args[0]] = rst else: undocumented[dec_args[0]] = rst last_block = [] last_block_public = False rst = ['Extracted CMake API reference', '============================='] rst.append('This page was auto-generated from cmake source files using %s\n' % os.path.basename(__file__)) rst.append('.. ' + '!' * 70) rst.append('.. !!!!!! Auto-generated file, do not modify') rst.append('.. ' + '!' * 70) rst.append('') rst.append('.. contents::') rst.append(' :local:') rst.append('') rst.append('') rst.append('Public CMake functions / macros') rst.append('-------------------------------') rst.append('') for name in sorted(public.keys()): rst.append(' * :cmake:macro:`%s`' % name) for name in sorted(public.keys()): rst.append('') rst.extend(public[name]) rst.append('') if not skip_private: rst.append('Non-public CMake functions / macros') rst.append('-----------------------------------') rst.append('') for name in sorted(documented.keys()): rst.append(' * :cmake:macro:`%s`' % name) for name in sorted(documented.keys()): rst.append('') rst.extend(documented[name]) rst.append('') if not skip_undocumented: rst.append('Not documented CMake functions / macros') rst.append('---------------------------------------') for name in sorted(undocumented.keys()): rst.append('') rst.extend(undocumented[name]) rst.append('') return rst if __name__ == '__main__': parser = argparse.ArgumentParser(description='Crawls a path for .cmake files and extract documentation of functions and macros into reStructured text.') parser.add_argument('path', nargs='?', default='.', help='The path to be crawled') parser.add_argument('-o', '--output', help='The name of the generated rst file') parser.add_argument('--skip_private', action='store_true', help='Skip documented items not marked with @public') parser.add_argument('--skip_undocumented', action='store_true', help='Skip items without documentation.') args = parser.parse_args() exclusions = '{}/.sphinx_exclusions.json'.format(args.path) excluded_files = [] if os.path.exists(exclusions): try: with open(exclusions, 'r') as f: excluded_files = json.load(f) except (TypeError, ValueError) as err: print('unable to load exclusions\nerr={}\n' 'make sure the file <{}> is valid json or remove it'. format(err, exclusions), file=sys.stderr) sys.exit(-1) cmake_files = crawl_for_cmake(args.path, excluded_files) lines = generate_rst(cmake_files, args.skip_private, args.skip_undocumented) if args.output: with open(args.output, 'w') as f: f.write('\n'.join(lines)) else: for line in lines: print(line) sys.exit(0) catkin-0.8.0/doc/howto/000077500000000000000000000000001361264727400147115ustar00rootroot00000000000000catkin-0.8.0/doc/howto/format1/000077500000000000000000000000001361264727400162625ustar00rootroot00000000000000catkin-0.8.0/doc/howto/format1/building_executables.rst000066400000000000000000000050351361264727400232000ustar00rootroot00000000000000.. _building_executables_1: Building and installing C++ executables --------------------------------------- For this example, suppose you have an executable build target named ``your_node``. Headers ::::::: Before compiling, collect all the header paths for your build dependencies:: include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) These parameters are just examples. The ``include`` parameter is needed only if that subdirectory of your source package contains headers used to compile your programs. All your catkin package header dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. Other :ref:`how_to_do_common_tasks_1` pages describe how to resolve header dependencies in more detail. Building :::::::: To build ``your_node``, add this command to your ``CMakeLists.txt``, listing all required C++ source files, but not the headers:: add_executable(your_node src1.cpp src2.cpp src_etc.cpp) If the list of files is long, a CMake variable can help:: set(YOUR_NODE_SOURCES src/file1.cpp src/file2.cpp src/file3.cpp src/file4.cpp src/file5.cpp src/file6.cpp src/file_etc.cpp) add_executable(your_node ${YOUR_NODE_SOURCES}) If your program depends on libraries provided by other catkin packages, add this:: add_executable(your_node ${YOUR_NODE_SOURCES}) target_link_libraries(your_node ${catkin_LIBRARIES}) If your program depends on additional non-catkin system libraries, include them in the ``target_link_libraries()``:: add_executable(your_node ${YOUR_NODE_SOURCES}) target_link_libraries(your_node ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${GSTREAMER_LIBRARIES}) If the list of libraries is lengthy, you can similarly define a CMake variable for them. Installing :::::::::: ROS executables are installed in a per-package directory, not the distributions's global ``bin/`` directory. There, they are accessible to rosrun_ and roslaunch_, without cluttering up the shell's ``$PATH``, and their names only need to be unique within each package. There are only a few core ROS commands like ``rosrun`` and ``roslaunch`` that install in the global ``bin/`` directory. List all your executables as TARGETS on an install command like this:: install(TARGETS your_node RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) .. _roslaunch: http://ros.org/wiki/roslaunch .. _rosrun: http://ros.org/wiki/rosrun catkin-0.8.0/doc/howto/format1/building_libraries.rst000066400000000000000000000070551361264727400226540ustar00rootroot00000000000000.. _building_libraries_1: Building and installing C++ libraries and headers ------------------------------------------------- In catkin, libraries will be installed in a common directory shared by all the packages in that entire ROS distribution. So, make sure your library names are sufficiently unique not to clash with other packages or system libraries. For this example, suppose you have a shared library build target named ``your_library``. On Linux, the actual file name will be something like ``libyour_library.so``, perhaps with a version number suffix. Headers ::::::: Before compiling, collect all the header paths for your build dependencies:: include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) That only needs to be done once in your ``CMakeLists.txt``. These parameters are just examples. The ``include`` parameter is needed only if that subdirectory of your source package contains headers used to compile your programs. All your catkin package header dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. Other :ref:`how_to_do_common_tasks_1` pages describe how to resolve header dependencies in more detail. Building :::::::: To build your library add this command to your ``CMakeLists.txt``, listing all required C++ source files, but not the headers:: add_library(your_library libsrc1.cpp libsrc2.cpp libsrc_etc.cpp) If the list of source files is long, a CMake variable can help:: set(YOUR_LIB_SOURCES libsrc1.cpp libsrc2.cpp libsrc3.cpp libsrc4.cpp libsrc_etc.cpp) add_library(your_library ${YOUR_LIB_SOURCES}) If your library depends on libraries provided by other catkin packages, add this command:: target_link_libraries(your_library ${catkin_LIBRARIES}) If your library depends on additional non-catkin system libraries, include them in the ``target_link_libraries()``:: target_link_libraries(your_library ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${GSTREAMER_LIBRARIES}) If the list of libraries is lengthy, you can similarly define a CMake variable for them. Installing :::::::::: In catkin, libraries are installed in a ``lib/`` directory shared by all the packages in that entire ROS distribution. So, be careful what you name them. Add these commands to your ``CMakeLists.txt``, substituting all your library build target names for ``your_library``:: catkin_package(INCLUDE_DIRS include LIBRARIES your_library) install(TARGETS your_library ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) The runtime destination is used for `.dll` file on Windows which must be placed in the global bin folder. Libraries typically provide headers defining their interfaces. Please follow standard ROS practice and place all external header files under ``include/your_package/``:: install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) That command installs all the files in your package's include subtree. Place only your exported headers there. If yours is a Subversion_ repository, don't forget to exclude the ``.svn`` subdirectories like this:: install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} PATTERN ".svn" EXCLUDE) .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format1/building_msgs.rst000066400000000000000000000061531361264727400216470ustar00rootroot00000000000000.. _building_msgs_1: Building messages, services or actions -------------------------------------- package.xml ::::::::::: Your ``package.xml`` must declare a ```` on ``message_generation``, and a ```` on ``message_runtime``:: message_generation message_runtime Your messages services, or actions will probably include fields defined in other ROS messages, like std_msgs_. Declare them like this:: std_msgs std_msgs Both ```` and ```` are recommended for message dependencies. That example assumes ``std_msgs`` is the only dependency. Be sure to mention all your message package dependencies here, and substitute them all for ``std_msgs`` in the examples that follow. To generate actions, add ``actionlib_msgs`` as a dependency:: actionlib_msgs actionlib_msgs CMakeLists.txt :::::::::::::: For CMake, find the catkin packages for ``message_generation`` and any messages, services or actions you depend on:: find_package(catkin REQUIRED COMPONENTS message_generation std_msgs) For building actions, include ``actionlib_msgs`` among the dependencies:: find_package(catkin REQUIRED COMPONENTS actionlib_msgs message_generation std_msgs) Next, list your message definitions:: add_message_files(DIRECTORY msg FILES YourFirstMessage.msg YourSecondMessage.msg YourThirdMessage.msg) Similarly, if you have a service to generate:: add_service_files(DIRECTORY srv FILES YourService.srv) To generate actions, add:: add_action_files(DIRECTORY action FILES YourStartAction.action YourStopAction.action) Then, generate all your message, service and action targets with this command:: generate_messages(DEPENDENCIES std_msgs) Make sure the ``catkin_package()`` command declares your message, service and action dependencies for other packages:: catkin_package(CATKIN_DEPENDS message_runtime std_msgs) A good ROS practice is to collect related messages, services and actions into a separate package with no other API. That simplifies the package dependency graph. However, you *can* provide scripts and programs with the message package. If you do, message generation targets need to be built before any programs that depend on them. Every target that directly or indirectly uses one of your message headers must declare an explicit dependency:: add_dependencies(your_program ${your_package_EXPORTED_TARGETS}) If your build target also uses message or service headers imported from other catkin packages, declare those dependencies similarly:: add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) Since catkin installs message, service and action targets automatically, no extra ``install()`` commands are needed for them. .. _std_msgs: http://www.ros.org/wiki/std_msgs catkin-0.8.0/doc/howto/format1/catkin_library_dependencies.rst000066400000000000000000000066721361264727400245320ustar00rootroot00000000000000.. _catkin_library_dependencies_1: C++ catkin library dependencies ------------------------------- Catkin libraries are provided by ROS packages whether you install them from Ubuntu packages or build from source. When your package depends on a catkin C++ library, there are usually several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files. package.xml ::::::::::: Your package dependencies are declared in ``package.xml``. If they are missing or incorrect, you may be able to build from source and run tests in your own workspace, but your package will not work correctly when released to the ROS community. Others rely on this information to install the software they need for using your package. The ```` declares packages needed for building your programs, including development files like headers, libraries and configuration files. For each build dependency, specify the ROS package name:: roscpp The ```` declares two different types of package dependencies. One is for shared libraries, executables, Python modules, launch scripts and other files required for running your package. The second is for transitive build dependencies. A common example is when one of your dependencies provides a header file included in some header exported from your package. Even if your package does not use that header when building itself, other packages depending on your header *will* require those transitive dependencies when they are built. In either case, declare the dependency this way:: roscpp Most existing ROS packages combine their build and run-time files within a single package. CMakeLists.txt :::::::::::::: CMake does not know about ``package.xml`` dependencies, although catkin does. For your code to compile, the ``CMakeLists.txt`` must explicitly declare how to resolve all of your header and library references. Finding the library ''''''''''''''''''' First, CMake needs to find the library. For catkin dependencies, this is easy:: find_package(catkin REQUIRED COMPONENTS roscpp) This ``find_package()`` call defines CMake variables that will be needed later for the compile and linkedit steps. List all additional catkin dependencies in the same command:: find_package(catkin REQUIRED COMPONENTS roscpp std_msgs tf) Include directories ''''''''''''''''''' Before compiling, collect all the header paths you found earlier:: include_directories(include ${catkin_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers used to compile your programs. Exporting interfaces '''''''''''''''''''' You must declare the library and header packages needed by all the interfaces you export to other ROS packages:: catkin_package(CATKIN_DEPENDS roscpp std_msgs tf) The ``catkin_package()`` command is only called once. It may need additional parameters, depending on what else your package exports. Next steps :::::::::: If your package also depends on non-catkin libraries provided by the operating system, you must provide :ref:`system_library_dependencies_1`, too. Then, you are ready for :ref:`building_libraries_1` and :ref:`building_executables_1`. .. _`contributing the missing rules`: http://ros.org/doc/independent/api/rosdep/html/contributing_rules.html .. _pkg-config: http://www.freedesktop.org/wiki/Software/pkg-config/ .. _rosdep: http://www.ros.org/wiki/rosdep catkin-0.8.0/doc/howto/format1/catkin_overview.rst000066400000000000000000000101221361264727400222070ustar00rootroot00000000000000.. _catkin_overview_1: Catkin configuration overview ----------------------------- ROS and other packages may be configured and built using catkin. Every catkin package must include ``package.xml`` and ``CMakeLists.txt`` files in its top-level directory. package.xml ::::::::::: Your package must contain an XML file named package.xml_, as specified by REP-0127_. These components are all required:: your_package 1.2.4 This package adds extra features to rosawesome. Your Name BSD catkin Substitute your name, e-mail and the actual name of your package, and please write a better description. The maintainer is who releases the package, not necessarily the original author. You should generally add one or more ```` tags, giving appropriate credit:: Dennis Richey Ken Thompson Also, please provide some URL tags to help users find documentation and report problems:: http://ros.org/wiki/camera1394 https://github.com/ros-drivers/camera1394.git https://github.com/ros-drivers/camera1394/issues Metapackages :::::::::::: These are special-purpose catkin packages for grouping other packages. Users who install a metapackage binary will also get all packages directly or indirectly included in that group. Metapackages must not install any code or other files, the ``package.xml`` gets installed automatically. They can depend on other metapackages, if desired, but regular catkin packages may not. Metapackages can be used to resolve stack_ dependencies declared by legacy rosbuild_ packages not yet converted to catkin. Catkin packages should depend directly on the packages they use, not on any metapackages. A good use for metapackages is to group the major components of your robot and then provide a comprehensive grouping for your whole system. In addition to the XML elements mentioned above, a metapackage ``package.xml`` must contain this:: In addition to the required ```` for catkin, metapackages list the packages in the group using ```` tags:: your_custom_msgs your_server_node your_utils Metapackages must not include any other ``package.xml`` elements. But, a ``CMakeLists.txt`` is required, as shown below. CMakeLists.txt :::::::::::::: Catkin ``CMakeLists.txt`` files mostly contain ordinary CMake commands, plus a few catkin-specific ones. They begin like this:: cmake_minimum_required(VERSION 3.0.2) project(your_package) Substitute the actual name of your package in the ``project()`` command. Metapackage ``CMakeLists.txt`` files should contain only these two additional lines:: find_package(catkin REQUIRED) catkin_metapackage() Regular catkin packages generally provide additional information for dependencies, building targets, installing files and running tests. They are *required* to use these two commands, usually with additional arguments:: find_package(catkin REQUIRED COMPONENTS ...) ... catkin_package(...) :ref:`how_to_do_common_tasks_1` pages describe those tasks in detail. As you follow them, observe the usual command order: #. ``cmake_minimum_required()`` #. ``project()`` #. ``find_package()`` #. ``add_message_files()``, ``add_service_files()``, ``add_action_files()``, all catkin-specific #. ``generate_messages()``, catkin-specific #. ``catkin_package()``, catkin-specific #. ``add_library()``, ``add_executable()``, ``target_link_libraries()`` #. ``install()`` #. ``catkin_add_gtest()``, ``catkin_add_nosetests()``, ``add_rostest()``, ``add_rostest_gtest()``, all catkin-specific .. _package.xml: http://wiki.ros.org/catkin/package.xml .. _REP-0127: http://ros.org/reps/rep-0127.html .. _rosbuild: http://wiki.ros.org/rosbuild .. _stack: http://wiki.ros.org/Stacks catkin-0.8.0/doc/howto/format1/cpp_msg_dependencies.rst000066400000000000000000000027401361264727400231550ustar00rootroot00000000000000.. _cpp_msg_dependencies_1: C++ message or service dependencies ----------------------------------- When your C++ programs depend on ROS messages or services, they must be defined by catkin packages like std_msgs_ and sensor_msgs_, which are used in the examples below. There are several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files to resolve message references. package.xml ::::::::::: For each C++ message dependency, ``package.xml`` should provide both ```` and ```` tags with the ROS package name:: std_msgs std_msgs sensor_msgs sensor_msgs CMakeLists.txt :::::::::::::: For C++ access to ROS messages, CMake needs to find the message or service headers:: find_package(catkin REQUIRED COMPONENTS std_msgs sensor_msgs) include_directories(include ${catkin_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers also needed to compile your programs. Since you presumably have build targets using the message or service headers, add this to ensure all their headers get built before any targets that need them:: add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) add_dependencies(your_library ${catkin_EXPORTED_TARGETS}) .. _sensor_msgs: http://www.ros.org/wiki/sensor_msgs .. _std_msgs: http://www.ros.org/wiki/std_msgs catkin-0.8.0/doc/howto/format1/downloading_test_data.rst000066400000000000000000000043661361264727400233620ustar00rootroot00000000000000.. _downloading_test_data: Downloading test data --------------------- When unit tests require large data files, it is better to download them from the web than include them in your source repository. This should only happen in a conditional block when testing is enabled. Each of these files declares a target name. Running ``"make tests"`` or ``"make run_tests"`` will automatically download them all. Individual test targets do *not* depend on the ``tests`` target, but you can use it to download them before running one:: $ make tests run_tests_your_package Catkin provides a convenient command, used like this:: if (CATKIN_ENABLE_TESTING) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap MD5 e41d02aac34f0967c03a5597e1d554a9) endif() The first parameter is the target name, which should normally include your project name to avoid conflicts with other packages. The second parameter is the URL to read. If you release your package to the ROS build farm, make sure this URL is available reliably. Otherwise, tests will fail randomly, annoying everyone. Contact ``ros-release@lists.ros.org`` if you need to host some data near the build servers. The MD5 argument is a good way to avoid testing with corrupted data. The default destination for the file downloaded above is within your package's build directory. The file name is the base name of the URL. You can use the DESTINATION argument to put it somewhere else. For example, sometimes a rostest_ script wants to use ``$(find your_package)`` to access the test data. Here is how to put the file in devel-space, where roslaunch_ can resolve it:: if (CATKIN_ENABLE_TESTING) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests MD5 e41d02aac34f0967c03a5597e1d554a9) endif() Then, the test script can pass it as a parameter, like this:: .. _roslaunch: http://ros.org/wiki/roslaunch/XML#substitution_args .. _rostest: http://ros.org/wiki/rostest catkin-0.8.0/doc/howto/format1/dynamic_reconfiguration.rst000066400000000000000000000036021361264727400237170ustar00rootroot00000000000000.. _dynamic_reconfiguration_1: Dynamic reconfiguration ----------------------- Configure script :::::::::::::::: Dynamic reconfiguration requires you to provide one or more simple Python scripts that declare the names, types, values, and ranges of the parameters you wish to configure dynamically. See the tutorials_ for details. Catkin configure scripts differ from the earlier rosbuild interface. First, remove any reference to roslib_, which is not needed with catkin:: import roslib; roslib.load_manifest(PACKAGE) Then, be sure to use the catkin version of the parameter generator:: from dynamic_reconfigure.parameter_generator_catkin import * The remainder of your scripts need not change. package.xml ::::::::::: You need to declare both build and run-time dependencies on dynamic_reconfigure_:: dynamic_reconfigure dynamic_reconfigure CMakeLists.txt :::::::::::::: Be sure to include dynamic_reconfigure_ among your catkin package components:: find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure ...) Generate the reconfigure options, listing all your node's ``.cfg`` scripts:: generate_dynamic_reconfigure_options(cfg/YourNode.cfg) If this is a C++ package and you have build targets using the generated header, add this to ensure it gets built before any targets needing them (this prevents "file not found" errors when trying to ``#include`` the generated header):: add_dependencies(your_program ${your_package_EXPORTED_TARGETS}) add_dependencies(your_library ${your_package_EXPORTED_TARGETS}) Finally, include dynamic_reconfigure_ in the CATKIN_DEPENDS exports list for your package:: catkin_package(CATKIN_DEPENDS dynamic_reconfigure ...) .. _dynamic_reconfigure: http://ros.org/wiki/dynamic_reconfigure .. _roslib: http://ros.org/wiki/roslib .. _tutorials: http://ros.org/wiki/dynamic_reconfigure/Tutorials catkin-0.8.0/doc/howto/format1/gtest_configuration.rst000066400000000000000000000014331361264727400230720ustar00rootroot00000000000000.. _gtest_configuration: Configuring gtest for C++ ------------------------- Gtest_ is the Google framework for running C++ unit tests. It is a pure C++ framework. No ROS environment is available. See: :ref:`rostest_configuration` if your tests need a running roscore_. CMakeLists.txt :::::::::::::: Declare each gtest like this:: if (CATKIN_ENABLE_TESTING) catkin_add_gtest(test_your_node tests/test_your_node.cpp) target_link_libraries(test_your_node ${catkin_LIBRARIES}) endif() This example assumes your tests are defined in the ``tests/`` subdirectory in your source tree. If other libraries are needed to compile your test program, see :ref:`building_executables_1` for details. .. _Gtest: http://www.ros.org/wiki/gtest .. _roscore: http://www.ros.org/wiki/roscore catkin-0.8.0/doc/howto/format1/index.rst000066400000000000000000000040151361264727400201230ustar00rootroot00000000000000.. _how_to_do_common_tasks_1: Package format 1 (legacy) ========================= When writing a ROS package several tasks often need to be done. These pages give examples of how to handle most of the common ones. .. note:: These instructions are for the original ````. If you are making small changes to a format 1 package, use these instructions. If you are ready to upgrade your package to format 2, see: :ref:`migrating_from_format1_to_format2`. Overview -------- .. toctree:: :maxdepth: 1 catkin_overview Resolving dependencies ---------------------- Packages almost always use features provided by other packages. Describe all your direct dependencies. Their transitive dependencies on other packages are handled automatically by catkin. .. toctree:: :maxdepth: 1 catkin_library_dependencies system_library_dependencies cpp_msg_dependencies python_module_dependencies Building and installing targets ------------------------------- *Build targets* are generated binaries, shared libraries, message headers, and other objects. Various targets require special handling. .. toctree:: :maxdepth: 1 building_executables building_libraries building_msgs dynamic_reconfiguration installing_python installing_cmake installing_other Configuring and running unit tests ---------------------------------- All configuration steps related to testing should be only done conditionally if ``CATKIN_ENABLE_TESTING`` is set (which is true by default). Passing ``-DCATKIN_ENABLE_TESTING=0`` to CMake enables to configure and build packages without any testing overhead. If the CMake configuration of packages fails because they use test functions without checking this flag before the option ``-DCATKIN_SKIP_TESTING=1`` can be passed to CMake to disable testing but providing mock functions in order to not break the build. .. toctree:: :maxdepth: 1 downloading_test_data gtest_configuration python_nose_configuration rostest_configuration run_tests catkin-0.8.0/doc/howto/format1/installing_cmake.rst000066400000000000000000000023071361264727400223220ustar00rootroot00000000000000.. _installing_cmake_1: Installing CMake files ---------------------- Sometimes your package needs to install CMake files for use by other packages. For that to work, your ``catkin_package()`` command must include a ``CFG_EXTRAS`` parameter, where you list the CMake files you want to export:: catkin_package(CFG_EXTRAS your_macros.cmake your_modules.cmake) When another package uses ``find_package()`` on this package, the listed CMake files are automatically included. Since these data are platform-independent, they should be installed in your package's **share/** subtree. This example assumes your CMake sources are in the customary **cmake/** subdirectory:: install(FILES cmake/your_macros.cmake cmake/your_modules.cmake DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake) To install everything in your **cmake/** subdirectory:: install(DIRECTORY cmake DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} PATTERN ".svn" EXCLUDE) The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ repository. For other types of repositories, it can be omitted. .. _`roslaunch scripts`: http://ros.org/wiki/roslaunch/XML .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format1/installing_other.rst000066400000000000000000000014751361264727400223700ustar00rootroot00000000000000.. _installing_other_1: Installing other files ---------------------- Sometimes your package needs to install additional files, like `roslaunch scripts`_ or parameter settings. In most cases these data are platform-independent, so install them within your package's share directory:: install(FILES your_data your_parameters DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) This example installs everything in your **launch/** subdirectory:: install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch PATTERN ".svn" EXCLUDE) The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ repository. For other types of repositories, it can be omitted. .. _`roslaunch scripts`: http://ros.org/wiki/roslaunch/XML .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format1/installing_python.rst000066400000000000000000000067631361264727400225750ustar00rootroot00000000000000.. _installing_python_1: Installing Python scripts and modules ------------------------------------- Even if ``your_package`` only contains Python code, it still needs a catkin ``CMakeLists.txt`` to install executable scripts and to export modules so they can be imported in other ROS packages. Scripts ::::::: ROS executables are installed in a per-package directory, not the distributions's global ``bin/`` directory. They are accessible to rosrun_ and roslaunch_, without cluttering up the shell's ``$PATH``, and their names only need to be unique within each package. There are only a few core ROS commands like ``rosrun`` and ``roslaunch`` that install in the global ``bin/`` directory. Standard ROS practice is to place all executable Python programs in a package subdirectory named ``nodes/`` or ``scripts/``. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts. To keep the user API clean, executable script names generally do not include a ``.py`` suffix. Your ``CMakeLists.txt`` should install all the scripts explictly using the special install function ``catkin_install_python``. This will make sure that shebang lines are updated to use the specific Python version used at configure time:: catkin_install_python(PROGRAMS nodes/your_node scripts/another_script DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) Another good practice is to keep executable scripts very short, placing most of the code in a module which the script imports and then invokes:: #! /usr/bin/env python import your_package.main if __name__ == '__main__': your_package.main() Modules ::::::: Standard ROS practice is to place Python modules under the ``src/your_package`` subdirectory, making the top-level module name the same as your package. Python requires that directory to have an ``__init__.py`` file, too. .. note:: With rosbuild, it was possible to place Python modules directly within ``src/``. That violated Python setup conventions, and catkin does not allow it. If you need to define a module named ``your_package``, place its code in ``src/your_package/__init__.py`` or import its public symbols there. Catkin installs Python packages using a variant of the standard Python ``setup.py`` script. Assuming your modules use the standard ROS layout, it looks like this:: ## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD from setuptools import setup from catkin_pkg.python_setup import generate_distutils_setup # fetch values from package.xml setup_args = generate_distutils_setup( packages=['your_package'], package_dir={'': 'src'}) setup(**setup_args) Note: As in `setuptools `_, the ``packages`` list is not recursive, and sub-packages must be included explicitly (e.g. ``your_package.tools.my_util`` which would contain the python modules defined in the folder ``src/your_package/tools/my_util/``, along with an ``__init__.py`` file). This ``setup.py`` is only for use with catkin. Remember *not* to invoke it yourself. Put that script in the top directory of your package, and add this to your ``CMakeLists.txt``:: catkin_python_setup() That takes care of installing your Python modules. Never use it to install executable scripts. Use the ``catkin_install_python()`` command shown above. .. _roslaunch: http://wiki.ros.org/roslaunch .. _rosrun: http://wiki.ros.org/rosrun .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format1/python_module_dependencies.rst000066400000000000000000000035721361264727400244170ustar00rootroot00000000000000.. _python_module_dependencies_1: Python module dependencies -------------------------- When your Python package imports other python modules, ``package.xml`` should provide a ```` with the appropriate package name. For system dependencies, like ``python-numpy`` or ``python-yaml``, use the corresponding rosdep name:: python-numpy python-yaml These names are usually already defined in the `rosdistro repository`_. If you need a module not yet defined there, please `fork that repository and add them`_. Several ROS infrastructure modules, like ``python-rospkg`` or ``python-rosdep`` itself, apply to multiple ROS releases and are released independently of them. Resolve those module dependencies like other system packages, using the rosdep name:: python-rosdep python-rospkg When you import from another ROS Python package, like ``rospy`` or ``roslaunch``, always use the catkin package name:: roslaunch rospy ROS message or service definitions are similarly defined as modules by ROS packages like std_msgs_ and sensor_msgs_, used as examples here. For them, use both ```` and ```` tags with the ROS package name:: std_msgs std_msgs sensor_msgs sensor_msgs Your ``CMakeLists.txt`` need not specify Python-only dependencies. They are resolved automatically via ``sys.path``. .. _`fork that repository and add them`: http://ros.org/doc/independent/api/rosdep/html/contributing_rules.html .. _`rosdistro repository`: https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml .. _sensor_msgs: http://www.ros.org/wiki/sensor_msgs .. _std_msgs: http://www.ros.org/wiki/std_msgs catkin-0.8.0/doc/howto/format1/python_nose_configuration.rst000066400000000000000000000025021361264727400243070ustar00rootroot00000000000000.. _python_nose_configuration: Configuring Python nose tests ----------------------------- Nosetest_ is the framework for running Python unit tests. No ROS environment is available. See: :ref:`rostest_configuration` if your tests need a running roscore_. CMakeLists.txt :::::::::::::: Declare each nose test like this:: if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(test/test_your_node.py) endif() This example assumes your tests are defined in the ``test/`` subdirectory in your source tree. You can also let nosetest find all tests recursively:: if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(test) endif() If you used a message of the current package in the nosetest, make sure to specify the nosetest like this:: catkin_add_nosetests(test/test_your_node.py DEPENDENCIES ${${PROJECT_NAME}_EXPORTED_TARGETS}) If you used messages from other packages, use:: catkin_add_nosetests(test/test_your_node.py DEPENDENCIES ${catkin_EXPORTED_TARGETS}) The test will then make sure that the messages used in the test are built before they are used. For more info, please have a look at the :ref:`API `. .. _Nosetest: http://www.ros.org/wiki/nosetest .. _roscore: http://www.ros.org/wiki/roscore .. _unittest: http://www.ros.org/wiki/unittest catkin-0.8.0/doc/howto/format1/rostest_configuration.rst000066400000000000000000000043401361264727400234470ustar00rootroot00000000000000.. _rostest_configuration: Configuring rostest ------------------- Rostest_ is needed whenever unit tests require a roscore_ for running ROS nodes. package.xml ::::::::::: The ``rostest`` package is needed at build time, because it defines the ``add_rostest()`` CMake command:: rostest Do not declare a ````, because it will conflict with the required ````. CMakeLists.txt :::::::::::::: You must also include ``rostest`` in your ``find_package()`` components. Since these dependencies are for tests only you should find them in a second invocation inside a conditional block:: if (CATKIN_ENABLE_TESTING) find_package(catkin REQUIRED COMPONENTS rostest ...) endif() Finally, declare your rostest launch scripts:: if (CATKIN_ENABLE_TESTING) add_rostest(tests/your_first_rostest.test) add_rostest(tests/your_second_rostest.test) endif() In case you have a test that accepts arguments, you can pass them like this:: add_rostest(tests/your_rostest.test ARGS arg1:=true arg2:=false) If your rostest needs extra data in order to run, you can use the ``catkin_download_test_data()`` to download the data. Read more about :ref:`downloading_test_data_2`. Then you can add a dependency between the rostest target and the target from ``catkin_download_test_data()``, in order to download the data before the rostest runs:: if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap MD5 e41d02aac34f0967c03a5597e1d554a9) add_rostest(tests/your_rostest.test DEPENDENCIES ${PROJECT_NAME}_32e.pcap) endif() If your rostest should contain a gtest executable you can use the following convenient function:: if (CATKIN_ENABLE_TESTING) add_rostest_gtest(your_third_rostest_target tests/your_third_rostest.test src/test/your_third_rostest.cpp [more cpp files]) target_link_libraries(your_third_rostest_target [libraries to depend on, e.g. ${catkin_LIBRARIES}]) endif() For more information how to write and run rostests please go to the Rostest_ wiki page. .. _roscore: http://www.ros.org/wiki/roscore .. _Rostest: http://ros.org/wiki/rostest catkin-0.8.0/doc/howto/format1/run_tests.rst000066400000000000000000000022761361264727400210510ustar00rootroot00000000000000.. _run_tests: Running unit tests ------------------ All unit tests can be run by invoking the ``run_tests`` target:: catkin_make run_tests It will make sure that the ``tests`` target which builds all unit tests is invoked before. Individual test targets ::::::::::::::::::::::: Besides the global ``run_tests`` target each individual `gtest` / `nosetest` / `rostest` can be triggered via its own target, e.g.:: catkin_make run_tests_packagename_gtest_mytest The list of available test targets can be explored by using the target completion of catkin_make:: catkin_make run_tests Using these target it is also possible to run all unit tests of a package or all tests from a package of a specific type:: catkin_make run_tests_packagename catkin_make run_tests_packagename_gtest Summary of unit test results :::::::::::::::::::::::::::: After running unit tests the results are by default placed into the ``test_results`` folder which is located inside the build folder. Each unit test will generate a JUnit XML result file. To get a summary of the unit test results as well as references to which tests contain errors or failed invoke:: catkin_test_results build/test_results catkin-0.8.0/doc/howto/format1/system_library_dependencies.rst000066400000000000000000000142561361264727400246020ustar00rootroot00000000000000.. _system_library_dependencies_1: C++ system library dependencies ------------------------------- System libraries are part of your operating system distribution. When your package depends on a system C++ library, there are usually several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files. package.xml ::::::::::: Your system package dependencies are declared in ``package.xml``. If they are missing or incorrect, you may be able to build from source and run tests on your own machine, but your package will not work correctly when released to the ROS community. Others depend on this information to install the software they need for using your package. The ```` declares packages needed for building your programs, including development files like headers, libraries and configuration files. For each build dependency, specify the corresponding rosdep_ key. On many Linux distributions these are called "development" packages, and their names generally end in ``-dev`` or ``-devel``, like this:: libgstreamer0.10-dev The ```` declares two different types of package dependencies. One is for shared libraries, executables, Python modules, launch scripts and other files required for running your package. Specify the run-time rosdep key, if possible, like this example:: libgstreamer0.10-0 The second type of ```` is for transitive build dependencies. A common example is when one of your dependencies provides a header file included in some header exported from your package. Even if your package does not use that header when building itself, other packages depending on your header *will* require those transitive dependencies when they are built. Transitive dependencies typically name the "development" package, instead of the run-time package:: libgstreamer0.10-dev Many existing rosdep entries only name the library's "development" package. If no appropriate run-time package key is defined, consider `contributing the missing rules`_ so users need not install unnecessary files. If you cannot provide a run-time rosdep for some reason, you may need to use the "development" package for all dependency declarations:: curl curl Some C++ packages, like Eigen, have no run-time library. Everything is defined in the header files. As long as you do not export any headers including them, those files are only needed at compile time. So, you need not specify a ```` in that case:: eigen If you *do* export headers that include Eigen headers, you also need to declare that transitive dependency:: eigen CMakeLists.txt :::::::::::::: CMake does not know about ``package.xml`` dependencies. For your code to compile, the ``CMakeLists.txt`` must explicitly declare how to resolve all of your header and library references. Finding the library ''''''''''''''''''' First, CMake needs to find the library. If you are lucky, someone has already provided a *CMake module* as was done for boost. Most boost C++ components are fully implemented in the header files. They do not require a separate shared library at run-time:: find_package(Boost REQUIRED) But, the boost thread impementation *does* require a library, so specify "COMPONENTS thread" if you need it:: find_package(Boost REQUIRED COMPONENTS thread) These ``find_package()`` calls define CMake variables that will be needed later for the compile and linkedit steps. While the CMake community recommends standard names for those variables, some packages may not follow their recommendations. If you run across a case like that and can't figure out what to do, get help on `answers.ros.org`_. Sometimes, no CMake module is available, but the library's development package provides a pkg-config_ file. To use that, first load the CMake ``PkgConfig`` module, then access the build flags provided by the library:: find_package(PkgConfig REQUIRED) pkg_check_modules(GSTREAMER REQUIRED libgstreamer-0.10) The first ``pkg_check_modules()`` parameter declares a prefix for CMake variables like ``GSTREAMER_INCLUDE_DIRS`` and ``GSTREAMER_LIBRARIES``, later used for the compile and linkedit. The ``REQUIRED`` argument causes configuration to fail unless the following "module" is the base name of a pkg-config file provided by the library, in this example ``libgstreamer-0.10.pc``. Include directories ''''''''''''''''''' Before compiling, collect all the header paths you found earlier using ``find_package()`` or ``pkg_check_modules()``:: include_directories(include ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers used to compile your programs. If your package also depends on other catkin packages, add ``${catkin_INCLUDE_DIRS}`` to the list. Exporting interfaces '''''''''''''''''''' The ``catkin_package()`` command is only called once. In addition to any other parameters, it must declare the non-catkin system library and header packages needed by the interfaces you export to other ROS packages:: catkin_package(DEPENDS Boost GSTREAMER) For this to work, you must have found those dependencies earlier, using ``find_package()`` or ``pkg_check_modules()``, and they must define the CMake variables ``${name}_INCLUDE_DIRS`` and ``${name}_LIBRARIES``. Note that the package name is case sensitive. While catkin packages always use a lowercase name other packages might use uppercase (as ``GSTREAMER``) or mixed case (as ``Boost``). Some packages only provide variables which do not comply with these recommendations. Then you have to pass the absolute paths explicitly as `INCLUDE_DIRS`` and ``LIBRARIES``. Next steps :::::::::: At this point, you are ready for :ref:`building_libraries_1` and :ref:`building_executables_1`. .. _`answers.ros.org`: http://answers.ros.org .. _`contributing the missing rules`: http://ros.org/doc/independent/api/rosdep/html/contributing_rules.html .. _pkg-config: http://www.freedesktop.org/wiki/Software/pkg-config/ .. _rosdep: http://www.ros.org/wiki/rosdep catkin-0.8.0/doc/howto/format2/000077500000000000000000000000001361264727400162635ustar00rootroot00000000000000catkin-0.8.0/doc/howto/format2/building_executables.rst000066400000000000000000000050761361264727400232060ustar00rootroot00000000000000.. _building_executables_2: Building and installing C++ executables --------------------------------------- For this example, suppose you have an executable build target named ``your_node``. Headers ::::::: Before compiling, collect all the header paths for your build dependencies:: include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) These parameters are just examples. The ``include`` parameter is needed only if that subdirectory of your source package contains headers used to compile your programs. All your catkin package header dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. Other :ref:`how-to pages ` describe how to resolve header dependencies in more detail. Building :::::::: To build ``your_node``, add this command to your ``CMakeLists.txt``, listing all required C++ source files, but not the headers:: add_executable(your_node src1.cpp src2.cpp src_etc.cpp) If the list of files is long, a CMake variable can help:: set(${PROJECT_NAME}_SOURCES src/file1.cpp src/file2.cpp src/file3.cpp src/file4.cpp src/file5.cpp src/file6.cpp src/file_etc.cpp) add_executable(your_node ${${PROJECT_NAME}_SOURCES}) If your program depends on libraries provided by other catkin packages, add this:: add_executable(your_node ${${PROJECT_NAME}_SOURCES}) target_link_libraries(your_node ${catkin_LIBRARIES}) If your program depends on additional non-catkin system libraries, include them in the ``target_link_libraries()``:: add_executable(your_node ${${PROJECT_NAME}_SOURCES}) target_link_libraries(your_node ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${GSTREAMER_LIBRARIES}) If the list of libraries is lengthy, you can similarly define a CMake variable for them. Installing :::::::::: ROS executables are installed in a per-package directory, not the distributions's global ``bin/`` directory. There, they are accessible to rosrun_ and roslaunch_, without cluttering up the shell's ``$PATH``, and their names only need to be unique within each package. There are only a few core ROS commands like ``rosrun`` and ``roslaunch`` that install in the global ``bin/`` directory. List all your executables as TARGETS on an install command like this:: install(TARGETS your_node RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) .. _roslaunch: http://wiki.ros.org/roslaunch .. _rosrun: http://wiki.ros.org/rosrun catkin-0.8.0/doc/howto/format2/building_libraries.rst000066400000000000000000000103171361264727400226500ustar00rootroot00000000000000.. _building_libraries_2: Building and installing C++ libraries and headers ------------------------------------------------- In catkin, libraries will be installed in a common directory shared by all the packages in that entire ROS distribution. So, make sure your library names are sufficiently unique not to clash with other packages or system libraries. It makes sense to include at least part of your package name in each library target name. For this example, suppose ``your_package`` has a shared library build target named ``your_library``. On Linux, the actual file name will be something like ``libyour_library.so``, perhaps with a version number suffix. Headers ::::::: Before compiling, collect all the header paths for your build dependencies:: include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) That only needs to be done once in your ``CMakeLists.txt``. These parameters are just examples. The ``include`` parameter is needed only if that subdirectory of your source package contains headers used to compile your programs. All your catkin package header dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. Other :ref:`how-to pages ` describe how to resolve header dependencies in more detail. Building :::::::: To build your library add this command to your ``CMakeLists.txt``, listing all required C++ source files, but not the headers:: add_library(your_library libsrc1.cpp libsrc2.cpp libsrc_etc.cpp) If the list of source files is long, a CMake variable can help:: set(YOUR_LIB_SOURCES libsrc1.cpp libsrc2.cpp libsrc3.cpp libsrc4.cpp libsrc_etc.cpp) add_library(your_library ${YOUR_LIB_SOURCES}) If your library depends on libraries provided by other catkin packages, add this command:: target_link_libraries(your_library ${catkin_LIBRARIES}) If your library depends on additional non-catkin system libraries, include them in the ``target_link_libraries()``:: target_link_libraries(your_library ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${GSTREAMER_LIBRARIES}) If the list of libraries is lengthy, you can similarly define a CMake variable for them. Exporting ::::::::: Your ``catkin_package()`` needs to export all your library build targets so other catkin packages can use them. Suppose ``your_library`` depends on the ROS ``std_msgs`` package and on the system ``Boost`` thread library:: catkin_package(CATKIN_DEPENDS std_msgs DEPENDS Boost INCLUDE_DIRS include LIBRARIES your_library) Be sure to list every library on which your libraries depend, and don't forget to mention them in your ``package.xml`` using a ```` or ```` tag:: std_msgs boost Installing :::::::::: In catkin, libraries are installed in a ``lib/`` directory shared by all the packages in that entire ROS distribution. So, be careful what you name them. Add this command to your ``CMakeLists.txt``, mentioning all your library build targets:: install(TARGETS your_library your_other_library ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) The runtime destination is used for `.dll` file on Windows which must be placed in the global bin folder. Libraries typically provide headers defining their interfaces. Please follow standard ROS practice and place all external header files under ``include/your_package/``:: install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) That command installs all the files in your package's include subtree. Place only your exported headers there. If yours is a Subversion_ repository, don't forget to exclude the ``.svn`` subdirectories like this:: install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} PATTERN ".svn" EXCLUDE) .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format2/building_msgs.rst000066400000000000000000000061201361264727400216420ustar00rootroot00000000000000.. _building_msgs_2: Building messages, services or actions -------------------------------------- package.xml ::::::::::: Your ``package.xml`` must declare a ```` on ``message_generation``, and a ```` as well as ```` on ``message_runtime``:: message_generation message_runtime message_runtime Your messages services, or actions will probably include fields defined in other ROS messages, like std_msgs_. Declare them like this:: std_msgs The ```` tag is recommended for message dependencies. That example assumes ``std_msgs`` is the only dependency. Be sure to mention all your message package dependencies here, and substitute them all for ``std_msgs`` in the examples that follow. To generate actions, add ``actionlib_msgs`` as a dependency:: actionlib_msgs CMakeLists.txt :::::::::::::: For CMake, find the catkin packages for ``message_generation`` and any messages, services or actions you depend on:: find_package(catkin REQUIRED COMPONENTS message_generation std_msgs) For building actions, include ``actionlib_msgs`` among the dependencies:: find_package(catkin REQUIRED COMPONENTS actionlib_msgs message_generation std_msgs) Next, list your message definitions:: add_message_files(DIRECTORY msg FILES YourFirstMessage.msg YourSecondMessage.msg YourThirdMessage.msg) Similarly, if you have a service to generate:: add_service_files(DIRECTORY srv FILES YourService.srv) To generate actions, add:: add_action_files(DIRECTORY action FILES YourStartAction.action YourStopAction.action) Then, generate all your message, service and action targets with this command:: generate_messages(DEPENDENCIES std_msgs) Make sure the ``catkin_package()`` command declares your message, service and action dependencies for other packages:: catkin_package(CATKIN_DEPENDS message_runtime std_msgs) A good ROS practice is to collect related messages, services and actions into a separate package with no other API. That simplifies the package dependency graph. However, you *can* provide scripts and programs with the message package. If you do, message generation targets need to be built before any programs that depend on them. Every target that directly or indirectly uses one of your message headers must declare an explicit dependency:: add_dependencies(your_program ${${PROJECT_NAME}_EXPORTED_TARGETS}) If your build target also uses message or service headers imported from other catkin packages, declare those dependencies similarly:: add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) Since catkin installs message, service and action targets automatically, no extra ``install()`` commands are needed for them. .. _std_msgs: http://wiki.ros.org/std_msgs catkin-0.8.0/doc/howto/format2/catkin_library_dependencies.rst000066400000000000000000000106161361264727400245240ustar00rootroot00000000000000.. _catkin_library_dependencies_2: C++ catkin library dependencies ------------------------------- Catkin libraries are provided by ROS packages whether you install them from Ubuntu packages or build from source. When your package depends on a catkin C++ library, there are usually several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files. package.xml ::::::::::: Your package dependencies are declared in ``package.xml``. If they are missing or incorrect, you may be able to build from source and run tests in your own workspace, but your package will not work correctly when released to the ROS community. Others rely on this information to install the software they need for using your package. ```` '''''''''''' It is generally sufficient to mention each ROS package dependency once, like this:: roscpp Sometimes, you may need or want more granularity for certain dependencies. The following sections explain how to do that. If in doubt, use the ```` tag, it's simpler. ```` '''''''''''''''''' If you only use some particular dependency for building your package, and not at execution time, you can use the ```` tag. For example, the ROS angles package only provides C++ headers and CMake configuration files:: angles With this type of dependency, an installed binary of your package does not require the angles package to be installed. **But**, that could create a problem if your package exports a header that includes the ```` header. In that case you also need a ````. ```` ''''''''''''''''''''''''' If you export a header that includes ````, it will be needed by other packages that ```` on yours:: angles This mainly applies to headers and CMake configuration files. Library packages referenced by libraries you export should normally specify ````, because they are also needed at execution time. ```` ''''''''''''''''' This tag declares dependencies for shared libraries, executables, Python modules, launch scripts and other files required when running your package. For example, the ROS openni_launch package provides launch scripts, which are only needed at execution time:: openni_launch CMakeLists.txt :::::::::::::: CMake does not know about ``package.xml`` dependencies, although catkin does. For your code to compile, the ``CMakeLists.txt`` must explicitly declare how to resolve all of your header and library references. Finding the library ''''''''''''''''''' First, CMake needs to find the library. For catkin dependencies, this is easy:: find_package(catkin REQUIRED COMPONENTS roscpp) This ``find_package()`` call defines CMake variables that will be needed later for the compile and linkedit steps. List all additional catkin dependencies in the same command:: find_package(catkin REQUIRED COMPONENTS angles roscpp std_msgs) Make sure all these packages are also mentioned in your ``package.xml`` using a ```` or ```` tag. Include directories ''''''''''''''''''' Before compiling, collect all the header paths you found earlier:: include_directories(include ${catkin_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers used to compile your programs. Exporting interfaces '''''''''''''''''''' You must declare the library and header packages needed by all the interfaces you export to other ROS packages:: catkin_package(CATKIN_DEPENDS angles roscpp std_msgs) Make sure all these packages are also mentioned in your ``package.xml`` using a ```` or ```` tag. The ``catkin_package()`` command is only called once. It may need additional parameters, depending on what else your package exports. Next steps :::::::::: If your package also depends on non-catkin libraries provided by the operating system, you must provide :ref:`system_library_dependencies_2`, too. Then, you are ready for :ref:`building_libraries_2` and :ref:`building_executables_2`. .. _`contributing the missing rules`: http://docs.ros.org/independent/api/rosdep/html/contributing_rules.html .. _pkg-config: http://www.freedesktop.org/wiki/Software/pkg-config/ .. _rosdep: http://wiki.ros.org/rosdep catkin-0.8.0/doc/howto/format2/catkin_overview.rst000066400000000000000000000102041361264727400222110ustar00rootroot00000000000000.. _catkin_overview_2: Catkin configuration overview ----------------------------- ROS and other packages may be configured and built using catkin. Every catkin package must include ``package.xml`` and ``CMakeLists.txt`` files in its top-level directory. package.xml ::::::::::: Your package must contain an XML file named package.xml_, as specified by REP-0140_. These components are all required:: your_package 1.2.4 This package adds extra features to rosawesome. Your Name BSD catkin Substitute your name, e-mail and the actual name of your package, and please write a better description. The maintainer is who releases the package, not necessarily the original author. You should generally add one or more ```` tags, giving appropriate credit:: Dennis Richey Ken Thompson Also, please provide some URL tags to help users find documentation and report problems:: http://ros.org/wiki/camera1394 https://github.com/ros-drivers/camera1394.git https://github.com/ros-drivers/camera1394/issues Metapackages :::::::::::: These are special-purpose catkin packages for grouping other packages. Users who install a metapackage binary will also get all packages directly or indirectly included in that group. Metapackages must not install any code or other files, the ``package.xml`` gets installed automatically. They can depend on other metapackages, if desired, but regular catkin packages may not. Metapackages can be used to resolve stack_ dependencies declared by legacy rosbuild_ packages not yet converted to catkin. Catkin packages should depend directly on the packages they use, not on any metapackages. A good use for metapackages is to group the major components of your robot and then provide a comprehensive grouping for your whole system. In addition to the XML elements mentioned above, a metapackage ``package.xml`` must contain this:: In addition to the required ```` for catkin, metapackages list the packages in the group using ```` tags:: your_custom_msgs your_server_node your_utils Metapackages must not include any other ``package.xml`` elements. But, a ``CMakeLists.txt`` is required, as shown below. CMakeLists.txt :::::::::::::: Catkin ``CMakeLists.txt`` files mostly contain ordinary CMake commands, plus a few catkin-specific ones. They begin like this:: cmake_minimum_required(VERSION 3.0.2) project(your_package) Substitute the actual name of your package in the ``project()`` command. Metapackage ``CMakeLists.txt`` files should contain only these two additional lines:: find_package(catkin REQUIRED) catkin_metapackage() Regular catkin packages generally provide additional information for dependencies, building targets, installing files and running tests. They are *required* to use these two commands, usually with additional arguments:: find_package(catkin REQUIRED COMPONENTS ...) ... catkin_package(...) :ref:`how_to_do_common_tasks_2` pages describe those tasks in detail. As you follow them, observe the usual command order: #. ``cmake_minimum_required()`` #. ``project()`` #. ``find_package()`` #. ``add_message_files()``, ``add_service_files()``, ``add_action_files()``, all catkin-specific #. ``generate_messages()``, catkin-specific #. ``catkin_package()``, catkin-specific #. ``add_library()``, ``add_executable()``, ``target_link_libraries()`` #. ``install()`` #. ``catkin_add_gtest()``, ``catkin_add_nosetests()``, ``add_rostest()``, ``add_rostest_gtest()``, all catkin-specific .. _package.xml: http://wiki.ros.org/catkin/package.xml .. _REP-0140: http://ros.org/reps/rep-0140.html .. _rosbuild: http://wiki.ros.org/rosbuild .. _stack: http://wiki.ros.org/Stacks catkin-0.8.0/doc/howto/format2/cpp_msg_dependencies.rst000066400000000000000000000025061361264727400231560ustar00rootroot00000000000000.. _cpp_msg_dependencies_2: C++ message or service dependencies ----------------------------------- When your C++ programs depend on ROS messages or services, they must be defined by catkin packages like std_msgs_ and sensor_msgs_, which are used in the examples below. Dependencies on these packages must be declared in your ``package.xml`` and ``CMakeLists.txt`` files to resolve message references. package.xml ::::::::::: For each C++ message dependency, ``package.xml`` should provide a ```` tag with the ROS package name:: std_msgs sensor_msgs CMakeLists.txt :::::::::::::: For C++ access to ROS messages, CMake needs to find the message or service headers:: find_package(catkin REQUIRED COMPONENTS std_msgs sensor_msgs) include_directories(include ${catkin_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers also needed to compile your programs. Since you presumably have build targets using the message or service headers, add this to ensure all their headers get built before any targets that need them:: add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) add_dependencies(your_library ${catkin_EXPORTED_TARGETS}) .. _sensor_msgs: http://wiki.ros.org/sensor_msgs .. _std_msgs: http://wiki.ros.org/std_msgs catkin-0.8.0/doc/howto/format2/downloading_test_data.rst000066400000000000000000000043701361264727400233560ustar00rootroot00000000000000.. _downloading_test_data_2: Downloading test data --------------------- When unit tests require large data files, it is better to download them from the web than include them in your source repository. This should only happen in a conditional block when testing is enabled. Each of these files declares a target name. Running ``"make tests"`` or ``"make run_tests"`` will automatically download them all. Individual test targets do *not* depend on the ``tests`` target, but you can use it to download them before running one:: $ make tests run_tests_your_package Catkin provides a convenient command, used like this:: if (CATKIN_ENABLE_TESTING) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap MD5 e41d02aac34f0967c03a5597e1d554a9) endif() The first parameter is the target name, which should normally include your project name to avoid conflicts with other packages. The second parameter is the URL to read. If you release your package to the ROS build farm, make sure this URL is available reliably. Otherwise, tests will fail randomly, annoying everyone. Contact ``ros-release@lists.ros.org`` if you need to host some data near the build servers. The MD5 argument is a good way to avoid testing with corrupted data. The default destination for the file downloaded above is within your package's build directory. The file name is the base name of the URL. You can use the DESTINATION argument to put it somewhere else. For example, sometimes a rostest_ script wants to use ``$(find your_package)`` to access the test data. Here is how to put the file in devel-space, where roslaunch_ can resolve it:: if (CATKIN_ENABLE_TESTING) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests MD5 e41d02aac34f0967c03a5597e1d554a9) endif() Then, the test script can pass it as a parameter, like this:: .. _roslaunch: http://wiki.ros.org/roslaunch/XML#substitution_args .. _rostest: http://wiki.ros.org/rostest catkin-0.8.0/doc/howto/format2/dynamic_reconfiguration.rst000066400000000000000000000034571361264727400237300ustar00rootroot00000000000000.. _dynamic_reconfiguration_2: Dynamic reconfiguration ----------------------- Configure script :::::::::::::::: Dynamic reconfiguration requires you to provide one or more simple Python scripts that declare the names, types, values, and ranges of the parameters you wish to configure dynamically. See the tutorials_ for details. Catkin configure scripts differ from the earlier rosbuild interface. First, remove any reference to roslib_, which is not needed with catkin:: import roslib; roslib.load_manifest(PACKAGE) Then, be sure to use the catkin version of the parameter generator:: from dynamic_reconfigure.parameter_generator_catkin import * The remainder of your scripts need not change. package.xml ::::::::::: You need to declare your dependency on dynamic_reconfigure_:: dynamic_reconfigure CMakeLists.txt :::::::::::::: Be sure to include dynamic_reconfigure_ among your catkin package components:: find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure ...) Generate the reconfigure options, listing all your node's ``.cfg`` scripts:: generate_dynamic_reconfigure_options(cfg/YourNode.cfg) Include dynamic_reconfigure_ in the CATKIN_DEPENDS exports list for your package:: catkin_package(CATKIN_DEPENDS dynamic_reconfigure ...) If this is a C++ package and you have build targets using the generated header, add this to ensure it gets built before any targets needing them (this prevents "file not found" errors when trying to ``#include`` the generated header):: add_dependencies(your_program ${${PROJECT_NAME}_EXPORTED_TARGETS}) add_dependencies(your_library ${${PROJECT_NAME}_EXPORTED_TARGETS}) .. _dynamic_reconfigure: http://wiki.ros.org/dynamic_reconfigure .. _roslib: http://wiki.ros.org/roslib .. _tutorials: http://wiki.ros.org/dynamic_reconfigure/Tutorials catkin-0.8.0/doc/howto/format2/gtest_configuration.rst000066400000000000000000000014251361264727400230740ustar00rootroot00000000000000.. _gtest_configuration_2: Configuring gtest for C++ ------------------------- Gtest_ is the Google framework for running C++ unit tests. It is a pure C++ framework. No ROS environment is available. See: :ref:`rostest_configuration` if your tests need a running roscore_. CMakeLists.txt :::::::::::::: Declare each gtest like this:: if (CATKIN_ENABLE_TESTING) catkin_add_gtest(test_your_node tests/test_your_node.cpp) target_link_libraries(test_your_node ${catkin_LIBRARIES}) endif() This example assumes your tests are defined in the ``tests/`` subdirectory in your source tree. If other libraries are needed to compile your test program, see :ref:`building_executables_2` for details. .. _Gtest: http://wiki.ros.org/gtest .. _roscore: http://wiki.ros.org/roscore catkin-0.8.0/doc/howto/format2/index.rst000066400000000000000000000040271361264727400201270ustar00rootroot00000000000000.. _how_to_do_common_tasks_2: Package format 2 (recommended) ============================== When writing a ROS package several tasks often need to be done. These pages give examples of how to handle most of the common ones. .. note:: These instructions are for ````. If you are making small changes to a format 1 package, please use :ref:`how_to_do_common_tasks_1` instead. If you are ready to upgrade a format 1 package to format 2, see: :ref:`migrating_from_format1_to_format2`. Overview -------- .. toctree:: :maxdepth: 1 catkin_overview Resolving dependencies ---------------------- Packages almost always use features provided by other packages. Describe all your direct dependencies. Their transitive dependencies on other packages are handled automatically by catkin. .. toctree:: :maxdepth: 1 catkin_library_dependencies system_library_dependencies cpp_msg_dependencies python_module_dependencies Building and installing targets ------------------------------- *Build targets* are generated binaries, shared libraries, message headers, and other objects. Various targets require special handling. .. toctree:: :maxdepth: 1 building_executables building_libraries building_msgs dynamic_reconfiguration installing_python installing_cmake installing_other Configuring and running unit tests ---------------------------------- All configuration steps related to testing should be only done conditionally when ``CATKIN_ENABLE_TESTING`` is set, which is true by default. Passing ``-DCATKIN_ENABLE_TESTING=0`` to CMake enables configuring and building packages without any testing overhead. .. toctree:: :maxdepth: 1 downloading_test_data gtest_configuration python_nose_configuration rostest_configuration run_tests Migrating from package format 1 ------------------------------- When a format 1 package is revised, it probably makes sense to upgrade its ``package.xml`` to format 2. .. toctree:: :maxdepth: 1 migrating_from_format_1 catkin-0.8.0/doc/howto/format2/installing_cmake.rst000066400000000000000000000023071361264727400223230ustar00rootroot00000000000000.. _installing_cmake_2: Installing CMake files ---------------------- Sometimes your package needs to install CMake files for use by other packages. For that to work, your ``catkin_package()`` command must include a ``CFG_EXTRAS`` parameter, where you list the CMake files you want to export:: catkin_package(CFG_EXTRAS your_macros.cmake your_modules.cmake) When another package uses ``find_package()`` on this package, the listed CMake files are automatically included. Since these data are platform-independent, they should be installed in your package's **share/** subtree. This example assumes your CMake sources are in the customary **cmake/** subdirectory:: install(FILES cmake/your_macros.cmake cmake/your_modules.cmake DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake) To install everything in your **cmake/** subdirectory:: install(DIRECTORY cmake DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} PATTERN ".svn" EXCLUDE) The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ repository. For other types of repositories, it can be omitted. .. _`roslaunch scripts`: http://wiki.ros.org/roslaunch/XML .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format2/installing_other.rst000066400000000000000000000014751361264727400223710ustar00rootroot00000000000000.. _installing_other_2: Installing other files ---------------------- Sometimes your package needs to install additional files, like `roslaunch scripts`_ or parameter settings. In most cases these data are platform-independent, so install them within your package's share directory:: install(FILES your_data your_parameters DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) This example installs everything in your **launch/** subdirectory:: install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch PATTERN ".svn" EXCLUDE) The ``PATTERN ".svn" EXCLUDE`` is only needed if you use a Subversion_ repository. For other types of repositories, it can be omitted. .. _`roslaunch scripts`: http://wiki.ros.org/roslaunch/XML .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format2/installing_python.rst000066400000000000000000000067631361264727400225760ustar00rootroot00000000000000.. _installing_python_2: Installing Python scripts and modules ------------------------------------- Even if ``your_package`` only contains Python code, it still needs a catkin ``CMakeLists.txt`` to install executable scripts and to export modules so they can be imported in other ROS packages. Scripts ::::::: ROS executables are installed in a per-package directory, not the distributions's global ``bin/`` directory. They are accessible to rosrun_ and roslaunch_, without cluttering up the shell's ``$PATH``, and their names only need to be unique within each package. There are only a few core ROS commands like ``rosrun`` and ``roslaunch`` that install in the global ``bin/`` directory. Standard ROS practice is to place all executable Python programs in a package subdirectory named ``nodes/`` or ``scripts/``. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts. To keep the user API clean, executable script names generally do not include a ``.py`` suffix. Your ``CMakeLists.txt`` should install all the scripts explictly using the special install function ``catkin_install_python``. This will make sure that shebang lines are updated to use the specific Python version used at configure time:: catkin_install_python(PROGRAMS nodes/your_node scripts/another_script DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) Another good practice is to keep executable scripts very short, placing most of the code in a module which the script imports and then invokes:: #! /usr/bin/env python import your_package.main if __name__ == '__main__': your_package.main() Modules ::::::: Standard ROS practice is to place Python modules under the ``src/your_package`` subdirectory, making the top-level module name the same as your package. Python requires that directory to have an ``__init__.py`` file, too. .. note:: With rosbuild, it was possible to place Python modules directly within ``src/``. That violated Python setup conventions, and catkin does not allow it. If you need to define a module named ``your_package``, place its code in ``src/your_package/__init__.py`` or import its public symbols there. Catkin installs Python packages using a variant of the standard Python ``setup.py`` script. Assuming your modules use the standard ROS layout, it looks like this:: ## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD from setuptools import setup from catkin_pkg.python_setup import generate_distutils_setup # fetch values from package.xml setup_args = generate_distutils_setup( packages=['your_package'], package_dir={'': 'src'}) setup(**setup_args) Note: As in `setuptools `_, the ``packages`` list is not recursive, and sub-packages must be included explicitly (e.g. ``your_package.tools.my_util`` which would contain the python modules defined in the folder ``src/your_package/tools/my_util/``, along with an ``__init__.py`` file). This ``setup.py`` is only for use with catkin. Remember *not* to invoke it yourself. Put that script in the top directory of your package, and add this to your ``CMakeLists.txt``:: catkin_python_setup() That takes care of installing your Python modules. Never use it to install executable scripts. Use the ``catkin_install_python()`` command shown above. .. _roslaunch: http://wiki.ros.org/roslaunch .. _rosrun: http://wiki.ros.org/rosrun .. _Subversion: http://subversion.apache.org/ catkin-0.8.0/doc/howto/format2/migrating_from_format_1.rst000066400000000000000000000051461361264727400236170ustar00rootroot00000000000000.. _migrating_from_format1_to_format2: Migrating from format 1 to format 2 =================================== The differences between format 1 and format 2 only affect the ``package.xml`` with its dependencies. REP-0140_ defines these differences and provides their rationale. ```` ::::::::::::: The ```` tag determines which format to use, change it like this:: ```` :::::::::::: This is a new tag, intended to reduce unnecessary repetition. If your format 1 package contained:: foo foo It should be replaced with:: foo In format 2, that is equivalent to:: foo foo foo ```` :::::::::::::::: This tag is no longer allowed. Wherever found, it must be replaced:: foo In format 2, that is equivalent to these two new tags:: foo foo If the dependency is only used at run-time, only the ```` is needed. If it is only exported to satisfy other packages' build dependencies, use ````. If both are needed, this may be a better choice:: foo ```` ::::::::::::::::: In format 2, this tag can satisfy build dependencies, not just those needed for executing your tests. Unlike format 1, ```` may now refer to a package also declared as some other type of dependency. Some test-only dependencies that formerly required a ````, should now be expressed using ````. For example:: rostest becomes:: rostest In your ``CMakeLists.txt`` make sure your test dependencies are only referenced within the conditional test block:: if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) add_rostest(tests/your_first_rostest.test) add_rostest(tests/your_second_rostest.test) endif() ```` :::::::::::::::: This tag defines dependencies needed for building your documentation:: doxygen epydoc python-sphinx rosdoc_lite Those examples are automatically provided by the ROS build farm, but there is no harm in declaring which you actually use. They do not create binary package dependencies, unless they were also declared using some other dependency tag. .. _REP-0140: http://ros.org/reps/rep-0140.html catkin-0.8.0/doc/howto/format2/python_module_dependencies.rst000066400000000000000000000035311361264727400244130ustar00rootroot00000000000000.. _python_module_dependencies_2: Python module dependencies -------------------------- When your Python package imports other python modules, ``package.xml`` should provide a ```` with the appropriate package name. For system dependencies, like ``python-numpy`` or ``python-yaml``, use the corresponding rosdep name:: python-numpy python-yaml These names are usually already defined in the `rosdistro repository`_. If you need a module not yet defined there, please `fork that repository and add them`_. Several ROS infrastructure modules, like ``python-rospkg`` or ``python-rosdep`` itself, apply to multiple ROS releases and are released independently of them. Resolve those module dependencies like other system packages, using the rosdep name:: python-rosdep python-rospkg When you import from another ROS Python package, like ``rospy`` or ``roslaunch``, always use the catkin package name:: roslaunch rospy ROS message or service definitions are defined as modules by ROS packages like std_msgs_ and sensor_msgs_, used as examples here. Although ```` is adequate when all references are in Python, the recommended method is using a ```` tag with the message package name:: std_msgs sensor_msgs Your ``CMakeLists.txt`` need not specify Python-only dependencies. They are resolved automatically via ``sys.path``. .. _`fork that repository and add them`: http://docs.ros.org/independent/api/rosdep/html/contributing_rules.html .. _`rosdistro repository`: https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml .. _sensor_msgs: http://wiki.ros.org/sensor_msgs .. _std_msgs: http://wiki.ros.org/std_msgs catkin-0.8.0/doc/howto/format2/python_nose_configuration.rst000066400000000000000000000025041361264727400243120ustar00rootroot00000000000000.. _python_nose_configuration_2: Configuring Python nose tests ----------------------------- Nosetest_ is the framework for running Python unit tests. No ROS environment is available. See: :ref:`rostest_configuration` if your tests need a running roscore_. CMakeLists.txt :::::::::::::: Declare each nose test like this:: if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(test/test_your_node.py) endif() This example assumes your tests are defined in the ``test/`` subdirectory in your source tree. You can also let nosetest find all tests recursively:: if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(test) endif() If you used a message of the current package in the nosetest, make sure to specify the nosetest like this:: catkin_add_nosetests(test/test_your_node.py DEPENDENCIES ${${PROJECT_NAME}_EXPORTED_TARGETS}) If you used messages from other packages, use:: catkin_add_nosetests(test/test_your_node.py DEPENDENCIES ${catkin_EXPORTED_TARGETS}) The test will then make sure that the messages used in the test are built before they are used. For more info, please have a look at the :ref:`API `. .. _Nosetest: http://www.ros.org/wiki/nosetest .. _roscore: http://www.ros.org/wiki/roscore .. _unittest: http://www.ros.org/wiki/unittest catkin-0.8.0/doc/howto/format2/rostest_configuration.rst000066400000000000000000000044131361264727400234510ustar00rootroot00000000000000.. _rostest_configuration_2: Configuring rostest ------------------- Use rostest_ whenever your unit tests require a roscore_ for running ROS nodes. package.xml ::::::::::: Declare ``rostest`` as a test dependency, along with any other test-only dependencies:: rostest CMakeLists.txt :::::::::::::: You need a ``find_package()`` for ``rostest`` to define the necessary CMake commands. It is better *not* to use a second ``find_package(catkin ...)`` for test dependencies like rostest, because that would reset important catkin CMake variables, making it hard to build test programs. Place both the ``find_package()`` and your test declarations inside the conditional testing block:: if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) add_rostest(tests/your_first_rostest.test) add_rostest(tests/your_second_rostest.test) endif() In case you have a test that accepts arguments, you can pass them like this:: add_rostest(tests/your_rostest.test ARGS arg1:=true arg2:=false) If your rostest needs extra data in order to run, you can use the ``catkin_download_test_data()`` to download the data. Read more about :ref:`downloading_test_data_2`. Then you can add a dependency between the rostest target and the target from ``catkin_download_test_data()``, in order to download the data before the rostest runs:: if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) catkin_download_test_data( ${PROJECT_NAME}_32e.pcap http://download.ros.org/data/velodyne/32e.pcap MD5 e41d02aac34f0967c03a5597e1d554a9) add_rostest(tests/your_rostest.test DEPENDENCIES ${PROJECT_NAME}_32e.pcap) endif() If your rostest also uses a gtest_ executable, there is a convenience function:: if (CATKIN_ENABLE_TESTING) add_rostest_gtest(your_gtest_node tests/your_third_rostest.test tests/your_gtest_node.cpp) target_link_libraries(your_gtest_node ${catkin_LIBRARIES}) endif() Any additional library dependencies would be added to the ``target_link_libraries()``, as usual. For more details on writing and running rostests, see the rostest_ documentation. .. _gtest: http://wiki.ros.org/gtest .. _roscore: http://wiki.ros.org/roscore .. _rostest: http://wiki.ros.org/rostest catkin-0.8.0/doc/howto/format2/run_tests.rst000066400000000000000000000023001361264727400210360ustar00rootroot00000000000000.. _run_tests_2: Running unit tests ------------------ All unit tests can be run by invoking the ``run_tests`` target:: catkin_make run_tests It will make sure that the ``tests`` target which builds all unit tests is invoked before. Individual test targets ::::::::::::::::::::::: Besides the global ``run_tests`` target each individual `gtest` / `nosetest` / `rostest` can be triggered via its own target, e.g.:: catkin_make run_tests_packagename_gtest_mytest The list of available test targets can be explored by using the target completion of catkin_make:: catkin_make run_tests Using these target it is also possible to run all unit tests of a package or all tests from a package of a specific type:: catkin_make run_tests_packagename catkin_make run_tests_packagename_gtest Summary of unit test results :::::::::::::::::::::::::::: After running unit tests the results are by default placed into the ``test_results`` folder which is located inside the build folder. Each unit test will generate a JUnit XML result file. To get a summary of the unit test results as well as references to which tests contain errors or failed invoke:: catkin_test_results build/test_results catkin-0.8.0/doc/howto/format2/system_library_dependencies.rst000066400000000000000000000143511361264727400245770ustar00rootroot00000000000000.. _system_library_dependencies_2: C++ system library dependencies ------------------------------- System libraries are part of your operating system distribution. When your package depends on a system C++ library, there are usually several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files. package.xml ::::::::::: Your system package dependencies are declared in ``package.xml``. If they are missing or incorrect, you may be able to build from source and run tests on your own machine, but your package will not work correctly when released to the ROS community. Others depend on this information to install the software they need for using your package. ```` '''''''''''''''''' This tag declares packages needed for building your programs, including development files like headers, libraries and configuration files. For each build dependency, specify the corresponding rosdep_ key. On many Linux distributions these are called "development" packages, and their names generally end in ``-dev`` or ``-devel``, like this:: libgstreamer0.10-dev Some C++ packages, like Eigen, have no run-time library, and everything is defined in the header files:: eigen ```` ''''''''''''''''''''''''' If your package exports a header that includes an Eigen header like ````, then other packages that ```` on yours will need Eigen, too. To make that work correctly, declare it like this:: eigen This type of dependency mainly applies to headers and CMake configuration files, and it typically names the "development" package:: libgstreamer0.10-dev ```` ''''''''''''''''' The ```` is for shared libraries, executables, Python modules, launch scripts and other files required for running your package. Specify the run-time rosdep key, if possible, like this:: libgstreamer0.10-0 Many existing rosdep entries only name the library's "development" package. If no appropriate run-time package key is defined, consider `contributing the missing rules`_ so users need not install unnecessary files. If you cannot provide a run-time rosdep for some reason, you can use the "development" package for the exec dependency, too. ```` '''''''''''' This tag combines all the previous types of dependencies into one. It is not recommended for system dependencies, because it forces your package's binary installation to depend on the "development" package, which is not generally necessary or desirable:: curl CMakeLists.txt :::::::::::::: CMake does not know about ``package.xml`` dependencies. For your code to compile, the ``CMakeLists.txt`` must explicitly declare how to resolve all of your header and library references. Finding the library ''''''''''''''''''' First, CMake needs to find the library. If you are lucky, someone has already provided a *CMake module* as was done for boost. Most boost C++ components are fully implemented in the header files. They do not require a separate shared library at run-time:: find_package(Boost REQUIRED) But, the boost thread impementation *does* require a library, so specify "COMPONENTS thread" if you need it:: find_package(Boost REQUIRED COMPONENTS thread) These ``find_package()`` calls define CMake variables that will be needed later for the compile and linkedit steps. While the CMake community recommends standard names for those variables, some packages may not follow their recommendations. If you run across a case like that and can't figure out what to do, get help on `answers.ros.org`_. Sometimes, no CMake module is available, but the library's development package provides a pkg-config_ file. To use that, first load the CMake ``PkgConfig`` module, then access the build flags provided by the library:: find_package(PkgConfig REQUIRED) pkg_check_modules(GSTREAMER REQUIRED libgstreamer-0.10) The first ``pkg_check_modules()`` parameter declares a prefix for CMake variables like ``GSTREAMER_INCLUDE_DIRS`` and ``GSTREAMER_LIBRARIES``, later used for the compile and linkedit. The ``REQUIRED`` argument causes configuration to fail unless the following "module" is the base name of a pkg-config file provided by the library, in this example ``libgstreamer-0.10.pc``. Include directories ''''''''''''''''''' Before compiling, collect all the header paths you found earlier using ``find_package()`` or ``pkg_check_modules()``:: include_directories(include ${Boost_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS}) The ``include`` parameter is needed only if that subdirectory of your package contains headers used to compile your programs. If your package also depends on other catkin packages, add ``${catkin_INCLUDE_DIRS}`` to the list. Exporting interfaces '''''''''''''''''''' The ``catkin_package()`` command is only called once. In addition to any other parameters, it must declare the non-catkin system library and header packages needed by the interfaces you export to other ROS packages:: catkin_package(DEPENDS Boost GSTREAMER) Make sure all these packages are also mentioned in your ``package.xml`` using a ```` or ```` tag. For this to work, you must have found those dependencies earlier, using ``find_package()`` or ``pkg_check_modules()``, and they must define the CMake variables ``${name}_INCLUDE_DIRS`` and ``${name}_LIBRARIES``. Note that the package name is case sensitive. While catkin packages always use a lowercase name, other packages might use uppercase (as ``GSTREAMER``) or mixed case (like ``Boost``). Some packages provide variable names that do not comply with these recommendations. In that case, you must pass the absolute paths explicitly as ``INCLUDE_DIRS`` and ``LIBRARIES``. Next steps :::::::::: At this point, you are ready for :ref:`building_libraries_2` and :ref:`building_executables_2`. .. _`answers.ros.org`: http://answers.ros.org .. _`contributing the missing rules`: http://docs.ros.org/independent/api/rosdep/html/contributing_rules.html .. _pkg-config: http://www.freedesktop.org/wiki/Software/pkg-config/ .. _rosdep: http://wiki.ros.org/rosdep catkin-0.8.0/doc/howto/index.rst000066400000000000000000000012231361264727400165500ustar00rootroot00000000000000How to do common tasks ====================== There are currently two ``package.xml`` format versions. The ```` is recommended for new development. .. toctree:: :maxdepth: 2 format2/index The original ```` was used for most packages released to Groovy and Hydro. It is still fully supported and maintainers need not re-release their packages merely to upgrade the package version. Use these instructions when making small changes to an existing format 1 package. Larger changes would justify migrating to format 2. Never mix versions in a single package. .. toctree:: :maxdepth: 2 format1/index catkin-0.8.0/doc/index.rst000066400000000000000000000026101361264727400154110ustar00rootroot00000000000000Catkin ====== `Catkin `_ is a collection of CMake macros and associated code used to build packages used in `ROS `_. It was initially introduced as part of the ROS Fuerte_ release where it was used for a small set of base packages. For Groovy_ and Hydro_ it was significantly modified, and used by many more packages. All released Hydro packages were built using catkin, although existing `rosbuild `_ packages can still be built from source on top of the catkin packages. Indigo_ is very similar, except for some deprecated features that were removed. .. note:: This document covers the Indigo_ version. The Groovy_ and Hydro_ versions are `documented separately `_. .. _Fuerte: http://wiki.ros.org/fuerte .. _Groovy: http://wiki.ros.org/groovy .. _Hydro: http://wiki.ros.org/hydro .. _Indigo: http://wiki.ros.org/indigo Contents -------- .. toctree:: :maxdepth: 2 howto/index user_guide/user_guide adv_user_guide/adv_user_guide dev_guide/dev_guide Code & support -------------- +--------------+-------------------------------------+ | Catkin | http://github.com/ros/catkin | +--------------+-------------------------------------+ | Issues | http://github.com/ros/catkin/issues | +--------------+-------------------------------------+ catkin-0.8.0/doc/ros.png000066400000000000000000000147701361264727400150730ustar00rootroot00000000000000PNG  IHDR)֌QsRGB pHYs  tIME (MIDATx|wtT׵9NQC $Fa:l`M1a;ϸ-_\b18!`'q؀B $Pm4sw2H~]Z3ZS{ȿP_j뛝VfC zM-[ZmfkP!: ۥ`$I&)\+,]^fab; |]/}bk5>4$01Cz\iY_ZPqBDX҅z`b745yO6#( &Iҷe:wj0gMI{r9)~ᜉS&tfW@,E/ǭ6o;xF-+NjFϘ/PUv9⍽TʻP$Q{}Mzʐq.z@) O.HK;f@x޵;v/hd?fieѭJ$Ƣ(Ym933֬㹩C嵇0422Z9/"ܟ{},dݨSqQݽdJa/ ~@Fp0)+ <›w\>c'_? 6R9q 0g_m!hTpҥ!~v_}XVra p 蒙"nޗ2>- li8s;$I%?gq~њu!̽9\~A1DQ 1iLoǹp$l=7ȫM`-ms_aF]C+ 80@j)w˜{ǎ,!,x޳MbbV/|ph;VßNolnRtA!*&"4ثq'd`̨}ȨMyݐDsk{umg8',˔ܮzOfunnv0R!/Q=2{Aʋw:aΙ4's|-A#Y:,@aެ2}өOwU+S$h˫yAdYF^JFG!d(<ŷ6x,`s s "ƒRL?*%9_gk3[־K CQxk|=(I?ڲm1(YZӅ >ΐ`X(򵛕5MznSګc]yahy;ܸa&WPzB:_H@4jmm9s Q^p9KK{?`S򰸩8.9$ԝ8}ir:Oܙ6jA)o=y6o,V-WL7&4x`:ܒ"Iq})cGӔ߹ CPV^{!( !OT̲Vmf\eH,mM=Shxe8>8KHܶ IJC͖c.=29cySZsw2LeUGtaBeEZm ׽4w50;Aa;k͹k+ooUc],J !I {x\9o8_A(TR1C7n BbY/:"IJM[͜^RJµΫc#0򍋬88Η TXi@M6XVƔ/C@8b >a͞%])E3Rk}9kj's:_PaESRqCQR#<}6/<@L&$$ xRAEIH5\ j ea|jR% ܫ,1@[hTi)Ck[̌Ic{c\2R545VΫxV#٪=t|h^ѩ:ZUkjVky^Udi)C?{O<ڍҜ7r99-",ν~l ?8-z@@afMȜjkh9/jXp}$ISؘn&;`_޼^X<30_GGJʪ[ZBz*al .Y vp?u#3Mm{"",$9@{%KYy0!Z/o7f@ؚGX2s_l]تfXKRr(zf\jҴcߧ25iLxhRaVeGsYA'7>5^qټ^hhj'(J.ya zZj߲p'+9x\|a/t-gB8m>ªAYh;m) B dzcKOe ӜokeVޟެ =odlqf\~w_4v46R۽[P2 b I(&*ܕϙ;ϾǚۛZo9|t|\LD.fyocqIECckqi塣~wjfh B0,_8 AёGO]lk@DSs{0fnfB>!OӪu J_u7bٻح6nj)<utɹTx9fsn Y=@d(زsW z-2,t:6=tf,FVX4Vz6" Q,Kk5*_}υ$tXEAb\Y޾hNbf)J;o}ꥏ_, v乼־٦Q!l@a3m3BC::r᪵Ne_Xjmg/+U14DؘQ]27[^QwwǓHX"ꉳy6]S+Hstz: L-7eۮU54Mʹ]yU}'~nztIS($} Gcjnݮ*-jXHzUq]pp'`>OGr?@^UpHQzx~L` `,Jyݡ,$`:-By+% b3Sn/bk/\&۱ vAu -9 岧,Ƹ # "I\fw҇LkC7T,PƸN5.jIv6mҘ%ݭs+!Ӫ}ẀpA=b2t|t/0 'MNP\MSw*w.NWfLN5wDQruɽ5ժ5jFzprB}i ZW/ׅ:,v%5HӔFjJjH=B[lcFO3n\CV,ԨU&o$>}|Qɠs8]l:yl̩iC;,6%Xڋ{\~v+d@1Pvk36u>LSjE )#-~`Wz̩im~gI#ա"wKE` A "du8y^xd-^BG /(*k3[VM!1%ͭSI!=bPѭfC' x8poJrrAW=2;בm$ɋjuZ\FH4q\kVIt&a$$7q\LӫG9)A7kjzaBMm$QB# !D q ZzҸ߽UbZ-W Jlv|[̹yax?_QW/pa!gkhWDY`Q:޾SQKQ(@PU9y*䎚A$,I]Cs%eUm^1*1uQ#G&%Dޣl_Ȱ;QЌ]Gs?[KuIENDB`catkin-0.8.0/doc/user_guide/000077500000000000000000000000001361264727400157045ustar00rootroot00000000000000catkin-0.8.0/doc/user_guide/environment.rst000066400000000000000000000027101361264727400210020ustar00rootroot00000000000000.. _envfiles: Environment files ================= Catkin creates and installs files for env-setting convenience. In the devel space there are ``setup.zsh`` and ``setup.bash``, these contain variable zsh and bash specific tweaks. They both import ``setup.sh``, which contains bourne-shell variable settings. .. _env.sh: .. _setup.sh: .. _setup.bash: .. _setup.zsh: .. index:: env.sh ; environment .. index:: setup.sh ; environment .. index:: setup.bash ; environment .. index:: setup.zsh ; environment ``env.sh``, pointed to by the CMake variable :cmake:data:`CATKIN_ENV` is special; it executes its arguments in the environment created by ``setup.sh`` and returns. Any custom commands executed by CMake should do so via this script. .. rubric:: Environment hooks Projects can, via the :cmake:macro:`catkin_add_env_hooks` macro, add sh code to be executed by ``setup.sh`` (and by extension ``setup.bash`` and friends). If you need to add things to the environment, this is probably the place to do it. Don't get fancy: the contents of these scripts must be interpretable by all members of the bourne shell family. Be safe and ensure that ``/bin/dash`` is okay with them. You should avoid putting absolute paths into these environment hook ( at least in the install space). Instead use the variable ``$CATKIN_ENV_HOOK_WORKSPACE`` to point to workspace relative resources. **NOTE**: These environment hooks are only for variable settings, shell aliases and functions. catkin-0.8.0/doc/user_guide/find_package.rst000066400000000000000000000047521361264727400210410ustar00rootroot00000000000000.. _find_package_internals: Finding required packages ========================= Recommended method ------------------ If you want to specify a dependency on several catkin components simultaneously, use ``find_package(catkin [XX.YY] REQUIRED COMPONENTS comp1 comp2)``, e.g.:: find_package(catkin REQUIRED COMPONENTS cpp_common rostime roscpp_traits roscpp_serialization sensor_msgs) include_directories(${catkin_INCLUDE_DIRS}) add_executable(myexec ...) target_link_libraries(myexec ${catkin_LIBRARIES}) You can also reference the variables of each component individually:: target_link_libraries(myexec ${rostime_LIBRARIES}) See the CMake documentation for ``find_package()`` for more details. Your ``CMAKE_PREFIX_PATH`` will need to point to a catkin installation. find_package() config mode -------------------------- CMake's ``find_package`` is the preferred method for packages to communicate to CMake (and thereby to catkin) the libraries, include directories and such that packages should use. There are a couple of modes of operation of find_package (see the CMake documentation), "module" mode and "config" mode. "module" mode is the one that uses CMake scripts named ``Find****.cmake``. "config" mode is the preferred mode, and it works differently. One reason we find the 'config mode' superior is that is supports multiple simultaneous installed versions of packages. For a package ``t``, 'config mode' consists of two CMake files, both of which are installed somewhere on CMake's ``CMAKE_PREFIX_PATH``. The first is 'tConfig-version.cmake'. We find the most succinct form to be like this:: set(PACKAGE_VERSION_EXACT False) set(PACKAGE_VERSION_COMPATIBLE False) if("${PACKAGE_FIND_VERSION}" STREQUAL "") set(PACKAGE_VERSION_COMPATIBLE TRUE) return() endif() if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "9.9.9") set(PACKAGE_VERSION_EXACT True) set(PACKAGE_VERSION_COMPATIBLE True) endif() if("${PACKAGE_FIND_VERSION}" VERSION_LESS "9.9.9") set(PACKAGE_VERSION_COMPATIBLE True) endif() where `9.9.9` is replaced by the numeric version of the package. The second file, ``tConfig.cmake``, tells the client what the assorted includes/libs are for the package by setting variables ``t_INCLUDE_DIRS``, ``t_LIBRARIES``, ``t_LIBRARY_DIRS`` and so forth. The user passes these values to CMake's ``include_directories()`` and ``target_link_libraries()``. Since the libraries contains absolute paths ``link_directories()`` is not necessary. catkin-0.8.0/doc/user_guide/glossary.rst000066400000000000000000000036121361264727400203030ustar00rootroot00000000000000Glossary -------- .. glossary:: bloom.conf A file that lives on a special orphan branch `bloom` in a :term:`GBP repository` which contains meta-information (like upstream repository location and type) used when making releases with bloom. config-mode infrastructure Files named ``Config.cmake`` and ``Config-version.cmake`` which are used by cmake's ``find_package()`` in "config mode". dry a rosbuild stack or package not yet converted to catkin. Environment files The `setup.sh`, `setup.zsh` and `setup.bash` files generated and installed by catkin. See also :ref:`envfiles`. FHS The Linux `Filesystem Hierarchy Standard `_ generated code Code generated during the build process, typically by a message code generator package. May or may not require compilation. GBP repository A ``git-buildpackage`` repository. Contains released upstream source and the associated debian build files sufficient to assemble binary and source debs. Bloom-controlled repositories also contain a branch ``bloom`` with meta-information. package either a not yet to catkin convert package identified by a manifest.xml or a catkinized package containing a package.xml. pkgutil Nifty python package: http://docs.python.org/library/pkgutil.html project CMake's notion of a buildable subdirectory: it contains a ``CMakeLists.txt`` that calls CMake's ``project()`` macro. stack unit of grouping dry packages in the old rosbuild system. Each stack was packaged into a Debian package. static code Code typed in by a developer, contrast :term:`generated code` wet a ROS package already converted to catkin. It also applies to non-ROS code using catkin. catkin-0.8.0/doc/user_guide/installation.rst000066400000000000000000000017001361264727400211350ustar00rootroot00000000000000Installation ============ If you have a working ROS installation, catkin should be installed already. Prerequisites ------------- Catkin has the following dependencies: * CMake - A cross-platform, open-source build system. * Python - A general-purpose, interpreted high-level programming language. * catkin_pkg - A Python runtime library for catkin. * empy - A Python template library. * nose - A Python testing framework. * GTest - A C++ unit test framework from Google. You can resolve these dependencies on Ubuntu with this command:: sudo apt-get install cmake python-catkin-pkg python-empy python-nose libgtest-dev If you are not on Ubuntu you can install ``catkin_pkg`` from PyPi via pip:: sudo pip install -U catkin_pkg Ubuntu install -------------- Catkin is distributed with ROS as binary debian package for Ubuntu, it can be installed via:: sudo apt-get install ros-groovy-catkin For ROS Hydro, install ``ros-hydro-catkin`` instead. catkin-0.8.0/doc/user_guide/setup_dot_py.rst000066400000000000000000000131361361264727400211600ustar00rootroot00000000000000.. _setup_dot_py_handling: Handling of ``setup.py`` ------------------------ If your ROS package contains python modules and scripts to install, you need to define the installation process and a way to make the scripts accessible in the develspace. The python ecosystem defines installation standards in the ``distutils`` or ``setuputils`` libraries. With those libraries, packages define the installation files in a file called ``setup.py`` in the project root. The setup.py file uses Python to describe the Python content of the stack. Catkin allows you to specify the installation of your python files in this setup.py and reuse some of the information in your CMakeLists.txt. You can do so by including the line:: catkin_python_setup() in the CMakeLists.txt of your project. catkin will execute setup.py with a hot-patched version of distutils or setuptools to read the arguments to set up the devel space, and execute setup.py with suitable arguments to install to the catkin install space under ``CMAKE_INSTALL_PREFIX``. This means that if you execute your setup.py using:: # DO NOT USE # python setup.py install manually, that would install to a different location, and you would have multiple installed versions. Python will decide at runtime which one to use based on your PYTHONPATH environment variable, and it may pick the one you expect it to pick, but we recommend against having multiple installed versions in the first place. Using setup.py to create a pypi package of your catkin package currently has no support for ROS messages and services, and core ROS libraries (e.g. rospy) are not available on pypi, so this using setup.py for pypi is not very useful for ROS nodes. For the develspace, the following setup.py arguments to setup() will be used by catkin:: from setuptools import setup setup( version='...', scripts=['bin/myscript'], packages=['mypkg'], package_dir={'': 'src'} ) This creates relays for all scripts listed in ``scripts`` to a folder in devel space where they can be found and executed, and also relay packages for any package listed in ``packages``. A relay package is a folder with an __init__.py folder and nothing else. Importing this folder in python will execute the contents of __init__.py, which will in turn import the original python modules in the folder in the sourcespace using the python exec() function. The version will be compared to that declared in package.xml, and raise an error on mismatch. .. note:: If you have written non-ROS Python packages before, you have probably used the ``requires`` field in the distuils setup function. This field, however, *has no meaning* in ROS. All your Python dependencies should be specified in ``package.xml`` as e.g. ``python-numpy`` (for older version 1 of package.xml) or ``python-numpy`` (if you use format 2 of package.xml). Not all Python or pip packages are mapped to ROS dependencies. For a quick check, try running ``rosdep resolve python-mypackage`` or ``rosdep resolve python-mypackage-pip`` if you want to add a dependency on ``mypackage`` Python package. If these calls return error, you may want to search through the `python.yaml file in rosdep`_ for similar names. If you don't find the requested package, you may consider `creating a Pull request to add it`_. .. _python.yaml file in rosdep: https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml .. _creating a Pull request to add it: http://docs.ros.org/independent/api/rosdep/html/contributing_rules.html Using package.xml in setup.py ============================= Writing a setup.py file without duplicating information contained in the package.xml is possible using a catkin_pkg convenience function like this:: from setuptools import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['mypkg'], scripts=['bin/myscript'], package_dir={'': 'src'} ) setup(**d) This will parse the package.xml and also format the fields, such that multiple authors with emails will be set nicely for setup.py, in case one distributes to pypi. .. note:: ROS Users should generally not use the scripts argument, as in ROS, executables should be executed using rosrun rather than being installed to the global bin folder. One way of installing such python scripts is to add the following to the CMakeLists.txt:: catkin_install_python(PROGRAMS scripts/myscript DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) .. note:: See the note in previous section about the otherwise useful field ``requires`` that's usually a part of setuptools setup. *Do not use it* in ROS. Develspace limitations ====================== For the devel space, catkin currently does not support any of the following distutils arguments: * py_modules * data_files * any extention module features From setuptools, the following args are not supported for the devel space: * zip-safe * entry_points From distribute, the following args are not supported for the devel space: * include_package_data * exclude_package_data * zip_safe * entry_points * setup_requires * namespace_packages * use_2to3 Those features will only work correctly for the install space. genmsg interaction ================== genmsg is an external catkin package that provideslanguage bindings for ROS messages. When using the genmsg macro, ordering constraints exist, in that case you have to invoke the macros in this order:: project(...) ... find_package(catkin ...) ... catkin_python_setup() ... generate_messages() ... catkin_package() catkin-0.8.0/doc/user_guide/standards.rst000066400000000000000000000111371361264727400204240ustar00rootroot00000000000000CMake coding standards ====================== In order to make your ROS packages most maintainable and avoid several frequent errors, follow the standards below. Do care about the style your cmake code is written in. For inspiration, look at the guideline examples here: `CMake Style recommendations `_ `KDE cmake coding guidelines `_ **Call catkin_package before any targets** The following lines must always appear the CMakeLists.txt in this order:: cmake_minimum_required(VERSION 3.0.2) project(myproject) find_package(catkin REQUIRED ) catkin_package(<...>) While there might be additional function calls before catkin_package() (e.g. for finding other libraries or generating messages) it must be invoked before any targets are added. **Use ${PROJECT_NAME} wherever possible** Use ``${PROJECT_NAME}`` for global variables, targets and labels instead of repeating the project name manually or using fixed names. You can use ${PROJECT_NAME} as prefix for global variable names as well, as shown in examples below. Variables become global if they are set using the CACHE argument or created using the option() macro. After you defined your project name like this:: project(myproject) dont do this:: catkin_add_gtest(test ...) add_executable(myproject ...) set(use_feature 42 CACHE STRING "description") option(use_feature "on or off" OFF) macro(xyz) ... do this instead:: catkin_add_gtest(${PROJECT_NAME}_test ...) add_executable(${PROJECT_NAME} ...) set(${PROJECT_NAME}_use_feature 42 CACHE STRING "description") option(${PROJECT_NAME}_use_feature "on or off" OFF) macro(${PROJECT_NAME}_xyz) ... This will avoid conflicts between packages and errors due to copy&paste. **find_package(... REQUIRED)** Use ``REQUIRED`` on all calls to ``find_package`` if they aren't actually optional (i.e. you're not going to check ``thing_FOUND`` and enable/disable features). **Avoid Pkg_config** CMake allows to use pkg-config:: find_package(PkgConfig) pkg_check_modules(XXX xxx) However you should (in CMakeLists.txt files) if possible always prefer the method:: find_package(xxx) This is usually the most flexible and portable way. **Keep lists sorted** Whenever using a list of items (i.e. in find_package(COMPONENTS ...) or files which should be build or installed) keep them alphabetically sorted. This improves readability when looking for specific items. (There are exceptions which require a specific custom order like the list of projects inside a stack). **Lowercase keywords** Keywords like ``if``, ``for`` etc. are all lowercase. **Upper arguments** Use UPPER_CASE for arguments to CMake functions and macros (e.g. REQUIRED, NO_MODULE, QUIET) **Closing keyword should have empty parenthesis** The closing keywords like ``endif()`` and ``endforeach()`` should not repeat the condition of the opening keyword. **Indentation** Indent all code correctly, i.e. the body of * if/else/endif * foreach/endforeach * while/endwhile * macro/endmacro * function/endfunction Use spaces for indenting, 2 spaces preferably **Variable names** For custom variables, avoid the following list of suffixes in any CMakeLists.txt, those should only be set by FindXXX.cmake or XXXConfig.cmake files: * XXX_DEFINITIONS * XXX_EXECUTABLE * XXX_INCLUDE_DIRS * XXX_INCLUDE_DIR * XXX_YY_INCLUDE_DIR * XXX_LIBRARIES * XXX_LIBRARY_DIRS * XXX_LIBRARY * XXX_YY_LIBRARY * XXX_ROOT_DIR * XXX_FOUND * XXX_YY_FOUND * XXX_RUNTIME_LIBRARY_DIRS * XXX_VERSION_STRING * XXX_VERSION_MAJOR * XXX_VERSION_MINOR * XXX_VERSION_PATCH * XXX_VERSION_YY * XXX_WRAP_YY You may use such variables of course by reading their value after calling find_package(), but do not manually change them. **Forbidden variables** Do not set * CMAKE_CXX_FLAGS * CMAKE_FIND_ROOT_PATH **Conditions and Variables** Always quote variable that represent a string:: set(myvar "foo") if("${myvar}" STREQUAL "bar") # ... endif() Do not quote variable that are booleans:: set(mybvar ON) set(mybvar OFF) if(${myvar}) # ... endif() When storing paths in variables, do NOT have the cmake variables end up with a slash:: # YES: set(_my_path "path/to/foo") set(_my_other_path "${_my_path}/${_my_var}") # NO: set(my_path "path/to/foo/") set(_my_other_path "${_my_path}${_my_var}") # wrong: this is ugly Use if(DEFINED varname) to check if a variable is set:: if(DEFINED myvar) # ... endif() Use if(varname) to check it a variable has a non-empty value:: if(myvar) # ... endif() catkin-0.8.0/doc/user_guide/user_guide.rst000066400000000000000000000002321361264727400205660ustar00rootroot00000000000000User Guide ========== .. toctree:: :maxdepth: 2 installation find_package setup_dot_py standards variables environment glossary catkin-0.8.0/doc/user_guide/variables.rst000066400000000000000000000064551361264727400204200ustar00rootroot00000000000000.. _variables: Variables ========= Build space ----------- .. cmake:data:: CATKIN_DEVEL_PREFIX This is set to ``${CMAKE_BINARY_DIR}/devel`` by ``catkin/all.cmake`` and is the analogue to ``CMAKE_PREFIX_PATH``. Since the layout of the both folders ``CATKIN_DEVEL_PREFIX`` and ``CMAKE_PREFIX_PATH`` is identical you can append any of the following install destinations to the build prefix. Install destinations -------------------- All destination variables are meant to be used with the CMake ``install()`` macro as an ``DESTINATION`` argument. They only contain relative paths and are supposed to be relative to the ``${CMAKE_INSTALL_PREFIX}`` (or ``${CATKIN_DEVEL_PREFIX}``). **Project specific** .. cmake:data:: CATKIN_PACKAGE_BIN_DESTINATION This is set to ``${CATKIN_GLOBAL_LIBEXEC_DESTINATION}/${PROJECT_NAME}``. .. cmake:data:: CATKIN_PACKAGE_ETC_DESTINATION This is set to ``${CATKIN_GLOBAL_ETC_DESTINATION}/${PROJECT_NAME}``. .. cmake:data:: CATKIN_PACKAGE_INCLUDE_DESTINATION This is set to ``${CATKIN_GLOBAL_INCLUDE_DESTINATION}/${PROJECT_NAME}``. .. cmake:data:: CATKIN_PACKAGE_LIB_DESTINATION This is set to ``${CATKIN_GLOBAL_LIB_DESTINATION}``. All libraries go into a global folder. Still use this variable instead of ``CATKIN_GLOBAL_LIB_DESTINATION`` for package libraries. .. cmake:data:: CATKIN_PACKAGE_PYTHON_DESTINATION This is set to ``${CATKIN_GLOBAL_PYTHON_DESTINATION}/${PROJECT_NAME}``. .. cmake:data:: CATKIN_PACKAGE_SHARE_DESTINATION This is set to ``${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}``. **Global** .. cmake:data:: CATKIN_GLOBAL_BIN_DESTINATION This is set to ``bin``. This destination should only be used for the core ROS binaries. If you are unsure if you should use this destination use ``CATKIN_PACKAGE_LIBEXEC_DESTINATION`` instead. .. cmake:data:: CATKIN_GLOBAL_ETC_DESTINATION This is set to ``etc``. .. cmake:data:: CATKIN_GLOBAL_INCLUDE_DESTINATION This is set to ``include``. This destination should only be used when installing headers which are not in a subfolder which matches the project name. Else you should use the destination ``CATKIN_PACKAGE_INCLUDE_DESTINATION`` instead. .. cmake:data:: CATKIN_GLOBAL_LIB_DESTINATION This is set to ``lib``. This variable should not be used directly, use ``CATKIN_PACKAGE_LIB_DESTINATION`` instead. .. cmake:data:: CATKIN_GLOBAL_LIBEXEC_DESTINATION This is set to ``lib``. On non-Debian distributions it could be set to ``libexec``. Note that setting this variable to anything but ``lib`` or ``libexec`` will not work as expected since tools like ``catkin_find`` will only consider these two locations. This variable should not be used directly, use ``CATKIN_PACKAGE_BIN_DESTINATION`` instead. .. cmake:data:: CATKIN_GLOBAL_PYTHON_DESTINATION This is set to ``lib/pythonX.Y/dist-packages`` (Debian), ``lib/pythonX.Y/site-packages`` (non-Debian) or ``lib/site-packages`` (Windows). .. cmake:data:: CATKIN_GLOBAL_SHARE_DESTINATION This is set to ``share``. Environment ----------- .. cmake:data:: CATKIN_ENV The path to the shell script ``env.sh`` that will execute its arguments inside the catkin environment. CMake that executes shell commands (e.g. as part of ``add_custom_command``) should use this rather than wrangling environment explicitly. catkin-0.8.0/package.xml000066400000000000000000000042761361264727400151320ustar00rootroot00000000000000 catkin 0.8.0 Low-level build system macros and infrastructure for ROS. Dirk Thomas BSD http://wiki.ros.org/catkin https://github.com/ros/catkin/issues https://github.com/ros/catkin Troy Straszheim Morten Kjaergaard Brian Gerkey Dirk Thomas python-argparse python-catkin-pkg python3-catkin-pkg python-empy python3-empy cmake python-setuptools python3-setuptools cmake python3-setuptools google-mock gtest python-nose python3-nose python-mock python3-mock python-nose python3-nose catkin-0.8.0/python/000077500000000000000000000000001361264727400143255ustar00rootroot00000000000000catkin-0.8.0/python/catkin/000077500000000000000000000000001361264727400155765ustar00rootroot00000000000000catkin-0.8.0/python/catkin/__init__.py000066400000000000000000000000001361264727400176750ustar00rootroot00000000000000catkin-0.8.0/python/catkin/builder.py000066400000000000000000001430471361264727400176070ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import copy import multiprocessing import os import platform import re try: from shlex import quote except ImportError: from pipes import quote import stat try: from StringIO import StringIO except ImportError: from io import StringIO import subprocess import sys try: from catkin_pkg.cmake import configure_file, get_metapackage_cmake_template_path from catkin_pkg.packages import find_packages from catkin_pkg.tool_detection import get_previous_tool_used_on_the_space from catkin_pkg.tool_detection import mark_space_as_built_by from catkin_pkg.topological_order import topological_order_packages except ImportError as e: 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 ) from catkin.cmake import get_cmake_path from catkin_pkg.package import InvalidPackage from catkin_pkg.terminal_color import ansi, disable_ANSI_colors, fmt, sanitize from catkin_pkg.workspaces import ensure_workspace_marker def determine_path_argument(cwd, base_path, argument, default): if argument is None: # if no argument is passed the default is relative to the base_path path = os.path.join(base_path, default) else: # if an argument is passed it is relative to cwd (or absolute) path = os.path.abspath(os.path.join(cwd, argument)) return path def split_arguments(args, splitter_name, default=None): if splitter_name not in args: return args, default index = args.index(splitter_name) return args[0:index], args[index + 1:] def extract_cmake_and_make_arguments(args): args, cmake_args, make_args, _ = _extract_cmake_and_make_arguments(args, extract_catkin_make=False) return args, cmake_args, make_args def extract_cmake_and_make_and_catkin_make_arguments(args): return _extract_cmake_and_make_arguments(args, extract_catkin_make=True) def _extract_cmake_and_make_arguments(args, extract_catkin_make): cmake_args = [] make_args = [] catkin_make_args = [] arg_types = { '--cmake-args': cmake_args, '--make-args': make_args } if extract_catkin_make: arg_types['--catkin-make-args'] = catkin_make_args arg_indexes = {} for k in arg_types.keys(): if k in args: arg_indexes[args.index(k)] = k for index in reversed(sorted(arg_indexes.keys())): arg_type = arg_indexes[index] args, specific_args = split_arguments(args, arg_type) arg_types[arg_type].extend(specific_args) # classify -D* and -G* arguments as cmake specific arguments implicit_cmake_args = [a for a in args if a.startswith('-D') or a.startswith('-G')] args = [a for a in args if a not in implicit_cmake_args] return args, implicit_cmake_args + cmake_args, make_args, catkin_make_args def cprint(msg, end=None): print(fmt(msg), end=end) def colorize_line(line): cline = sanitize(line) cline = cline.replace( '-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', '-- @{pf}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@|' ) if line.startswith('-- ~~'): # -- ~~ - cline = cline.replace('~~ ', '@{pf}~~ @|') cline = cline.replace(' - ', ' - @!@{bf}') cline = cline.replace('(', '@|(') cline = cline.replace('(plain cmake)', '@|(@{rf}plain cmake@|)') cline = cline.replace('(unknown)', '@|(@{yf}unknown@|)') if line.startswith('-- +++'): # -- +++ add_subdirectory(package) cline = cline.replace('+++', '@!@{gf}+++@|') cline = cline.replace("kin package: '", "kin package: '@!@{bf}") cline = cline.replace(')', '@|)') cline = cline.replace("'\n", "@|'\n") cline = cline.replace("cmake package: '", "cmake package: '@!@{bf}") cline = cline.replace("'\n", "@|'\n") if line.startswith('-- ==>'): cline = cline.replace('-- ==>', '-- @!@{bf}==>@|') if line.lower().startswith('warning'): # WARNING cline = ansi('yf') + cline if line.startswith('CMake Warning'): # CMake Warning... cline = cline.replace('CMake Warning', '@{yf}@!CMake Warning@|') if line.startswith('ERROR:'): # ERROR: cline = cline.replace('ERROR:', '@!@{rf}ERROR:@|') if line.startswith('CMake Error'): # CMake Error... cline = cline.replace('CMake Error', '@{rf}@!CMake Error@|') if line.startswith('Call Stack (most recent call first):'): # CMake Call Stack cline = cline.replace('Call Stack (most recent call first):', '@{cf}@_Call Stack (most recent call first):@|') return fmt(cline) def print_command_banner(cmd, cwd, color): if color: # Prepare for printing cmd_str = sanitize(' '.join(cmd)) cwd_str = sanitize(cwd) # Print command notice cprint('@{bf}####') cprint('@{bf}#### Running command: @!"%s"@|@{bf} in @!"%s"' % (cmd_str, cwd_str)) cprint('@{bf}####') else: print('####') print('#### Running command: "%s" in "%s"' % (' '.join(cmd), cwd)) print('####') def run_command_colorized(cmd, cwd, quiet=False, add_env=None): run_command(cmd, cwd, quiet=quiet, colorize=True, add_env=add_env) def run_command(cmd, cwd, quiet=False, colorize=False, add_env=None): capture = (quiet or colorize) stdout_pipe = subprocess.PIPE if capture else None stderr_pipe = subprocess.STDOUT if capture else None env = None if add_env: env = copy.copy(os.environ) env.update(add_env) try: proc = subprocess.Popen( cmd, cwd=cwd, shell=False, stdout=stdout_pipe, stderr=stderr_pipe, env=env ) except OSError as e: raise OSError("Failed command '%s': %s" % (cmd, e)) out = StringIO() if quiet else sys.stdout if capture: while True: line = proc.stdout.readline() try: # try decoding in case the output is encoded line = line.decode('utf8', 'replace') except (AttributeError, UnicodeEncodeError): # do nothing for Python 3 when line is already a str # or when the string can't be decoded pass # ensure that it is convertable to the target encoding encoding = 'utf8' try: if out.encoding: encoding = out.encoding except AttributeError: # do nothing for Python 2 pass line = line.encode(encoding, 'replace') line = line.decode(encoding, 'replace') if proc.returncode is not None or not line: break try: line = colorize_line(line) if colorize else line except Exception as e: import traceback traceback.print_exc() print(' color formatting problem: ' + str(e), file=sys.stderr) out.write(line) proc.wait() if proc.returncode: if quiet: print(out.getvalue()) raise subprocess.CalledProcessError(proc.returncode, cmd) return out.getvalue() if quiet else '' blue_arrow = '@!@{bf}==>@|@!' def _check_build_dir(name, workspace, buildspace): package_build_dir = os.path.join(buildspace, name) if not os.path.exists(package_build_dir): cprint( blue_arrow + " Creating build directory: '" + os.path.relpath(package_build_dir, workspace) + "'@|" ) os.makedirs(package_build_dir) return package_build_dir def isolation_print_command(cmd, path=None, add_env=None): cprint( blue_arrow + ' ' + sanitize(cmd) + '@|' + (" @!@{kf}in@| '@!" + sanitize(path) + "@|'" if path else '') + (" @!@{kf}with@| '@!" + ' '.join(['%s=%s' % (k, v) for k, v in add_env.items()]) + "@|'" if add_env else '') ) def get_multiarch(): if not sys.platform.lower().startswith('linux'): return '' # this function returns the suffix for lib directories on supported systems or an empty string # it uses two step approach to look for multiarch: first run gcc -print-multiarch and if # failed try to run dpkg-architecture p = subprocess.Popen( ['gcc', '-print-multiarch'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = p.communicate()[0].decode('utf-8') if p.returncode != 0: out = subprocess.Popen( ['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8') # be sure of returning empty string or a valid multiarch tuple format assert(not out.strip() or out.strip().count('-') == 2) return out.strip() def get_python_install_dir(): # this function returns the same value as the CMake variable PYTHON_INSTALL_DIR from catkin/cmake/python.cmake python_install_dir = 'lib' python_use_debian_layout = os.path.exists('/etc/debian_version') if os.name != 'nt': python_version_xdoty = str(sys.version_info[0]) + '.' + str(sys.version_info[1]) if python_use_debian_layout and sys.version_info[0] == 3: python_version_xdoty = str(sys.version_info[0]) python_install_dir = os.path.join(python_install_dir, 'python' + python_version_xdoty) python_packages_dir = 'dist-packages' if python_use_debian_layout else 'site-packages' python_install_dir = os.path.join(python_install_dir, python_packages_dir) return python_install_dir def handle_make_arguments(input_make_args, append_default_jobs_flags=True): make_args = list(input_make_args) # If no -j/--jobs/-l/--load-average flags are in make_args if not extract_jobs_flags(' '.join(make_args)): # If -j/--jobs/-l/--load-average are in MAKEFLAGS if 'MAKEFLAGS' in os.environ and extract_jobs_flags(os.environ['MAKEFLAGS']): # Do not extend make arguments, let MAKEFLAGS set things pass else: # Else extend the make_arguments to include some jobs flags # If ROS_PARALLEL_JOBS is set use those flags if 'ROS_PARALLEL_JOBS' in os.environ: # ROS_PARALLEL_JOBS is a set of make variables, not just a number ros_parallel_jobs = os.environ['ROS_PARALLEL_JOBS'] make_args.extend(ros_parallel_jobs.split()) elif append_default_jobs_flags: # Else Use the number of CPU cores try: jobs = multiprocessing.cpu_count() make_args.append('-j{0}'.format(jobs)) make_args.append('-l{0}'.format(jobs)) except NotImplementedError: # If the number of cores cannot be determined, do not extend args pass return make_args def extract_jobs_flags(mflags): regex = r'(?:^|\s)(-?(?:j|l)(?:\s*[0-9]+|\s|$))' + \ r'|' + \ r'(?:^|\s)((?:--)?(?:jobs|load-average)(?:(?:=|\s+)[0-9]+|(?:\s|$)))' matches = re.findall(regex, mflags) or [] matches = [m[0] or m[1] for m in matches] return ' '.join([m.strip() for m in matches]) if matches else None def build_catkin_package( path, package, workspace, buildspace, develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args, destdir=None, use_ninja=False, use_nmake=False, use_gmake=False ): cprint( "Processing @{cf}catkin@| package: '@!@{bf}" + package.name + "@|'" ) # Make the build dir build_dir = _check_build_dir(package.name, workspace, buildspace) # Check last_env if last_env is not None: cprint( blue_arrow + ' Building with env: ' + "'{0}'".format(sanitize(last_env)) ) # Check for Makefile and maybe call cmake if not use_ninja: makefile_name = 'Makefile' else: makefile_name = 'build.ninja' makefile = os.path.join(build_dir, makefile_name) if not os.path.exists(makefile) or force_cmake: package_dir = os.path.dirname(package.filename) if not os.path.exists(os.path.join(package_dir, 'CMakeLists.txt')): export_tags = [e.tagname for e in package.exports] if 'metapackage' not in export_tags: print(colorize_line('Error: Package "%s" does not have a CMakeLists.txt file' % package.name)) sys.exit('Can not build catkin package without CMakeLists.txt file') # generate CMakeLists.txt for metpackages without one print(colorize_line('Warning: metapackage "%s" should have a CMakeLists.txt file' % package.name)) cmake_code = configure_file( get_metapackage_cmake_template_path(), {'name': package.name, 'metapackage_arguments': 'DIRECTORY "%s"' % package_dir}) cmakelists_txt = os.path.join(build_dir, 'CMakeLists.txt') with open(cmakelists_txt, 'w') as f: f.write(cmake_code) package_dir = build_dir # Run cmake cmake_cmd = [ 'cmake', package_dir, '-DCATKIN_DEVEL_PREFIX=' + develspace, '-DCMAKE_INSTALL_PREFIX=' + installspace ] cmake_cmd.extend(cmake_args) add_env = get_additional_environment(install, destdir, installspace) isolation_print_command(' '.join(cmake_cmd), build_dir, add_env=add_env) if last_env is not None: cmake_cmd = [last_env] + cmake_cmd try: run_command_colorized(cmake_cmd, build_dir, quiet, add_env=add_env) except subprocess.CalledProcessError: if os.path.exists(makefile): # remove Makefile to force CMake invocation next time os.remove(makefile) raise else: print('%s exists, skipping explicit cmake invocation...' % makefile_name) # Check to see if cmake needs to be run via make if use_ninja: make_check_cmake_cmd = ['ninja', 'build.ninja'] elif use_nmake: make_check_cmake_cmd = ['nmake', 'cmake_check_build_system'] elif use_gmake: make_check_cmake_cmd = ['gmake', 'cmake_check_build_system'] else: make_check_cmake_cmd = ['make', 'cmake_check_build_system'] add_env = get_additional_environment(install, destdir, installspace) isolation_print_command(' '.join(make_check_cmake_cmd), build_dir, add_env=add_env) if last_env is not None: make_check_cmake_cmd = [last_env] + make_check_cmake_cmd run_command_colorized( make_check_cmake_cmd, build_dir, quiet, add_env=add_env ) # Run make if use_ninja: make_executable = 'ninja' elif use_nmake: make_executable = 'nmake' elif use_gmake: make_executable = 'gmake' else: make_executable = 'make' make_cmd = [make_executable] make_cmd.extend(handle_make_arguments(make_args, append_default_jobs_flags=not use_nmake)) isolation_print_command(' '.join(make_cmd), build_dir) if last_env is not None: make_cmd = [last_env] + make_cmd run_command(make_cmd, build_dir, quiet) # Make install # NMake doesn't have an option to list target so try it anyway if install or use_nmake: if has_make_target(build_dir, 'install', use_ninja=use_ninja, use_nmake=use_nmake, use_gmake=use_gmake): make_install_cmd = [make_executable, 'install'] isolation_print_command(' '.join(make_install_cmd), build_dir) if last_env is not None: make_install_cmd = [last_env] + make_install_cmd run_command(make_install_cmd, build_dir, quiet) else: print(fmt( '@{yf}Package has no "@{boldon}install@{boldoff}" target, skipping "%s install" invocation...' % make_executable)) def has_make_target(path, target, use_ninja=False, use_nmake=False, use_gmake=False): if use_ninja: output = run_command(['ninja', '-t', 'targets'], path, quiet=True) elif use_nmake: output = run_command(['nmake', '/PNC'], path, quiet=True) elif use_gmake: output = run_command(['gmake', '-pn'], path, quiet=True) else: output = run_command(['make', '-pn'], path, quiet=True) lines = output.splitlines() # strip nanja warnings since they look similar to targets if use_ninja: lines = [l for l in lines if not l.startswith('ninja: warning:')] targets = [m.group(1) for m in [re.match(r'^([a-zA-Z0-9][a-zA-Z0-9_\.]*):', l) for l in lines] if m] return target in targets def get_additional_environment(install, destdir, installspace): add_env = {} if install and destdir: # exclude drive letter if on Windows, returns the same string on Linux since there is no drive specifications _, installspace = os.path.splitdrive(installspace) add_env['_CATKIN_SETUP_DIR'] = os.path.join(destdir, installspace[1:]) return add_env def write_env_bat(dest_file, variables): env_bat_template = """\ @echo off REM generated from catkin.builder Python module if "%1"=="" ( echo "Usage: env.bat COMMANDS" echo "Calling env.bat without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually." exit 1 ) else ( call "{SETUP_DIR}\\{SETUP_FILENAME}.bat" %* ) """ with open(dest_file, 'w') as f: f.write(env_bat_template.format(**variables)) def write_setup_bat(dest_file, last_setup_basename, variables): setup_bat_header = """\ @echo off REM generated from catkin.builder Python module """ setup_bat_template = """\ REM Prepend to the environment set CMAKE_PREFIX_PATH={cmake_prefix_path};%CMAKE_PREFIX_PATH% set LD_LIBRARY_PATH={ld_path};%LD_LIBRARY_PATH% set PATH={path};%PATH% set PKG_CONFIG_PATH={pkgcfg_path};%PKG_CONFIG_PATH% set PYTHONPATH={pythonpath};%PYTHONPATH% """ with open(dest_file, 'w') as f: f.write(setup_bat_header) if last_setup_basename is not None: f.write('call "%s.bat"\n\n' % last_setup_basename) f.write(setup_bat_template.format(**variables)) def write_env_sh(dest_file, variables): env_sh_template = """\ #!/usr/bin/env sh # generated from catkin.builder Python module if [ $# -eq 0 ] ; then /bin/echo "Usage: env.sh COMMANDS" /bin/echo "Calling env.sh without arguments is not supported anymore. \ Instead spawn a subshell and source a setup file manually." exit 1 fi # ensure to not use different shell type which was set before CATKIN_SHELL=sh # source {SETUP_FILENAME}.sh from same directory as this file . "$(cd "`dirname "$0"`" && pwd)/{SETUP_FILENAME}.sh" exec "$@" """ with open(os.path.join(dest_file), 'w') as f: f.write(env_sh_template.format(**variables)) os.chmod(dest_file, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR) def write_setup_sh(dest_file, last_setup_basename, variables): setup_sh_header = """\ #!/usr/bin/env sh # generated from catkin.builder Python module # remember type of shell if not already set if [ -z "$CATKIN_SHELL" ]; then CATKIN_SHELL=sh fi """ setup_sh_template = """\ # detect if running on Darwin platform _UNAME=`uname -s` IS_DARWIN=0 if [ "$_UNAME" = "Darwin" ]; then IS_DARWIN=1 fi # Prepend to the environment export CMAKE_PREFIX_PATH="{cmake_prefix_path}:$CMAKE_PREFIX_PATH" if [ $IS_DARWIN -eq 0 ]; then export LD_LIBRARY_PATH="{ld_path}:$LD_LIBRARY_PATH" else export DYLD_LIBRARY_PATH="{ld_path}:$DYLD_LIBRARY_PATH" fi export PATH="{path}:$PATH" export PKG_CONFIG_PATH="{pkgcfg_path}:$PKG_CONFIG_PATH" export PYTHONPATH="{pythonpath}:$PYTHONPATH" """ with open(dest_file, 'w') as f: f.write(setup_sh_header) if last_setup_basename is not None: f.write('. "%s.$CATKIN_SHELL"\n\n' % last_setup_basename) f.write(setup_sh_template.format(**variables)) def build_cmake_package( path, package, workspace, buildspace, develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args, destdir=None, use_ninja=False, use_nmake=False, use_gmake=False ): # Notify the user that we are processing a plain cmake package cprint( "Processing @{cf}plain cmake@| package: '@!@{bf}" + package.name + "@|'" ) # Make the build dir if install: build_dir_name = '%s%sinstall' % (package.name, os.sep) else: build_dir_name = '%s%sdevel' % (package.name, os.sep) build_dir = _check_build_dir(build_dir_name, workspace, buildspace) # Check last_env if last_env is not None: cprint(blue_arrow + ' Building with env: ' + "'{0}'".format(sanitize(last_env))) # Check for Makefile and maybe call cmake if not use_ninja: makefile_name = 'Makefile' else: makefile_name = 'build.ninja' makefile = os.path.join(build_dir, makefile_name) install_target = installspace if install else develspace if not os.path.exists(makefile) or force_cmake: # Call cmake cmake_cmd = [ 'cmake', os.path.dirname(package.filename), '-DCMAKE_INSTALL_PREFIX=' + install_target ] cmake_cmd.extend(cmake_args) isolation_print_command(' '.join(cmake_cmd), build_dir) if last_env is not None: cmake_cmd = [last_env] + cmake_cmd run_command_colorized(cmake_cmd, build_dir, quiet) else: print('%s exists, skipping explicit cmake invocation...' % makefile_name) # Check to see if cmake needs to be run via make if use_ninja: make_check_cmake_cmd = ['ninja', 'build.ninja'] elif use_nmake: make_check_cmake_cmd = ['nmake', 'cmake_check_build_system'] elif use_gmake: make_check_cmake_cmd = ['gmake', 'cmake_check_build_system'] else: make_check_cmake_cmd = ['make', 'cmake_check_build_system'] isolation_print_command(' '.join(make_check_cmake_cmd), build_dir) if last_env is not None: make_check_cmake_cmd = [last_env] + make_check_cmake_cmd run_command_colorized( make_check_cmake_cmd, build_dir, quiet ) # Run make if use_ninja: make_executable = 'ninja' elif use_nmake: make_executable = 'nmake' elif use_gmake: make_executable = 'gmake' else: make_executable = 'make' make_cmd = [make_executable] make_cmd.extend(handle_make_arguments(make_args, append_default_jobs_flags=not use_nmake)) isolation_print_command(' '.join(make_cmd), build_dir) if last_env is not None: make_cmd = [last_env] + make_cmd if install: run_command(make_cmd, build_dir, quiet) else: run_command(make_cmd, build_dir, quiet, add_env={'DESTDIR': ''}) # Make install make_install_cmd = [make_executable, 'install'] isolation_print_command(' '.join(make_install_cmd), build_dir) if last_env is not None: make_install_cmd = [last_env] + make_install_cmd run_command(make_install_cmd, build_dir, quiet) env_script = 'env' + ('.bat' if sys.platform == 'win32' else '.sh') # If an env script already exists, don't overwrite it if install and os.path.exists(prefix_destdir(os.path.join(install_target, env_script), destdir)): return cprint(blue_arrow + ' Generating an ' + env_script) # Generate env script for chaining to catkin packages # except if using --merge which implies that new_env_path equals last_env new_env_path = os.path.join(install_target, env_script) if install: new_env_path = prefix_destdir(new_env_path, destdir) if new_env_path != last_env: variables = { 'SETUP_DIR': install_target, 'SETUP_FILENAME': 'setup' } if not os.path.exists(os.path.dirname(new_env_path)): os.makedirs(os.path.dirname(new_env_path)) env_script_writer = write_env_bat if sys.platform == 'win32' else write_env_sh env_script_writer(dest_file=new_env_path, variables=variables) # Generate setup script for chaining to catkin packages # except if using --merge which implies that new_setup_path equals last_setup_env setup_script = 'setup' + ('.bat' if sys.platform == 'win32' else '.sh') new_setup_path = os.path.join(install_target, setup_script) if install: new_setup_path = prefix_destdir(new_setup_path, destdir) last_setup_env = os.path.join(os.path.dirname(last_env), setup_script) if last_env is not None else None if new_setup_path != last_setup_env: subs = {} # CMAKE_PREFIX_PATH uses forward slash on all platforms. subs['cmake_prefix_path'] = install_target.replace(os.sep, '/') subs['ld_path'] = os.path.join(install_target, 'lib') pythonpath = os.path.join(install_target, get_python_install_dir()) subs['pythonpath'] = pythonpath subs['pkgcfg_path'] = os.path.join(install_target, 'lib', 'pkgconfig') subs['path'] = os.path.join(install_target, 'bin') arch = get_multiarch() if arch: subs['ld_path'] = os.pathsep.join([subs['ld_path'], os.path.join(install_target, 'lib', arch)]) subs['pkgcfg_path'] = os.pathsep.join([subs['pkgcfg_path'], os.path.join(install_target, 'lib', arch, 'pkgconfig')]) if not os.path.exists(os.path.dirname(new_setup_path)): os.mkdir(os.path.dirname(new_setup_path)) setup_script_writer = write_setup_bat if sys.platform == 'win32' else write_setup_sh last_setup_basename = os.path.splitext(last_setup_env)[0] if last_setup_env is not None else None setup_script_writer(dest_file=new_setup_path, last_setup_basename=last_setup_basename, variables=subs) if sys.platform != 'win32': # generate setup.bash|zsh scripts setup_script_template = """\ #!/usr/bin/env {1} # generated from catkin.builder Python module CATKIN_SHELL={1} . "{0}/setup.sh" """ for shell in ['bash', 'zsh']: setup_path = os.path.join(install_target, 'setup.%s' % shell) if install: setup_path = prefix_destdir(setup_path, destdir) with open(setup_path, 'w') as f: f.write(setup_script_template.format(os.path.dirname(setup_path), shell)) def build_package( path, package, workspace, buildspace, develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args, catkin_make_args, destdir=None, use_ninja=False, use_nmake=False, use_gmake=False, number=None, of=None ): if platform.system() in ['Linux', 'Darwin'] and sys.stdout.isatty(): status_msg = '{package_name} [{number} of {total}]'.format(package_name=package.name, number=number, total=of) sys.stdout.write('\x1b]2;' + status_msg + '\x07') cprint('@!@{gf}==>@| ', end='') new_last_env = get_new_env(package, develspace, installspace, install, last_env, destdir) try: build_type = package.get_build_type() except InvalidPackage as e: sys.exit(str(e)) if build_type == 'catkin': build_catkin_package( path, package, workspace, buildspace, develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args + catkin_make_args, destdir=destdir, use_ninja=use_ninja, use_nmake=use_nmake, use_gmake=use_gmake ) if not os.path.exists(new_last_env): raise RuntimeError( "No env.sh file generated at: '" + new_last_env + "'\n This sometimes occurs when a non-catkin package is " 'interpreted as a catkin package.\n This can also occur ' 'when the cmake cache is stale, try --force-cmake.' ) elif build_type == 'cmake': build_cmake_package( path, package, workspace, buildspace, develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args, destdir=destdir, use_ninja=use_ninja, use_nmake=use_nmake, use_gmake=use_gmake ) else: sys.exit('Can not build package with unknown build_type') if number is not None and of is not None: msg = ' [@{gf}@!' + str(number) + '@| of @!@{gf}' + str(of) + '@|]' else: msg = '' cprint('@{gf}<==@| Finished processing package' + msg + ": '@{bf}@!" + package.name + "@|'") return new_last_env def get_new_env(package, develspace, installspace, install, last_env, destdir=None): env_script = 'env.bat' if sys.platform == 'win32' else 'env.sh' new_env = None try: build_type = package.get_build_type() except InvalidPackage as e: sys.exit(str(e)) if build_type in ['catkin', 'cmake']: new_env = os.path.join( installspace if install else develspace, env_script ) if install: new_env = prefix_destdir(new_env, destdir) return new_env def prefix_destdir(path, destdir=None): if destdir is not None: # exclude drive letter if on Windows, returns the same string on Linux since there is no drive specifications _, path = os.path.splitdrive(path) path = os.path.join(destdir, path[1:]) return path def _print_build_error(package, e): e_msg = 'KeyboardInterrupt' if isinstance(e, KeyboardInterrupt) else str(e) cprint("@{rf}@!<==@| Failed to process package '@!@{bf}" + package.name + "@|': \n " + e_msg) def build_workspace_isolated( workspace='.', sourcespace=None, buildspace=None, develspace=None, installspace=None, merge=False, install=False, force_cmake=False, colorize=True, build_packages=None, ignore_packages=None, quiet=False, cmake_args=None, make_args=None, catkin_make_args=None, continue_from_pkg=False, only_pkg_with_deps=None, destdir=None, use_ninja=False, use_nmake=False, use_gmake=False, override_build_tool_check=False ): """ Run ``cmake``, ``make`` and optionally ``make install`` for all catkin packages in sourcespace_dir. It creates several folders in the current working directory. For non-catkin packages it runs ``cmake``, ``make`` and ``make install`` for each, installing it to the devel space or install space if the ``install`` option is specified. :param workspace: path to the current workspace, ``str`` :param sourcespace: workspace folder containing catkin packages, ``str`` :param buildspace: path to build space location, ``str`` :param develspace: path to devel space location, ``str`` :param installspace: path to install space (CMAKE_INSTALL_PREFIX), ``str`` :param merge: if True, build each catkin package into the same devel space (not affecting plain cmake packages), ``bool`` :param install: if True, install all packages to the install space, ``bool`` :param force_cmake: (optional), if True calls cmake explicitly for each package, ``bool`` :param colorize: if True, colorize cmake output and other messages, ``bool`` :param build_packages: specific packages to build (all parent packages in the topological order must have been built before), ``str`` :param quiet: if True, hides some build output, ``bool`` :param cmake_args: additional arguments for cmake, ``[str]`` :param make_args: additional arguments for make, ``[str]`` :param catkin_make_args: additional arguments for make but only for catkin packages, ``[str]`` :param continue_from_pkg: indicates whether or not cmi should continue when a package is reached, ``bool`` :param only_pkg_with_deps: only consider the specific packages and their recursive dependencies and ignore all other packages in the workspace, ``[str]`` :param destdir: define DESTDIR for cmake/invocation, ``string`` :param use_ninja: if True, use ninja instead of make, ``bool`` :param use_nmake: if True, use nmake instead of make, ``bool`` :param use_gmake: if True, use gmake instead of make, ``bool`` :param override_build_tool_check: if True, build even if a space was built by another tool previously. """ if not colorize: disable_ANSI_colors() # Check workspace existance if not os.path.exists(workspace): sys.exit("Workspace path '{0}' does not exist.".format(workspace)) workspace = os.path.abspath(workspace) # Check source space existance if sourcespace is None: sourcespace = os.path.join(workspace, 'src') if not os.path.exists(sourcespace): sys.exit('Could not find source space: {0}'.format(sourcespace)) print('Base path: ' + str(workspace)) print('Source space: ' + str(sourcespace)) # Check build space if buildspace is None: buildspace = os.path.join(workspace, 'build_isolated') if not os.path.exists(buildspace): os.mkdir(buildspace) print('Build space: ' + str(buildspace)) # ensure the build space was previously built by catkin_make_isolated previous_tool = get_previous_tool_used_on_the_space(buildspace) if previous_tool is not None and previous_tool != 'catkin_make_isolated': if override_build_tool_check: print(fmt( "@{yf}Warning: build space at '%s' was previously built by '%s', " 'but --override-build-tool-check was passed so continuing anyways.' % (buildspace, previous_tool))) else: sys.exit(fmt( "@{rf}The build space at '%s' was previously built by '%s'. " 'Please remove the build space or pick a different build space.' % (buildspace, previous_tool))) mark_space_as_built_by(buildspace, 'catkin_make_isolated') # Check devel space if develspace is None: develspace = os.path.join(workspace, 'devel_isolated') print('Devel space: ' + str(develspace)) # ensure the devel space was previously built by catkin_make_isolated previous_tool = get_previous_tool_used_on_the_space(develspace) if previous_tool is not None and previous_tool != 'catkin_make_isolated': if override_build_tool_check: print(fmt( "@{yf}Warning: devel space at '%s' was previously built by '%s', " 'but --override-build-tool-check was passed so continuing anyways.' % (develspace, previous_tool))) else: sys.exit(fmt( "@{rf}The devel space at '%s' was previously built by '%s'. " 'Please remove the devel space or pick a different devel space.' % (develspace, previous_tool))) mark_space_as_built_by(develspace, 'catkin_make_isolated') # Check install space if installspace is None: installspace = os.path.join(workspace, 'install_isolated') print('Install space: ' + str(installspace)) if cmake_args: print('Additional CMake Arguments: ' + ' '.join(cmake_args)) else: cmake_args = [] if not [arg for arg in cmake_args if arg.startswith('-G')]: if use_ninja: cmake_args += ['-G', 'Ninja'] elif use_nmake: cmake_args += ['-G', 'NMake Makefiles'] else: # no need to check for use_gmake, as it uses the same generator as make cmake_args += ['-G', 'Unix Makefiles'] elif use_ninja or use_nmake: print(colorize_line("Error: either specify a generator using '-G...' or '--use-[ninja|nmake]' but not both")) sys.exit(1) if make_args: print('Additional make Arguments: ' + ' '.join(make_args)) else: make_args = [] if catkin_make_args: print('Additional make Arguments for catkin packages: ' + ' '.join(catkin_make_args)) else: catkin_make_args = [] # Find packages packages = find_packages(sourcespace, exclude_subspaces=True) if not packages: print(fmt('@{yf}No packages found in source space: %s@|' % sourcespace)) # whitelist packages and their dependencies in workspace if only_pkg_with_deps: package_names = [p.name for p in packages.values()] unknown_packages = [name for name in only_pkg_with_deps if name not in package_names] if unknown_packages: sys.exit('Packages not found in the workspace: %s' % ', '.join(unknown_packages)) whitelist_pkg_names = get_package_names_with_recursive_dependencies(packages, only_pkg_with_deps) print('Whitelisted packages: %s' % ', '.join(sorted(whitelist_pkg_names))) packages = {path: p for path, p in packages.items() if p.name in whitelist_pkg_names} # verify that specified package exists in workspace if build_packages: packages_by_name = {p.name: path for path, p in packages.items()} unknown_packages = [p for p in build_packages if p not in packages_by_name] if unknown_packages: sys.exit('Packages not found in the workspace: %s' % ', '.join(unknown_packages)) # evaluate conditions for package in packages.values(): package.evaluate_conditions(os.environ) # Report topological ordering ordered_packages = topological_order_packages(packages, blacklisted=ignore_packages) unknown_build_types = [] msg = [] msg.append('@{pf}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + ('~' * len(str(len(ordered_packages))))) msg.append('@{pf}~~@| traversing %d packages in topological order:' % len(ordered_packages)) for path, package in ordered_packages: if path is None: print(fmt('@{rf}Error: Circular dependency in subset of packages: @!%s@|' % package)) sys.exit('Can not build workspace with circular dependency') export_tags = [e.tagname for e in package.exports] if 'build_type' in export_tags: build_type_tag = [e.content for e in package.exports if e.tagname == 'build_type'][0] else: build_type_tag = 'catkin' if build_type_tag == 'catkin': msg.append('@{pf}~~@| - @!@{bf}' + package.name + '@|') elif build_type_tag == 'cmake': msg.append( '@{pf}~~@| - @!@{bf}' + package.name + '@|' + ' (@!@{cf}plain cmake@|)' ) else: msg.append( '@{pf}~~@| - @!@{bf}' + package.name + '@|' + ' (@{rf}unknown@|)' ) unknown_build_types.append(package) msg.append('@{pf}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + ('~' * len(str(len(ordered_packages))))) for index in range(len(msg)): msg[index] = fmt(msg[index]) print('\n'.join(msg)) # Error if there are packages with unknown build_types if unknown_build_types: print(colorize_line('Error: Packages with unknown build types exist')) sys.exit('Can not build workspace with packages of unknown build_type') # Check to see if the workspace has changed cmake_args_with_spaces = list(cmake_args) if develspace: cmake_args_with_spaces.append('-DCATKIN_DEVEL_PREFIX=' + develspace) if installspace: cmake_args_with_spaces.append('-DCMAKE_INSTALL_PREFIX=' + installspace) if ( not force_cmake and cmake_input_changed(packages, buildspace, cmake_args=cmake_args_with_spaces, filename='catkin_make_isolated') ): print('The packages or cmake arguments have changed, forcing cmake invocation') force_cmake = True ensure_workspace_marker(workspace) # Build packages pkg_develspace = None last_env = None for index, path_package in enumerate(ordered_packages): path, package = path_package if merge: pkg_develspace = develspace else: pkg_develspace = os.path.join(develspace, package.name) if not build_packages or package.name in build_packages: if continue_from_pkg and build_packages and package.name in build_packages: build_packages = None try: print() last_env = build_package( path, package, workspace, buildspace, pkg_develspace, installspace, install, force_cmake, quiet, last_env, cmake_args, make_args, catkin_make_args, destdir=destdir, use_ninja=use_ninja, use_nmake=use_nmake, use_gmake=use_gmake, number=index + 1, of=len(ordered_packages) ) except subprocess.CalledProcessError as e: _print_build_error(package, e) # Let users know how to reproduce # First add the cd to the build folder of the package cmd = 'cd ' + quote(os.path.join(buildspace, package.name)) + ' && ' # Then reproduce the command called if isinstance(e.cmd, list): # quote arguments to allow copy-n-paste of command cmd += ' '.join([quote(arg) for arg in e.cmd]) else: cmd += e.cmd print(fmt('\n@{rf}Reproduce this error by running:')) print(fmt('@{gf}@!==> @|') + cmd + '\n') sys.exit('Command failed, exiting.') except Exception as e: print("Unhandled exception of type '{0}':".format(type(e).__name__)) import traceback traceback.print_exc() _print_build_error(package, e) sys.exit('Command failed, exiting.') else: cprint("Skipping package: '@!@{bf}" + package.name + "@|'") last_env = get_new_env(package, pkg_develspace, installspace, install, last_env, destdir) # Provide a top level devel space environment setup script if not os.path.exists(develspace): os.makedirs(develspace) if not build_packages: env_script = 'env' if sys.platform == 'win32': env_script += '.bat' env_script_content = """\ @echo off REM generated from catkin.builder Python module call {0} %* """ setup_script_content = """\ @echo off REM generated from catkin.builder Python module call "{0}/setup.{1}" """ else: env_script += '.sh' env_script_content = """\ #!/usr/bin/env sh # generated from catkin.builder Python module {0} "$@" """ setup_script_content = """\ #!/usr/bin/env {1} # generated from catkin.builder Python module . "{0}/setup.{1}" """ setup_sh_content = """\ #!/usr/bin/env sh # generated from catkin.builder Python module if [ ! -z "$_CATKIN_SETUP_DIR" ] && [ "$_CATKIN_SETUP_DIR" != "{1}" ]; then echo "Relocation of this workspace is not supported" return 1 fi _CATKIN_SETUP_DIR= . "{0}/setup.sh" """ generated_env_sh = os.path.join(develspace, env_script) generated_setup_util_py = os.path.join(develspace, '_setup_util.py') if not merge and pkg_develspace: # generate env script and setup.sh|bash|zsh or setup.bat which relay to last devel space with open(generated_env_sh, 'w') as f: f.write(env_script_content.format(os.path.join(pkg_develspace, env_script))) os.chmod(generated_env_sh, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR) shells_to_write = ['bat'] if sys.platform == 'win32' else ['bash', 'zsh'] for shell in shells_to_write: with open(os.path.join(develspace, 'setup.%s' % shell), 'w') as f: f.write(setup_script_content.format(pkg_develspace, shell)) if sys.platform != 'win32': with open(os.path.join(develspace, 'setup.sh'), 'w') as f: f.write(setup_sh_content.format(pkg_develspace, develspace)) # remove _setup_util.py file which might have been generated for an empty devel space before if os.path.exists(generated_setup_util_py): os.remove(generated_setup_util_py) elif not pkg_develspace: # generate env.* and setup.* scripts for an empty devel space if 'CMAKE_PREFIX_PATH' in os.environ.keys(): variables = { 'CATKIN_GLOBAL_BIN_DESTINATION': 'bin', 'CATKIN_LIB_ENVIRONMENT_PATHS': "'lib'", 'CATKIN_PKGCONFIG_ENVIRONMENT_PATHS': "os.path.join('lib', 'pkgconfig')", 'CMAKE_PREFIX_PATH_AS_IS': ';'.join(os.environ['CMAKE_PREFIX_PATH'].split(os.pathsep)), 'PYTHON_EXECUTABLE': sys.executable, 'PYTHON_INSTALL_DIR': get_python_install_dir(), } with open(generated_setup_util_py, 'w') as f: f.write(configure_file( os.path.join(get_cmake_path(), 'templates', '_setup_util.py.in'), variables)) os.chmod(generated_setup_util_py, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR) else: sys.exit('Unable to process CMAKE_PREFIX_PATH from environment. Cannot generate environment files.') variables = { 'SETUP_DIR': develspace, 'SETUP_FILENAME': 'setup', } with open(generated_env_sh, 'w') as f: f.write(configure_file(os.path.join(get_cmake_path(), 'templates', env_script + '.in'), variables)) os.chmod(generated_env_sh, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR) variables = { 'PYTHON_EXECUTABLE': sys.executable, 'SETUP_DIR': develspace, } shells_to_write = ['bat'] if sys.platform == 'win32' else ['sh', 'bash', 'zsh'] for shell in shells_to_write: with open(os.path.join(develspace, 'setup.%s' % shell), 'w') as f: f.write(configure_file( os.path.join(get_cmake_path(), 'templates', 'setup.%s.in' % shell), variables)) def cmake_input_changed(packages, build_path, cmake_args=None, filename='catkin_make'): # get current input package_paths = os.pathsep.join(sorted(packages.keys())) cmake_args = ' '.join(cmake_args) if cmake_args else '' # file to store current input changed = False input_filename = os.path.join(build_path, '%s.cache' % filename) if not os.path.exists(input_filename): changed = True else: # compare with previously stored input with open(input_filename, 'r') as f: previous_package_paths = f.readline().rstrip() previous_cmake_args = f.readline().rstrip() if package_paths != previous_package_paths: changed = True if cmake_args != previous_cmake_args: changed = True # store current input for next invocation with open(input_filename, 'w') as f: f.write('%s\n%s' % (package_paths, cmake_args)) return changed def get_package_names_with_recursive_dependencies(packages, pkg_names): dependencies = set() check_pkg_names = set(pkg_names) packages_by_name = {p.name: p for path, p in packages.items()} while check_pkg_names: pkg_name = check_pkg_names.pop() if pkg_name in packages_by_name: pkg = packages_by_name[pkg_name] dependencies.add(pkg_name) deps_to_iterate_over = ( pkg.build_depends + pkg.buildtool_depends + pkg.run_depends + (pkg.test_depends if pkg.package_format > 1 else []) ) for dep in [dep.name for dep in deps_to_iterate_over if dep.evaluated_condition is not False]: if dep in packages_by_name and dep not in check_pkg_names and dep not in dependencies: check_pkg_names.add(dep) return dependencies def apply_platform_specific_defaults(args): # add Windows specific defaults if sys.platform == 'win32': # default to use nmake if on Windows and if not using ninja if not args.use_ninja: args.use_nmake = True # use RelWithDebInfo as default build type if on Windows prefix = '-DCMAKE_BUILD_TYPE=' if not any(a.startswith(prefix) for a in args.cmake_args): args.cmake_args.append(prefix + 'RelWithDebInfo') catkin-0.8.0/python/catkin/cmake.py000066400000000000000000000041651361264727400172360ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2013, Open Source Robotics Foundation, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Open Source Robotics Foundation, Inc. nor # the names of its contributors may be used to endorse or promote # products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import os from catkin.find_in_workspaces import find_in_workspaces def get_cmake_path(): relpath = os.path.join(os.path.dirname(__file__), '..', '..', 'cmake') if os.path.exists(relpath): return os.path.normpath(relpath) paths = find_in_workspaces(['share'], 'catkin', first_matching_workspace_only=True, first_match_only=True) if not paths: raise RuntimeError('Could not determine catkin cmake path') return os.path.join(paths[0], 'cmake') catkin-0.8.0/python/catkin/environment_cache.py000066400000000000000000000101241361264727400216350ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. import ast import os import platform import subprocess import sys def generate_environment_script(env_script): """ Generate script code to cache environment changes of a script. This code assumes that the script does nothing else than changing variables that contain colon separated lists of PATHs, by replacing or prepending. :param env_script: str The path to the script which changes the environment :returns: list script lines """ code = [] _append_header(code) _append_comment(code, 'based on a snapshot of the environment before and after calling the setup script') _append_comment(code, 'it emulates the modifications of the setup script without recurring computations') # fetch current environment env = os.environ # fetch environment after calling setup python_code = 'import os; print(dict(os.environ))' output = subprocess.check_output([env_script, sys.executable, '-c', python_code]) env_after = ast.literal_eval(output.decode('utf8')) # calculate added and modified environment variables added = {} modified = {} for key, value in env_after.items(): if key not in env: added[key] = value elif env[key] != value: modified[key] = [env[key], value] code.append('') _append_comment(code, 'new environment variables') for key in sorted(added.keys()): _set_variable(code, key, added[key]) code.append('') _append_comment(code, 'modified environment variables') for key in sorted(modified.keys()): (old_value, new_value) = modified[key] if new_value.endswith(os.pathsep + old_value): variable = ('$%s' if _is_not_windows() else '%%%s%%') % key _set_variable(code, key, new_value[:-len(old_value)] + variable) else: _set_variable(code, key, new_value) return code def _is_not_windows(): return platform.system() != 'Windows' def _append_header(code): if _is_not_windows(): code.append('#!/usr/bin/env sh') else: code.append('@echo off') _append_comment(code, 'generated from catkin/python/catkin/environment_cache.py') code.append('') def _append_comment(code, value): if _is_not_windows(): comment_prefix = '#' else: comment_prefix = 'REM' code.append('%s %s' % (comment_prefix, value)) def _set_variable(code, key, value): if _is_not_windows(): code.append('export %s="%s"' % (key, value)) else: code.append('set %s=%s' % (key, value)) catkin-0.8.0/python/catkin/find_in_workspaces.py000066400000000000000000000201421361264727400220160ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import os from catkin.workspace import get_source_paths, get_workspaces from catkin_pkg.packages import find_packages def _get_valid_search_dirs(search_dirs, project): """ Compare param collection of search dirs with valid names, raises ValueError if invalid. Maintains the order of param if any. If project is given other names are allowed than without. :param search_dirs: collection of foldernames (basename) to search for :param project: the project to search in or None :raises: ValueError """ # define valid search folders valid_global_search_dirs = ['bin', 'etc', 'include', 'lib', 'share'] valid_project_search_dirs = ['etc', 'include', 'libexec', 'share'] valid_search_dirs = (valid_global_search_dirs if project is None else valid_project_search_dirs) if not search_dirs: search_dirs = valid_search_dirs else: # make search folders a list search_dirs = list(search_dirs) # determine valid search folders all_valid_search_dirs = set(valid_global_search_dirs).union( set(valid_project_search_dirs)) # check folder name is known at all diff_dirs = set(search_dirs).difference(all_valid_search_dirs) if len(diff_dirs) > 0: raise ValueError('Unsupported search folders: ' + ', '.join(['"%s"' % i for i in diff_dirs])) # check foldername works with project arg diff_dirs = set(search_dirs).difference(valid_search_dirs) if len(diff_dirs) > 0: msg = 'Searching %s a project can not be combined with the search folders:' % ('without' if project is None else 'for') raise ValueError(msg + ', '.join(['"%s"' % i for i in diff_dirs])) return search_dirs # OUT is always a list of folders # # IN: project=None # OUT: foreach ws in workspaces: foreach s in search_in: cand = ws[0] + s (+ path) # add cand to result list if it exists # is not defined for s == 'libexec', bailing out # # IN: project=not None # OUT: foreach ws in workspaces: foreach s in search_in: cand = ws[0] + s + project (+ path) # except for s == 'share', cand is a list of two paths: ws[0] + s + project (+ path) and ws[1] + project (+ path) # add cand to result list if it exists # is not defined for s in ['bin', 'lib'], bailing out def find_in_workspaces(search_dirs=None, project=None, path=None, _workspaces=None, considered_paths=None, first_matching_workspace_only=False, first_match_only=False, workspace_to_source_spaces=None, source_path_to_packages=None): """ Find all paths which match the search criteria. All workspaces are searched in order. Each workspace, each search_in subfolder, the project name and the path are concatenated to define a candidate path. If the candidate path exists it is appended to the result list. Note: the search might return multiple paths for 'share' from devel- and source-space. :param search_dir: The list of subfolders to search in (default contains all valid values: 'bin', 'etc', 'lib', 'libexec', 'share'), ``list`` :param project: The project name to search for (optional, not possible with the global search_in folders 'bin' and 'lib'), ``str`` :param path: The path, ``str`` :param _workspaces: (optional, used for unit tests), the list of workspaces to use. :param considered_paths: If not None, function will append all path that were searched :param first_matching_workspace_only: if True returns all results found for first workspace with results :param first_match_only: if True returns first path found (supercedes first_matching_workspace_only) :param workspace_to_source_spaces: the dictionary is populated with mappings from workspaces to source paths, pass in the same dictionary to avoid repeated reading of the catkin marker file :param source_path_to_packages: the dictionary is populated with mappings from source paths to packages, pass in the same dictionary to avoid repeated crawling :raises ValueError: if search_dirs contains an invalid folder name :returns: List of paths """ search_dirs = _get_valid_search_dirs(search_dirs, project) if 'libexec' in search_dirs: search_dirs.insert(search_dirs.index('libexec'), 'lib') if _workspaces is None: _workspaces = get_workspaces() if workspace_to_source_spaces is None: workspace_to_source_spaces = {} if source_path_to_packages is None: source_path_to_packages = {} paths = [] existing_paths = [] try: for workspace in (_workspaces or []): for sub in search_dirs: # search in workspace p = os.path.join(workspace, sub) if project: p = os.path.join(p, project) if path: p = os.path.join(p, path) paths.append(p) if os.path.exists(p): existing_paths.append(p) if first_match_only: raise StopIteration # for search in share also consider source spaces if project is not None and sub == 'share': if workspace not in workspace_to_source_spaces: workspace_to_source_spaces[workspace] = get_source_paths(workspace) for source_path in workspace_to_source_spaces[workspace]: if source_path not in source_path_to_packages: source_path_to_packages[source_path] = find_packages(source_path) matching_packages = [p for p, pkg in source_path_to_packages[source_path].items() if pkg.name == project] if matching_packages: p = source_path if matching_packages[0] != os.curdir: p = os.path.join(p, matching_packages[0]) if path is not None: p = os.path.join(p, path) paths.append(p) if os.path.exists(p): existing_paths.append(p) if first_match_only: raise StopIteration if first_matching_workspace_only and existing_paths: break except StopIteration: pass if considered_paths is not None: considered_paths.extend(paths) return existing_paths catkin-0.8.0/python/catkin/init_workspace.py000066400000000000000000000136521361264727400212000ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import os import shutil import sys from catkin.workspace import get_source_paths, get_workspaces def _symlink_or_copy(src, dst): """Create a symlink at dst to src, or if not possible, attempts to copy.""" # try to symlink file try: os.symlink(src, dst) print('Creating symlink "%s" pointing to "%s"' % (dst, src)) except Exception as ex_symlink: # try to copy file try: shutil.copyfile(src, dst) print('Copying file from "%s" to "%s"' % (src, dst)) except Exception as ex_copy: raise RuntimeError('Could neither symlink nor copy file "%s" to "%s":\n- %s\n- %s' % (src, dst, str(ex_symlink), str(ex_copy))) def init_workspace(workspace_dir): """ Create a toplevel CMakeLists.txt in the root of a workspace. The toplevel.cmake file is looked up either in the catkin workspaces contained in the CMAKE_PREFIX_PATH or relative to this file. Then it tries to create a symlink first and if that fails copies the file. It installs ``manifest.xml`` to ``share/${PROJECT_NAME}``. .. note:: The symlink is absolute when catkin is found outside the workspace_dir (since that indicates a different workspace and it may change relative location to the workspace referenced as a parameter). The symlink is relative when catkin is part of the to-be-initialized workspace. :param workspace_dir: the path to the workspace where the CMakeLists.txt should be created :type workspace_dir: string """ # verify that destination file does not exist dst = os.path.join(workspace_dir, 'CMakeLists.txt') if os.path.exists(dst): raise RuntimeError('File "%s" already exists' % dst) if os.path.islink(dst): print('Removing symlink "%s" which points to non-existing file' % dst) os.unlink(dst) src_file_path = None checked = [] # look in to-be-initialized workspace first src = os.path.join(workspace_dir, 'catkin', 'cmake', 'toplevel.cmake') if os.path.isfile(src): if sys.platform == 'win32': # use absolute path on Windows due to lack of support for os.symlink src_file_path = src else: src_file_path = os.path.relpath(src, workspace_dir) else: checked.append(src) # search for toplevel file in all workspaces if src_file_path is None: workspaces = get_workspaces() for workspace in workspaces: source_paths = get_source_paths(workspace) if len(source_paths) == 0: # try from install space src = os.path.join(workspace, 'catkin', 'cmake', 'toplevel.cmake') if os.path.isfile(src): src_file_path = src break else: checked.append(src) else: # try from all source spaces for source_path in source_paths: src = os.path.join(source_path, 'catkin', 'cmake', 'toplevel.cmake') if os.path.isfile(src): src_file_path = src break else: checked.append(src) # search for toplevel file in relative locations if src_file_path is None: relative_cmake_paths = [] # when catkin is in source space relative_cmake_paths.append(os.path.join('..', '..', 'cmake')) # when catkin is installed (with Python code in lib/pythonX.Y/[dist|site]-packages) relative_cmake_paths.append(os.path.join('..', '..', '..', '..', 'share', 'catkin', 'cmake')) # when catkin is installed (with Python code in lib/site-packages) relative_cmake_paths.append(os.path.join('..', '..', '..', 'share', 'catkin', 'cmake')) for relative_cmake_path in relative_cmake_paths: src = os.path.abspath(os.path.join(os.path.dirname(__file__), relative_cmake_path, 'toplevel.cmake')) if os.path.isfile(src): src_file_path = src break else: checked.append(src) if src_file_path is None: raise RuntimeError('Could neither find file "toplevel.cmake" in any workspace nor relative, checked the following paths:\n%s' % ('\n'.join(checked))) _symlink_or_copy(src_file_path, dst) catkin-0.8.0/python/catkin/package_version.py000066400000000000000000000001161361264727400213060ustar00rootroot00000000000000# for backward compatibility from catkin_pkg.package_version import * # noqa catkin-0.8.0/python/catkin/terminal_color.py000066400000000000000000000001151361264727400211560ustar00rootroot00000000000000# for backward compatibility from catkin_pkg.terminal_color import * # noqa catkin-0.8.0/python/catkin/test_results.py000066400000000000000000000263131361264727400207150ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import errno import os import sys from xml.etree.ElementTree import ElementTree, ParseError from catkin.tidy_xml import tidy_xml def remove_junit_result(filename): # if result file exists remove it before test execution if os.path.exists(filename): os.remove(filename) # if placeholder (indicating previous failure) exists remove it before test execution missing_filename = _get_missing_junit_result_filename(filename) if os.path.exists(missing_filename): os.remove(missing_filename) def ensure_junit_result_exist(filename): if os.path.exists(filename): # if result file exists ensure that it contains valid xml tree = None try: tree = ElementTree(None, filename) except ParseError: # print('Invalid XML in result file "%s"' % filename) tidy_xml(filename) try: tree = ElementTree(None, filename) except ParseError as e: print("Invalid XML in result file '%s' (even after trying to tidy it): %s " % (filename, str(e)), file=sys.stderr) return False if tree: _, num_errors, num_failures = read_junit(filename) if num_errors or num_failures: return False else: # if result file does not exist create placeholder which indicates failure missing_filename = _get_missing_junit_result_filename(filename) print("Cannot find results, writing failure results to '%s'" % missing_filename, file=sys.stderr) # create folder if necessary if not os.path.exists(os.path.dirname(filename)): try: os.makedirs(os.path.dirname(filename)) except OSError as e: # catch case where folder has been created in the mean time if e.errno != errno.EEXIST: raise with open(missing_filename, 'w') as f: data = {'test': os.path.basename(filename), 'test_file': filename} f.write(""" """ % data) return False return True def _get_missing_junit_result_filename(filename): return os.path.join(os.path.dirname(filename), 'MISSING-%s' % os.path.basename(filename)) def read_junit(filename): """Parse xml file similar to `read_junit2` except it doesn't return num_skipped.""" num_tests, num_errors, num_failures, _ = read_junit2(filename) return (num_tests, num_errors, num_failures) def read_junit2(filename): """ Parse xml file expected to follow junit/gtest conventions see http://code.google.com/p/googletest/wiki/AdvancedGuide#Generating_an_XML_Report. :param filename: str junit xml file name :returns: num_tests, num_errors, num_failures, num_skipped :raises ParseError: if xml is not well-formed :raises ValueError: if root the node is neither a testsuites tag nor a testsuite tag :raises IOError: if filename does not exist """ tree = ElementTree() root = tree.parse(filename) num_tests_sum = 0 num_errors_sum = 0 num_failures_sum = 0 num_skipped_sum = 0 if root.tag == 'testsuites': try: num_tests, num_errors, num_failures, num_skipped = _get_testsuite_stats(root) except KeyError: pass else: num_tests_sum += num_tests num_errors_sum += num_errors num_failures_sum += num_failures num_skipped_sum += num_skipped for child in root: if child.tag == 'testsuite': try: num_tests, num_errors, num_failures, num_skipped = _get_testsuite_stats(child) except KeyError: pass else: num_tests_sum += num_tests num_errors_sum += num_errors num_failures_sum += num_failures num_skipped_sum += num_skipped elif root.tag == 'testsuite': num_tests, num_errors, num_failures, num_skipped = _get_testsuite_stats(root) num_tests_sum += num_tests num_errors_sum += num_errors num_failures_sum += num_failures num_skipped_sum += num_skipped else: raise ValueError( "the root tag is neither 'testsuite' nor 'testsuites'") return (num_tests_sum, num_errors_sum, num_failures_sum, num_skipped_sum) def _get_testsuite_stats(node): num_tests = int(node.attrib['tests']) num_errors = int(node.attrib['errors']) num_failures = int(node.attrib['failures']) num_skipped = int(node.get('skip', '0')) + int(node.get('disabled', '0')) return (num_tests, num_errors, num_failures, num_skipped) def test_results(test_results_dir, show_verbose=False, show_all=False): """Same as `test_results2` except the returned values don't include num_skipped.""" results = {} results2 = test_results2( test_results_dir, show_verbose=show_verbose, show_all=show_all) for name, values in results2.items(): num_tests, num_errors, num_failures, _ = values results[name] = (num_tests, num_errors, num_failures) return results def test_results2(test_results_dir, show_verbose=False, show_all=False): """ Collect test results by parsing all xml files in given path, attempting to interpret them as junit results. :param test_results_dir: str foldername :param show_verbose: bool show output for tests which had errors or failed :returns: dict {rel_path, (num_tests, num_errors, num_failures, num_skipped)} """ results = {} for dirpath, dirnames, filenames in os.walk(test_results_dir): # do not recurse into folders starting with a dot dirnames[:] = [d for d in dirnames if not d.startswith('.')] for filename in [f for f in filenames if f.endswith('.xml')]: filename_abs = os.path.join(dirpath, filename) name = filename_abs[len(test_results_dir) + 1:] try: num_tests, num_errors, num_failures, num_skipped = read_junit2(filename_abs) except Exception as e: if show_all: print('Skipping "%s": %s' % (name, str(e))) continue results[name] = (num_tests, num_errors, num_failures, num_skipped) if show_verbose and (num_errors + num_failures > 0): print("Full test results for '%s'" % (name)) print('-------------------------------------------------') with open(filename_abs, 'r') as f: print(f.read()) print('-------------------------------------------------') return results def aggregate_results(results, callback_per_result=None): """Aggregate results similar to `aggregate_results2` except it doesn't return num_skipped.""" callback = None if callback_per_result is not None: def callback(name, num_tests, num_errors, num_failures, num_skipped): callback_per_result(name, num_tests, num_errors, num_failures) sum_tests, sum_errors, sum_failures, _ = aggregate_results2( results, callback_per_result=callback) return (sum_tests, sum_errors, sum_failures) def aggregate_results2(results, callback_per_result=None): """ Aggregate results. :param results: dict as from test_results() :returns: tuple (num_tests, num_errors, num_failures, num_skipped) """ sum_tests = sum_errors = sum_failures = sum_skipped = 0 for name in sorted(results.keys()): (num_tests, num_errors, num_failures, num_skipped) = results[name] sum_tests += num_tests sum_errors += num_errors sum_failures += num_failures sum_skipped += num_skipped if callback_per_result: callback_per_result( name, num_tests, num_errors, num_failures, num_skipped) return sum_tests, sum_errors, sum_failures, sum_skipped def print_summary(results, show_stable=False, show_unstable=True): """Print summary similar to `print_summary2` except it doesn't print skipped tests.""" print_summary2( results, show_stable=show_stable, show_unstable=show_unstable, print_skipped=False) def print_summary2(results, show_stable=False, show_unstable=True, print_skipped=True): """ Print summary to stdout. :param results: dict as from test_results() :param show_stable: print tests without failures extra :param show_stable: print tests with failures extra :param print_skipped: include skipped tests in output """ def callback(name, num_tests, num_errors, num_failures, num_skipped): if show_stable and not num_errors and not num_failures and not num_skipped: print('%s: %d tests' % (name, num_tests)) if show_unstable and (num_errors or num_failures or num_skipped): msg = '{}: {} tests, {} errors, {} failures' msg_args = [name, num_tests, num_errors, num_failures] if print_skipped: msg += ', {} skipped' msg_args.append(num_skipped) print(msg.format(*msg_args)) sum_tests, sum_errors, sum_failures, sum_skipped = aggregate_results2(results, callback) msg = 'Summary: {} tests, {} errors, {} failures' msg_args = [sum_tests, sum_errors, sum_failures] if print_skipped: msg += ', {} skipped' msg_args.append(sum_skipped) print(msg.format(*msg_args)) catkin-0.8.0/python/catkin/tidy_xml.py000066400000000000000000000065121361264727400200050ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2008, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import unicode_literals import codecs import os import re # unit test suites are not good about screening out illegal unicode characters (#603) # recipe from http://boodebr.org/main/python/all-about-python-and-unicode#UNI_XML # code copied from rosunit/src/junitxml.py try: char = unichr except NameError: char = chr RE_XML_ILLEGAL = ( '([%s-%s%s-%s%s-%s%s-%s])' + '|' + '([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])') % \ (char(0x0000), char(0x0008), char(0x000b), char(0x000c), char(0x000e), char(0x001f), char(0xfffe), char(0xffff), char(0xd800), char(0xdbff), char(0xdc00), char(0xdfff), char(0xd800), char(0xdbff), char(0xdc00), char(0xdfff), char(0xd800), char(0xdbff), char(0xdc00), char(0xdfff)) _SAFE_XML_REGEX = re.compile(RE_XML_ILLEGAL) def tidy_xml(filename): """ Read in file, screen out unsafe unicode characters, write back file in utf-8. :param filename: str :returns: False if unable to read from file """ if not os.path.isfile(filename): raise ValueError('file does not exist') # try first utf-8 then iso. This is ugly, but the files in # question that are problematic do not declare unicode type data = None for ftype in ['utf-8', 'iso8859-1']: fhand = None try: fhand = codecs.open(filename, 'r', ftype) data = fhand.read() break except ValueError: continue finally: if fhand is not None: fhand.close() if data is None: return False for match in _SAFE_XML_REGEX.finditer(data): data = data[:match.start()] + '?' + data[match.end():] with open(filename, 'w') as fhand: fhand.write(data) return True catkin-0.8.0/python/catkin/workspace.py000066400000000000000000000056141361264727400201540ustar00rootroot00000000000000# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function import os CATKIN_MARKER_FILE = '.catkin' def get_workspaces(): """ Based on CMAKE_PREFIX_PATH return all catkin workspaces. :param _environ: environment module to use, ``dict`` """ # get all cmake prefix paths env_name = 'CMAKE_PREFIX_PATH' paths = [path for path in os.environ.get(env_name, '').split(os.pathsep) if path] # remove non-workspace paths workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))] return workspaces def get_source_paths(workspace): """ Read catkin workspace files and returns the list of all declared source paths. :param workspace: path to catkin workspace folder, ``str`` """ # determine source spaces filename = os.path.join(workspace, CATKIN_MARKER_FILE) if not os.path.isfile(filename): raise ValueError('Not a catkin workspace: "%s", missing file %s' % (workspace, filename)) with open(filename) as f: data = f.read() source_paths = [] if data != '': real_source_paths = set() for path in data.split(';'): real_path = os.path.realpath(path) if real_path not in real_source_paths: source_paths.append(path) real_source_paths.add(real_path) return source_paths catkin-0.8.0/python/catkin/workspace_vcs.py000066400000000000000000000001141361264727400210150ustar00rootroot00000000000000# for backward compatibility from catkin_pkg.workspace_vcs import * # noqa catkin-0.8.0/rosdoc.yaml000066400000000000000000000000531361264727400151570ustar00rootroot00000000000000 - builder: sphinx sphinx_root_dir: doc catkin-0.8.0/setup.py000066400000000000000000000006401361264727400145160ustar00rootroot00000000000000from catkin_pkg.python_setup import generate_distutils_setup from setuptools import setup d = generate_distutils_setup( packages=['catkin'], package_dir={'': 'python'}, scripts=[ 'bin/catkin_find', 'bin/catkin_init_workspace', 'bin/catkin_make', 'bin/catkin_make_isolated', 'bin/catkin_test_results', 'bin/catkin_topological_order', ], ) setup(**d) catkin-0.8.0/test/000077500000000000000000000000001361264727400137635ustar00rootroot00000000000000catkin-0.8.0/test/.gitignore000066400000000000000000000001201361264727400157440ustar00rootroot00000000000000debbuild pkgbuild tmp/* src/catkin_test/debian scratch SCRATCH PREFIX fullbuild catkin-0.8.0/test/README.rst000066400000000000000000000023451361264727400154560ustar00rootroot00000000000000Subfolders of catkin/test: ========================== To run tests, you need to set the python sources of catkin first in the pythonpath. In the catkin folder, run:: $ export PYTHONPATH=`pwd`/python:$PYTHONPATH Use python-nose to run tests, get it from apt-get. Run tests from the catkin folder using just:: $ nosetests $ nosetests test/path/to/python_file Is it also possible to run tests from the test folder. To run a single test function, run e.g.:: $ nosetests path/to/python_file.py:ClassName.testmethod src --- a test workspace with mock catkin stacks mock_resources -------------- mock catkin stacks to run tests against unit_tests ---------- tests testing (python) functions in isolation local_tests ----------- tests that run catkin cli but require no network connection (quick) network_tests ------------- tests that run catkin cli and checkout all core ros stacks, and require network connection (slow) tmp --- created by network tests, downloaded ros core packages to run make against. Placed here to avoid long test durations due to duplicate downloads. checks ------ scripts to run manually that ensure catkin is viable for ROS distros. Those scripts do many dangerous things, such as sudo rm -rf /opt/ros. catkin-0.8.0/test/__init__.py000066400000000000000000000001421361264727400160710ustar00rootroot00000000000000import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python')) catkin-0.8.0/test/checks/000077500000000000000000000000001361264727400152235ustar00rootroot00000000000000catkin-0.8.0/test/checks/README.rst000066400000000000000000000003131361264727400167070ustar00rootroot00000000000000This folder contains utiliy scripts and files used during the development of catkin in fuerte. They seem to be outdated and unmaintained. To be deleted once we are sure we don't care about them anymore. catkin-0.8.0/test/checks/catkin-test.sh000066400000000000000000000014201361264727400200020ustar00rootroot00000000000000TOP=$(cd `dirname $0` ; pwd) BUILD=$TOP/build SRC=$TOP/src cleanup () { echo "!!!!!!!!!!!!!!! DO NOT PROCEED UNLESS YOU KNOW WHAT YOU ARE DOING !!!!!!!!!" echo "This script completely removes /opt/ros/fuerte and reinstalls catkin stacks from source" echo -n "Please confirm (y or n) :" read CONFIRM case $CONFIRM in y|Y|YES|yes|Yes) ;; *) echo Aborting - you entered $CONFIRM exit ;; esac rm -rf $BUILD || /bin/true mkdir -p $BUILD sudo dpkg -r ros-fuerte\* || /bin/true sudo rm -rf /opt/ros/fuerte/* || /bin/true sudo mkdir -p /opt/ros/fuerte sudo chown -R `whoami` /opt/ros/fuerte rm $SRC/*.dsc || /bin/true rm $SRC/*.tar.gz || /bin/true rm $SRC/*.deb || /bin/true rm $SRC/*.changes || /bin/true }catkin-0.8.0/test/checks/fuerte/000077500000000000000000000000001361264727400165155ustar00rootroot00000000000000catkin-0.8.0/test/checks/fuerte/distro-to-install.py000077500000000000000000000004371361264727400224660ustar00rootroot00000000000000#!/usr/bin/env python import rospkg.distro import sys def go(argv): if len(argv) != 2: print('wrong number args') sys.exit(1) d=rospkg.distro.load_distro(argv[1]) ri=rospkg.distro.distro_to_rosinstall(d, 'release') print(ri) if __name__ == '__main__': go(sys.argv) catkin-0.8.0/test/checks/fuerte/fuerte.rosinstall000066400000000000000000000250171361264727400221300ustar00rootroot00000000000000[{'hg': {'local-name': 'warehousewg', 'version': 'warehousewg-0.5.7', 'uri': 'http://kforge.ros.org/warehousewg/warehouse-hg'}}, {'hg': {'local-name': 'control', 'version': 'control-1.0.1', 'uri': 'https://bitbucket.org/sglaser/control'}}, {'hg': {'local-name': 'nodelet_core', 'version': 'nodelet_core-1.6.4', 'uri': 'https://kforge.ros.org/common/nodeletcore'}}, {'svn': {'local-name': 'octomap_mapping', 'uri': 'https://alufr-ros-pkg.googlecode.com/svn/tags/stacks/octomap_mapping/octomap_mapping-0.3.6'}}, {'hg': {'local-name': 'geometry_tutorials', 'version': 'geometry_tutorials-0.1.3', 'uri': 'https://kforge.ros.org/geometry/tutorials'}}, {'svn': {'local-name': 'prosilica_driver', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/prosilica_driver/tags/prosilica_driver-1.7.1'}}, {'svn': {'local-name': 'camera1394', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/camera1394/tags/camera1394-1.7.0'}}, {'git': {'local-name': 'python_qt_binding', 'version': 'python_qt_binding-0.1.0', 'uri': 'https://kforge.ros.org/visualization/python_qt_binding'}}, {'hg': {'local-name': 'robot_model_tutorials', 'version': 'robot_model_tutorials-0.1.2', 'uri': 'https://kforge.ros.org/robotmodel/tutorials'}}, {'hg': {'local-name': 'pr2_mechanism', 'version': 'pr2_mechanism-1.6.0', 'uri': 'https://kforge.ros.org/pr2mechanism/hg'}}, {'svn': {'local-name': 'joystick_drivers_tutorials', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/joystick_drivers_tutorials/tags/joystick_drivers_tutorials-1.4.1'}}, {'svn': {'local-name': 'slam_gmapping', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/slam_gmapping/tags/slam_gmapping-1.2.6'}}, {'svn': {'local-name': 'pr2_ethercat_drivers', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_ethercat_drivers/tags/pr2_ethercat_drivers-1.7.1'}}, {'svn': {'local-name': 'pr2_arm_navigation_tests', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_arm_navigation_tests/tags/pr2_arm_navigation_tests-0.4.3'}}, {'hg': {'local-name': 'filters', 'version': 'filters-1.6.0', 'uri': 'https://kforge.ros.org/common/filters'}}, {'svn': {'local-name': 'pr2_power_drivers', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_power_drivers/tags/pr2_power_drivers-1.0.9'}}, {'svn': {'local-name': 'wge100_driver', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/wge100_driver/tags/wge100_driver-1.7.2'}}, {'svn': {'local-name': 'joystick_drivers', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/joystick_drivers/tags/joystick_drivers-1.7.0'}}, {'svn': {'local-name': 'pr2_common', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_common/tags/pr2_common-1.7.0'}}, {'hg': {'local-name': 'geometry_experimental', 'version': 'geometry_experimental-0.2.3', 'uri': 'https://kforge.ros.org/geometry/experimental'}}, {'svn': {'local-name': 'visualization', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/visualization/tags/visualization-1.7.6'}}, {'svn': {'local-name': 'camera_drivers', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/camera_drivers/tags/camera_drivers-1.7.1'}}, {'svn': {'local-name': 'vision_opencv', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/vision_opencv/tags/vision_opencv-1.6.10'}}, {'svn': {'local-name': 'perception_pcl', 'uri': 'http://svn.pointclouds.org/ros/tags/perception_pcl_unstable-1.1.5'}}, {'svn': {'local-name': 'rosh_desktop_plugins', 'uri': 'https://code.ros.org/svn/ros/stacks/rosh_desktop_plugins/tags/rosh_desktop_plugins-0.4.0'}}, {'hg': {'local-name': 'executive_smach', 'version': 'executive_smach-1.2.0', 'uri': 'https://kforge.ros.org/smach/executive_smach'}}, {'hg': {'local-name': 'robot_model_visualization', 'version': 'robot_model_visualization-0.1.2', 'uri': 'https://kforge.ros.org/robotmodel/visualization'}}, {'hg': {'local-name': 'rosh_core', 'version': 'rosh_core-0.5.0', 'uri': 'http://kforge.ros.org/rosh/rosh_core'}}, {'svn': {'local-name': 'diagnostics_monitors', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/diagnostics_monitors/tags/diagnostics_monitors-1.4.1'}}, {'svn': {'local-name': 'image_pipeline', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/image_pipeline/tags/image_pipeline-1.6.6'}}, {'hg': {'local-name': 'bfl', 'version': 'bfl-0.1.0', 'uri': 'https://kforge.ros.org/bfl/bfl'}}, {'hg': {'local-name': 'pr2_robot', 'version': 'pr2_robot-1.4.0', 'uri': 'https://kforge.ros.org/pr2robot/hg'}}, {'svn': {'local-name': 'netft', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/netft/tags/netft-0.1.2'}}, {'svn': {'local-name': 'pr2_gui', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_gui/tags/pr2_gui-1.0.3'}}, {'svn': {'local-name': 'visualization_tutorials', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/visualization_tutorials/tags/visualization_tutorials-0.2.3'}}, {'svn': {'local-name': 'linux_networking', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/linux_networking/tags/linux_networking-0.1.14'}}, {'svn': {'local-name': 'roshpit', 'uri': 'https://code.ros.org/svn/ros/stacks/roshpit/tags/roshpit-0.4.1'}}, {'hg': {'local-name': 'common_rosdeps', 'version': 'common_rosdeps-1.0.2', 'uri': 'https://kforge.ros.org/common/rosdepcore'}}, {'hg': {'local-name': 'geometry_visualization', 'version': 'geometry_visualization-0.1.1', 'uri': 'https://kforge.ros.org/geometry/visualization'}}, {'hg': {'local-name': 'pr2_calibration', 'version': 'pr2_calibration-1.0.0', 'uri': 'https://kforge.ros.org/calibration/pr2_calibration'}}, {'svn': {'local-name': 'pr2_kinematics', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_kinematics/tags/pr2_kinematics-0.4.4'}}, {'svn': {'local-name': 'sql_database', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/sql_database/tags/sql_database-0.3.0'}}, {'svn': {'local-name': 'image_common', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/image_common/tags/image_common-1.7.2'}}, {'svn': {'local-name': 'pr2_arm_navigation', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_arm_navigation/tags/pr2_arm_navigation-0.5.0'}}, {'hg': {'local-name': 'audio_common', 'version': 'audio_common-0.1.6', 'uri': 'https://kforge.ros.org/audiocommon/audio_common'}}, {'hg': {'local-name': 'bond_core', 'version': 'bond_core-1.6.3', 'uri': 'https://kforge.ros.org/common/bondcore'}}, {'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': 'rosserial', 'version': 'rosserial-0.2.0', 'uri': 'https://kforge.ros.org/rosserial/hg'}}, {'svn': {'local-name': 'visualization_common', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/visualization_common/tags/visualization_common-1.7.1'}}, {'svn': {'local-name': 'physics_ode', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/physics_ode/tags/physics_ode-1.6.1'}}, {'svn': {'local-name': 'wifi_drivers', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/wifi_drivers/tags/wifi_drivers-0.1.5'}}, {'svn': {'local-name': 'web_interface', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/web_interface/tags/web_interface-0.4.4'}}, {'git': {'local-name': 'qt_ros', 'version': '0.1.1', 'uri': 'https://github.com/stonier/qt_ros.git'}}, {'hg': {'local-name': 'arm_navigation', 'version': 'arm_navigation-1.1.5', 'uri': 'https://kforge.ros.org/armnavigation/armnavigation'}}, {'svn': {'local-name': 'wg_common', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/wg_common/tags/wg_common-0.1.3'}}, {'svn': {'local-name': 'driver_common', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/driver_common/tags/driver_common-1.3.0'}}, {'svn': {'local-name': 'riq_hand', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/riq_hand/tags/riq_hand-0.1.3'}}, {'svn': {'local-name': 'stage', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/stage/tags/stage-1.4.1'}}, {'git': {'local-name': 'dynamic_reconfigure', 'version': 'dynamic_reconfigure-1.4.0', 'uri': 'https://kforge.ros.org/dynamicreconfig/git'}}, {'svn': {'local-name': 'object_manipulation', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/object_manipulation/tags/object_manipulation-0.6.1'}}, {'svn': {'local-name': 'image_transport_plugins', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/image_transport_plugins/tags/image_transport_plugins-1.6.0'}}, {'hg': {'local-name': 'xacro', 'version': 'xacro-1.6.1', 'uri': 'https://kforge.ros.org/common/xacro'}}, {'hg': {'local-name': 'robot_model', 'version': 'robot_model-1.7.1', 'uri': 'https://kforge.ros.org/robotmodel/robot_model'}}, {'hg': {'local-name': 'bullet', 'version': 'bullet-2.79', 'uri': 'https://kforge.ros.org/geometry/bullet'}}, {'hg': {'local-name': 'pluginlib', 'version': 'pluginlib-1.7.2', 'uri': 'https://kforge.ros.org/common/pluginlib'}}, {'hg': {'local-name': 'geometry', 'version': 'geometry-1.7.2', 'uri': 'https://kforge.ros.org/geometry/geometry'}}, {'git': {'local-name': 'orocos_kinematics_dynamics', 'version': 'orocos_kinematics_dynamics-0.2.3', 'uri': 'http://git.mech.kuleuven.be/robotics/orocos_kinematics_dynamics.git'}}, {'hg': {'local-name': 'rosh_robot_plugins', 'version': 'rosh_robot_plugins-0.4.1', 'uri': 'http://kforge.ros.org/rosh/rosh_robot_hg'}}, {'svn': {'local-name': 'documentation', 'uri': 'https://code.ros.org/svn/ros/stacks/documentation/tags/documentation-1.5.1'}}, {'hg': {'local-name': 'openni_kinect', 'version': 'openni_kinect-0.4.0', 'uri': 'https://kforge.ros.org/openni/openni_ros'}}, {'svn': {'local-name': 'pr2_controllers', 'uri': 'https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_controllers/tags/pr2_controllers-1.7.2'}}, {'hg': {'local-name': 'executive_smach_visualization', 'version': 'executive_smach_visualization-1.0.2', 'uri': 'https://kforge.ros.org/smach/visualization'}}, {'hg': {'local-name': 'arm_navigation_experimental', 'version': 'arm_navigation_experimental-0.5.0', 'uri': 'https://kforge.ros.org/armnavigation/experimental'}}, {'svn': {'local-name': 'laser_pipeline', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/laser_pipeline/tags/laser_pipeline-1.4.3'}}, {'hg': {'local-name': 'pr2_navigation', 'version': 'pr2_navigation-0.1.7', 'uri': 'https://kforge.ros.org/pr2navigation/hg'}}, {'hg': {'local-name': 'common', 'version': 'common-1.8.0', 'uri': 'https://kforge.ros.org/common/common'}}, {'svn': {'local-name': 'diagnostics', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/diagnostics/tags/diagnostics-1.6.1'}}, {'svn': {'local-name': 'imu_drivers', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/imu_drivers/tags/imu_drivers-1.3.1'}}, {'svn': {'local-name': 'laser_drivers', 'uri': 'https://code.ros.org/svn/ros-pkg/stacks/laser_drivers/tags/laser_drivers-1.5.1'}}, {'hg': {'local-name': 'navigation', 'version': 'navigation-1.7.2', 'uri': 'https://kforge.ros.org/navigation/navigation'}}, {'svn': {'local-name': 'multimaster_experimental', 'uri': 'https://code.ros.org/svn/ros/stacks/multimaster_experimental/tags/multimaster_experimental-0.1.7'}}] catkin-0.8.0/test/checks/full.rosinstall000066400000000000000000000034261361264727400203060ustar00rootroot00000000000000- git: uri: 'git://github.com/ros/catkin.git' local-name: catkin version: master - git: uri: 'git://github.com/willowgarage/catkin-debs.git' local-name: catkin-debs version: master - git: uri: 'git://github.com/ros/genmsg.git' local-name: genmsg version: master - git: uri: 'git://github.com/ros/gencpp.git' local-name: gencpp version: master - git: uri: 'git://github.com/ros/genpy.git' local-name: genpy version: master - git: uri: 'git://github.com/ros/langs.git' local-name: langs version: master - git: uri: 'git://github.com/ros/langs-dev.git' local-name: langs-dev version: master - git: uri: 'git://github.com/ros/genpybindings.git' local-name: genpybindings version: master - git: uri: 'git://github.com/ros/gentypelibxml.git' local-name: gentypelibxml version: master - git: uri: 'git://github.com/ros/std_msgs.git' local-name: std_msgs version: master - git: uri: 'git://github.com/ros/roscpp_core.git' local-name: roscpp_core version: master - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros_comm/trunk/' local-name: ros_comm - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros_tutorials/trunk/' local-name: ros_tutorials - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' local-name: ros - svn: uri: 'https://code.ros.org/svn/ros-pkg/stacks/common_msgs/trunk' local-name: common_msgs - hg: local-name: rospkg uri: https://kforge.ros.org/rosrelease/rospkg - hg: local-name: rospack uri: https://kforge.ros.org/rosrelease/rospack - svn: local-name: rx uri: https://code.ros.org/svn/ros/stacks/rx/trunk - hg: local-name: actionlib uri: https://kforge.ros.org/common/actionlib catkin-0.8.0/test/checks/incremental_by_stack_build.sh000077500000000000000000000020701361264727400231200ustar00rootroot00000000000000#!/usr/bin/env bash -ex # Helper script to use an existing catkin workspace and call # cmake, make install, for each package inside TOP=$(cd `dirname $0` ; pwd) [ $# -eq 2 ] || { /bin/echo "usage: $0 [srcdir] [scratchdir]" ; exit 1 ; } SRC=$1 cd $SRC SRC=$(/bin/pwd) cd .. SCRATCHDIR=$2 mkdir -p $SCRATCHDIR || /bin/true cd $SCRATCHDIR SCRATCHDIR=$(/bin/pwd) #abspath cd .. BUILD=$SCRATCHDIR/build mkdir -p $BUILD INSTALL=$SCRATCHDIR/install mkdir -p $INSTALL #EAR: CMAKE_PREFIX_PATH appears to be ignored if passed as a cmake variable... export CMAKE_PREFIX_PATH=$INSTALL CMAKE="cmake -DCMAKE_PREFIX_PATH=$INSTALL -DCMAKE_INSTALL_PREFIX=$INSTALL" # calls cmake, make, make install on one package doone () { pkg=$1 mkdir -p $BUILD/$pkg cd $BUILD/$pkg $CMAKE $SRC/$proj make -j8 make install cd .. } for proj in catkin rospkg rospack ros genmsg gencpp genpy genpybindings gentypelibxml roscpp_core std_msgs common_msgs ros_comm ros_tutorials do /bin/echo "\n\n\n======================= $proj =======================" doone $proj done catkin-0.8.0/test/checks/make_enmasse_dscs.sh000077500000000000000000000013221361264727400212240ustar00rootroot00000000000000#!/usr/bin/env bash -ex # this script deletes all of /opt/ros/fuerte and then runs cmake + gendebian TOP=$(cd `dirname $0` ; pwd) . $TOP/catkin-test.sh 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-" DESTDIR=$TOP/DESTDIR CATKIN_DEB_SNAPSHOT_VERSION=$(date +%Y%m%d-%H%M%z) export CATKIN_DEB_SNAPSHOT_VERSION cleanup cd $BUILD $CMAKE '-DCATKIN_DPKG_BUILDPACKAGE_FLAGS=-d;-S;-kBE0A7693' $SRC for distro in lucid maverick natty oneiric precise do make VERBOSE=1 \ CATKIN_DEB_SNAPSHOT_VERSION=$CATKIN_DEB_SNAPSHOT_VERSION \ CATKIN_DEBIAN_DISTRIBUTION=$distro \ gendebian done catkin-0.8.0/test/checks/make_packages.sh000077500000000000000000000061721361264727400203430ustar00rootroot00000000000000#!/usr/bin/env bash -ex TOP=$(cd `dirname $0` ; pwd) CATKIN_DEB_SNAPSHOT_VERSION=-$(date +%Y%m%d-%H%M%z) export CATKIN_DEB_SNAPSHOT_VERSION CMAKE="cmake -DCATKIN_PACKAGE_PREFIX=ros-fuerte- -DCATKIN_DEB_SNAPSHOTS=YES -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte -DCMAKE_PREFIX_PATH=/opt/ros/fuerte -DCATKIN=YES" CHROOTDIR="/home/chroot/natty-amd64" BUILDDIR=$TOP/debbuild SRCDIR=$TOP/src rm -rf $BUILDDIR || /bin/false mkdir -p $BUILDDIR || /bin/false REPODIR=$TOP/apt SCHROOT="sudo schroot -d / -c natty-amd64" SBUILD="sudo sbuild -A -m straszheim@willowgarage.com -d natty" MAKE="make VERBOSE=1" sudo mount --bind $REPODIR $CHROOTDIR/mnt/apt || /bin/true scanrepo () { if [ `dirname $1` != $REPODIR ] ; then cp $1 $REPODIR fi pushd $REPODIR [ -d conf ] || mkdir conf cat > conf/distributions < /tmp/localrepo.list sudo cp /tmp/localrepo.list $CHROOTDIR/etc/apt/sources.list.d $SCHROOT apt-get update } cleanrepo () { rm -f /tmp/tmprepo/*.deb || /bin/true mkdir -p /tmp/tmprepo shopt -s nullglob for f in $REPODIR/*.deb ; do echo ">>> $f" cp $f /tmp/tmprepo done rm -rf $REPODIR/* sudo rm -f $CHROOTDIR/etc/apt/sources.list.d/localrepo.list $SCHROOT apt-get update gpg -a --export BE0A7693 > $CHROOTDIR/tmp/straszheim.key gpg -a --export BE0A7693 | $SCHROOT apt-key add - for f in /tmp/tmprepo/*.deb ; do cp $f $REPODIR done shopt -u nullglob } #cleanrepo sudo dpkg -r ros-fuerte\* || /bin/true sudo rm -rf /opt/ros/fuerte || /bin/true sudo rm $REPODIR/*.deb || /bin/true do_one () { dirname=$1 debname=$2 debversion=$3 debplatform=$4 fulldebname=ros-fuerte-${debname}_${debversion}~natty_${debplatform}.deb if [ -f $REPODIR/$fulldebname ] ; then sudo dpkg -i $REPODIR/$fulldebname scanrepo $REPODIR/$fulldebname return fi SRC=$SRCDIR/$dirname pushd $SRC [ -d .git ] && git clean -dfx popd mkdir $BUILDDIR/$dirname cd $BUILDDIR/$dirname rm -f CMakeCache.txt $CMAKE $SRC for d in lucid maverick natty oneiric do $MAKE CATKIN_DEBIAN_DISTRIBUTION=$d ${dirname}-gendebian done $MAKE ${dirname}-gendebian sudo sbuild -A -d natty $SRCDIR/ros-fuerte-${debname}_${debversion}${CATKIN_DEB_SNAPSHOT_VERSION}~natty.dsc sudo dpkg -i ros-fuerte-${debname}_${debversion}${CATKIN_DEB_SNAPSHOT_VERSION}~natty_${debplatform}.deb scanrepo ros-fuerte-${debname}_${debversion}${CATKIN_DEB_SNAPSHOT_VERSION}~natty_${debplatform}.deb dput ppa:straszheim/ros $SRCDIR/ros-fuerte-${debname}_${debversion}${CATKIN_DEB_SNAPSHOT_VERSION}~natty_source.changes } do_one catkin catkin 3.4.5 all do_one genmsg genmsg 3.4.5 all do_one gencpp gencpp 3.4.5 all do_one genpy genpy 3.4.5 all do_one std_msgs std-msgs 3.4.5 all do_one common_msgs common-msgs 3.4.5 all do_one roscpp_core roscpp-core 3.4.5 amd64 do_one ros_comm ros-comm 3.4.5 amd64 catkin-0.8.0/test/checks/make_quick.sh000077500000000000000000000031001361264727400176650ustar00rootroot00000000000000#!/usr/bin/env bash -ex # helper script that make installs ros fuerte core stacks # using cmake and make to /opt/ros/fuerte echo "!!!!!!!!!!!!!!! DO NOT PROCEED UNLESS YOU KNOW WHAT YOU ARE DOING !!!!!!!!!" echo "This script completely removes /opt/ros/fuerte and reinstalls catkin stacks from source" echo -n "Please confirm (y or n) :" read CONFIRM case $CONFIRM in y|Y|YES|yes|Yes) ;; *) echo Aborting - you entered $CONFIRM exit ;; esac TOP=$(cd `dirname $0` ; pwd) BUILD=$TOP/pkgbuild PREFIX=$1 CMAKE="cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCATKIN=YES -DCATKIN_LOG=2" DESTDIR=$TOP/DESTDIR sudo dpkg -r ros-fuerte\* || /bin/true sudo rm -rf /opt/ros/fuerte/* || /bin/true sudo mkdir -p /opt/ros/fuerte sudo chown -R `whoami` /opt/ros/fuerte rm -rf $BUILD mkdir -p $BUILD cd $BUILD SRC=$TOP/src rm $SRC/*.tar.gz $SRC/*.deb $SRC/*.changes $SRC/*.dsc || /bin/true doone () { pkg=$1 mkdir $BUILD/$pkg pushd $BUILD/$pkg SRC=../../src/$pkg $CMAKE $SRC make VERBOSE=1 make VERBOSE=1 install for distro in lucid maverick natty oneiric do make CATKIN_DEBIAN_DISTRIBUTION=$distro $pkg-gendebian done popd } fatbuild () { mkdir $BUILD/buildall pushd $BUILD/buildall cmake ../../src -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte make make install popd } fatbuild doone catkin doone genmsg doone gencpp doone genpy doone genpybindings doone gentypelibxml doone std_msgs doone common_msgs doone rospack doone ros doone roscpp_core doone nolangs doone catkin_test doone ros_comm doone ros_tutorials catkin-0.8.0/test/checks/release_repos.yaml000066400000000000000000000022241361264727400207370ustar00rootroot00000000000000- git: uri: 'git@github.com:wg-debs/genmsg-release.git' local-name: genmsg version: master - git: uri: 'git@github.com:wg-debs/gencpp-release.git' local-name: gencpp version: master - git: uri: 'git@github.com:wg-debs/genpy-release.git' local-name: genpy version: master - git: uri: 'git@github.com:wg-debs/ros-release.git' local-name: ros version: master - git: uri: 'git@github.com:wg-debs/std_msgs-release.git' local-name: std_msgs version: master - git: uri: 'git@github.com:wg-debs/roscpp_core-release.git' local-name: roscpp_core version: master - git: uri: 'git@github.com:wg-debs/catkin-release.git' local-name: catkin version: master - git: uri: 'git@github.com:wg-debs/common_msgs-release.git' local-name: common_msgs version: master - git: uri: 'git@github.com:wg-debs/rospack-release.git' local-name: rospack version: master - git: uri: 'git@github.com:wg-debs/ros_comm-release.git' local-name: ros_comm version: master - git: uri: 'git@github.com:wg-debs/langs-release.git' local-name: langs version: master catkin-0.8.0/test/checks/test-nocatkin.rosinstall000066400000000000000000000031101361264727400221150ustar00rootroot00000000000000# - git: # uri: 'git://github.com/willowgarage/catkin-debs.git' # local-name: catkin_debs # version: master - git: uri: 'git://github.com/ros/genmsg.git' local-name: genmsg version: master - git: uri: 'git://github.com/ros/gencpp.git' local-name: gencpp version: master - git: uri: 'git://github.com/ros/genlisp.git' local-name: genlisp version: master - git: uri: 'git://github.com/ros/genpy.git' local-name: genpy version: master - git: uri: 'git://github.com/ros/langs.git' local-name: langs version: master - git: uri: 'git://github.com/ros/langs-dev.git' local-name: langs-dev version: master - git: uri: 'git://github.com/ros/std_msgs.git' local-name: std_msgs version: master - git: uri: 'git://github.com/ros/roscpp_core.git' local-name: roscpp_core version: master - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros_comm/trunk/' local-name: ros_comm - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros_tutorials/trunk/' local-name: ros_tutorials - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' local-name: ros - svn: uri: 'https://code.ros.org/svn/ros-pkg/stacks/common_msgs/trunk' local-name: common_msgs - hg: local-name: rospkg uri: https://kforge.ros.org/rosrelease/rospkg - hg: local-name: rospack uri: https://kforge.ros.org/rosrelease/rospack - svn: local-name: rx uri: https://code.ros.org/svn/ros/stacks/rx/trunk - hg: local-name: actionlib uri: https://kforge.ros.org/common/actionlib catkin-0.8.0/test/checks/unstable/000077500000000000000000000000001361264727400170405ustar00rootroot00000000000000catkin-0.8.0/test/checks/unstable/desktop-overlay.rosinstall000066400000000000000000000011111361264727400242760ustar00rootroot00000000000000[{'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'}}] catkin-0.8.0/test/checks/unstable/extras.rosinstall000066400000000000000000000043121361264727400224620ustar00rootroot00000000000000- svn: local-name: visualization uri: https://code.ros.org/svn/ros-pkg/stacks/visualization/tags/visualization-1.7.4 - svn: local-name: rx uri: https://code.ros.org/svn/ros/stacks/rx/tags/rx-1.6.2 - svn: local-name: visualization_common uri: https://code.ros.org/svn/ros-pkg/stacks/visualization_common/tags/visualization_common-1.7.0 - svn: local-name: laser_pipeline uri: https://code.ros.org/svn/ros-pkg/stacks/laser_pipeline/tags/laser_pipeline-1.4.3 - hg: local-name: pluginlib uri: https://kforge.ros.org/common/pluginlib version: pluginlib-1.7.0 - hg: local-name: geometry uri: https://kforge.ros.org/geometry/geometry version: geometry-1.7.1 - hg: local-name: bullet uri: https://kforge.ros.org/geometry/bullet version: bullet-2.79 - git: local-name: orocos_kinematics_dynamics uri: http://git.mech.kuleuven.be/robotics/orocos_kinematics_dynamics.git version: orocos_kinematics_dynamics-0.2.3 - hg: local-name: common_rosdeps uri: https://kforge.ros.org/common/rosdepcore version: common_rosdeps-1.0.2 - hg: local-name: filters uri: https://kforge.ros.org/common/filters version: filters-1.6.0 - hg: local-name: robot_model uri: https://kforge.ros.org/robotmodel/robot_model version: robot_model-1.7.1 - svn: local-name: image_common uri: https://code.ros.org/svn/ros-pkg/stacks/image_common/tags/image_common-1.7.0 - hg: local-name: common uri: https://kforge.ros.org/common/common version: common-1.8.0 - hg: local-name: nodelet_core uri: https://kforge.ros.org/common/nodeletcore version: nodelet_core-1.5.0 - hg: local-name: bond_core uri: https://kforge.ros.org/common/bondcore version: bond_core-1.6.3 - svn: local-name: perception_pcl uri: http://svn.pointclouds.org/ros/tags/perception_pcl_unstable-1.1.2 - svn: local-name: driver_common uri: https://code.ros.org/svn/ros-pkg/stacks/driver_common/tags/driver_common-1.2.3 - svn: local-name: diagnostics uri: https://code.ros.org/svn/ros-pkg/stacks/diagnostics/tags/diagnostics-1.6.1 - hg: local-name: eigen uri: https://kforge.ros.org/geometry/eigen version: eigen-1.6.0 catkin-0.8.0/test/local_tests/000077500000000000000000000000001361264727400162775ustar00rootroot00000000000000catkin-0.8.0/test/local_tests/__init.py000066400000000000000000000000001361264727400201000ustar00rootroot00000000000000catkin-0.8.0/test/local_tests/test_with_mock_workspace.py000066400000000000000000000131311361264727400237510ustar00rootroot00000000000000#!/usr/bin/env python import os import shutil import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) from test.utils import AbstractCatkinWorkspaceTest # noqa: E402, I202 from test.utils import MAKE_CMD # noqa: E402 from test.utils import MOCK_DIR # noqa: E402 from test.utils import assert_exists # noqa: E402 from test.utils import fail # noqa: E402 from test.utils import succeed # noqa: E402 import em # noqa: E402 class MockTest(AbstractCatkinWorkspaceTest): """This test case uses workspaces with catkin projects from the test/mock_resources folder.""" # uncomment to keep temporary files in /tmp # def tearDown(self): # pass def test_catkin_only(self): self.cmake() succeed(MAKE_CMD, cwd=self.builddir) succeed(MAKE_CMD + ['install'], cwd=self.builddir) assert_exists(self.installdir, 'env.sh', 'setup.sh', 'setup.zsh') def test_linker_options_propagation(self): dstdir = os.path.join(self.workspacedir, 'linker_options') shutil.copytree(os.path.join(MOCK_DIR, 'src', 'linker_options'), dstdir) self.cmake() succeed(MAKE_CMD, cwd=self.builddir) succeed(MAKE_CMD + ['install'], cwd=self.builddir) assert_exists(self.installdir, 'env.sh', 'setup.sh', 'setup.zsh') def test_nolang(self): dstdir = os.path.join(self.workspacedir, 'nolangs') shutil.copytree(os.path.join(MOCK_DIR, 'src', 'nolangs'), dstdir) self.cmake(CATKIN_WHITELIST_PACKAGES='nolangs', CATKIN_DPKG_BUILDPACKAGE_FLAGS='-d;-S;-us;-uc') self.assertTrue(os.path.exists(self.builddir + '/nolangs')) self.assertFalse(os.path.exists(self.builddir + '/std_msgs')) self.assertFalse(os.path.exists(self.builddir + '/genmsg')) succeed(MAKE_CMD, cwd=self.builddir) self.assertTrue(os.path.exists(self.builddir + '/nolangs/bin/nolangs_exec')) succeed(MAKE_CMD + ['install'], cwd=self.builddir) assert_exists(self.installdir, 'bin/nolangs_exec', 'share/nolangs/cmake/nolangsConfig.cmake') # also test make help succeed(MAKE_CMD + ['help'], cwd=self.builddir) def test_noproject(self): # create workspace with just catkin and 'noproject' project dstdir = os.path.join(self.workspacedir, 'noproject') shutil.copytree(os.path.join(MOCK_DIR, 'src-fail', 'noproject'), dstdir) # test with whitelist out = self.cmake(CATKIN_WHITELIST_PACKAGES='catkin') out = succeed(MAKE_CMD + ['install'], cwd=self.builddir) shutil.rmtree(self.builddir) # fail if we try to build noproject stack os.makedirs(self.builddir) out = self.cmake(CMAKE_PREFIX_PATH=self.installdir, expect=fail) print('failed as expected, out={}'.format(out)) self.assertTrue(b"catkin_package() PROJECT_NAME is set to 'Project'" in out, out) # assert 'You must call project() with the same name before.' in out # Test was not finished apparently # def test_help_bad_changelog(self): # self.cmake(CATKIN_ENABLE_DEBBUILDING='TRUE', # CMAKE_PREFIX_PATH=diskprefix, # srcdir=os.path.join(MOCK_DIR, # 'src-fail', 'badly_specified_changelog'), # CATKIN='YES') # succeed(MAKE_CMD + ['help'], cwd=self.builddir) def test_env_cached_static(self): # hack to fix empy nosetests clash sys.stdout = em.ProxyFile(sys.stdout) dstdir = os.path.join(self.workspacedir, 'catkin_test') shutil.copytree(os.path.join(MOCK_DIR, 'src', 'catkin_test'), dstdir) template_file = os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'em', 'order_packages.cmake.em') with open(template_file, 'r') as fhand: template = fhand.read() gdict = {'CATKIN_DEVEL_PREFIX': '/foo', 'CMAKE_PREFIX_PATH': ['/bar'], 'CATKIN_GLOBAL_LIB_DESTINATION': '/glob-dest/lib', 'CATKIN_GLOBAL_BIN_DESTINATION': '/glob-dest/bin', 'PYTHON_INSTALL_DIR': '/foo/dist-packages'} result = em.expand(template, gdict, source_root_dir=self.workspacedir, whitelisted_packages=None, blacklisted_packages=None, underlay_workspaces=None) self.assertTrue('set(CATKIN_ORDERED_PACKAGES "")' in result, result) self.assertTrue('set(CATKIN_ORDERED_PACKAGE_PATHS "")' in result, result) self.assertTrue('set(CATKIN_ORDERED_PACKAGES_IS_META "")' in result, result) self.assertTrue('set(CATKIN_MESSAGE_GENERATORS' in result, result) self.assertTrue("""\ list(APPEND CATKIN_ORDERED_PACKAGES "catkin_test") list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "catkin_test/catkin_test") list(APPEND CATKIN_ORDERED_PACKAGES_IS_META "True") list(APPEND CATKIN_ORDERED_PACKAGES_BUILD_TYPE "catkin")""" in result, result) self.assertTrue("""\ list(APPEND CATKIN_ORDERED_PACKAGES "a") list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "catkin_test/a") list(APPEND CATKIN_ORDERED_PACKAGES_IS_META "False") list(APPEND CATKIN_ORDERED_PACKAGES_BUILD_TYPE "catkin")""" in result, result) # catkin itself filtered out self.assertFalse('list(APPEND CATKIN_ORDERED_PACKAGES "catkin"' in result, result) self.assertEqual(38, len(result.splitlines())) catkin-0.8.0/test/mock_resources/000077500000000000000000000000001361264727400170065ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src-fail/000077500000000000000000000000001361264727400205065ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src-fail/.gitignore000066400000000000000000000000501361264727400224710ustar00rootroot00000000000000badly_specified_changelog/debian/controlcatkin-0.8.0/test/mock_resources/src-fail/badly_specified_changelog/000077500000000000000000000000001361264727400256235ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src-fail/badly_specified_changelog/CMakeLists.txt000066400000000000000000000001611361264727400303610ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) project(badly_specified_changelog) find_package(catkin) catkin_package() catkin-0.8.0/test/mock_resources/src-fail/badly_specified_changelog/package.xml000066400000000000000000000005171361264727400277430ustar00rootroot00000000000000 badly_specified_changelog 0.0.0 foo Somebody Somebody Unknown Someone catkin catkin-0.8.0/test/mock_resources/src-fail/noproject/000077500000000000000000000000001361264727400225115ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src-fail/noproject/CMakeLists.txt000066400000000000000000000002001361264727400252410ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) # commented to cause failure # project(noproject) find_package(catkin) catkin_package() catkin-0.8.0/test/mock_resources/src-fail/noproject/package.xml000066400000000000000000000004361361264727400246310ustar00rootroot00000000000000 noproject 3.4.5 foo Somebody Somebody Unknown catkin catkin-0.8.0/test/mock_resources/src/000077500000000000000000000000001361264727400175755ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/.gitignore000066400000000000000000000004541361264727400215700ustar00rootroot00000000000000actionlib catkin catkin-debs CMakeLists.txt common_msgs gencpp genlisp genmsg genpy genpybindings gentypelibxml langs langs-dev nolangs/debian ros ros_comm roscpp_core rosdep_rules rospack rospkg ros_tutorials rx setup.bash setup.sh setup.zsh std_msgs .rosinstall.bak *.changes *.deb *.dsc *.tar.gz catkin-0.8.0/test/mock_resources/src/catkin_test/000077500000000000000000000000001361264727400221055ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/.gitignore000066400000000000000000000000131361264727400240670ustar00rootroot00000000000000._* *.pyc catkin-0.8.0/test/mock_resources/src/catkin_test/CMakeLists.txt000066400000000000000000000004151361264727400246450ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(catkin_test) find_package(catkin REQUIRED) find_package(genmsg REQUIRED) find_package(std_msgs REQUIRED) foreach(subdir quux_msgs quux_user a b c d ) add_subdirectory(${subdir}) endforeach() catkin-0.8.0/test/mock_resources/src/catkin_test/README000066400000000000000000000000001361264727400227530ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/000077500000000000000000000000001361264727400223255ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/CMakeLists.txt000066400000000000000000000004441361264727400250670ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(a) find_package(catkin REQUIRED COMPONENTS genmsg std_msgs) add_message_files( DIRECTORY msg FILES AMsg.msg ) generate_messages(DEPENDENCIES std_msgs) catkin_package( INCLUDE_DIRS include LIBRARIES a ) add_library(a SHARED lib.cpp) catkin-0.8.0/test/mock_resources/src/catkin_test/a/include/000077500000000000000000000000001361264727400237505ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/include/a/000077500000000000000000000000001361264727400241705ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/include/a/foo.hpp000066400000000000000000000000531361264727400254620ustar00rootroot00000000000000#pragma once namespace a { void foo(); } catkin-0.8.0/test/mock_resources/src/catkin_test/a/lib.cpp000066400000000000000000000001461361264727400236000ustar00rootroot00000000000000#include namespace a { void foo() { std::cout << __PRETTY_FUNCTION__ << "\n"; } } catkin-0.8.0/test/mock_resources/src/catkin_test/a/msg/000077500000000000000000000000001361264727400231135ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/msg/AMsg.msg000066400000000000000000000000451361264727400244510ustar00rootroot00000000000000std_msgs/Float64 f64 std_msgs/Bool b catkin-0.8.0/test/mock_resources/src/catkin_test/a/package.xml000066400000000000000000000007301361264727400244420ustar00rootroot00000000000000 a 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/a/src/000077500000000000000000000000001361264727400231145ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/src/a/000077500000000000000000000000001361264727400233345ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/a/src/a/__init__.py000066400000000000000000000001221361264727400254400ustar00rootroot00000000000000import std_msgs.msg s = std_msgs.msg.String() print('<<< a >>>') print(type(s)) catkin-0.8.0/test/mock_resources/src/catkin_test/b/000077500000000000000000000000001361264727400223265ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/CMakeLists.txt000066400000000000000000000006261361264727400250720ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(b) find_package(catkin REQUIRED) catkin_package( INCLUDE_DIRS include LIBRARIES b ) find_package(a) include_directories(${a_INCLUDE_DIRS}) add_library(b SHARED lib.cpp) target_link_libraries(b ${a_LIBRARIES}) add_message_files( DIRECTORY msg FILES BMsg.msg ) # catkin_python_setup() # enable_python(b) # generate_messages(DEPENDENCIES std_msgs) catkin-0.8.0/test/mock_resources/src/catkin_test/b/include/000077500000000000000000000000001361264727400237515ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/include/b/000077500000000000000000000000001361264727400241725ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/include/b/foo.hpp000066400000000000000000000000531361264727400254640ustar00rootroot00000000000000#pragma once namespace b { void foo(); } catkin-0.8.0/test/mock_resources/src/catkin_test/b/lib.cpp000066400000000000000000000002121361264727400235730ustar00rootroot00000000000000#include #include namespace b { void foo() { a::foo(); std::cout << __PRETTY_FUNCTION__ << "\n"; } } catkin-0.8.0/test/mock_resources/src/catkin_test/b/msg/000077500000000000000000000000001361264727400231145ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/msg/BMsg.msg000066400000000000000000000000601361264727400244500ustar00rootroot00000000000000std_msgs/String string1 std_msgs/String string2 catkin-0.8.0/test/mock_resources/src/catkin_test/b/package.xml000066400000000000000000000007301361264727400244430ustar00rootroot00000000000000 b 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/b/src/000077500000000000000000000000001361264727400231155ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/src/b/000077500000000000000000000000001361264727400233365ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/b/src/b/__init__.py000066400000000000000000000002011361264727400254400ustar00rootroot00000000000000import a.msg import b.msg import std_msgs.msg s = std_msgs.msg.String() a = a.msg.AMsg() b = b.msg.BMsg() print('<<< b >>>') catkin-0.8.0/test/mock_resources/src/catkin_test/c/000077500000000000000000000000001361264727400223275ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/CMakeLists.txt000066400000000000000000000007711361264727400250740ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(c) find_package(catkin REQUIRED) catkin_package( INCLUDE_DIRS include LIBRARIES c-one c-two ) find_package(a) include_directories(${a_INCLUDE_DIRS}) add_library(c-one SHARED lib.cpp) add_library(c-two SHARED lib.cpp) target_link_libraries(c-one ${a_LIBRARIES}) target_link_libraries(c-two ${a_LIBRARIES}) add_message_files( DIRECTORY msg FILES CMsg.msg ) # catkin_python_setup() # enable_python(c) # generate_messages(DEPENDENCIES std_msgs a) catkin-0.8.0/test/mock_resources/src/catkin_test/c/include/000077500000000000000000000000001361264727400237525ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/include/c/000077500000000000000000000000001361264727400241745ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/include/c/foo.hpp000066400000000000000000000000531361264727400254660ustar00rootroot00000000000000#pragma once namespace c { void foo(); } catkin-0.8.0/test/mock_resources/src/catkin_test/c/lib.cpp000066400000000000000000000002111361264727400235730ustar00rootroot00000000000000#include #include namespace c { void foo() { a::foo(); std::cout << __PRETTY_FUNCTION__ << "\n"; } } catkin-0.8.0/test/mock_resources/src/catkin_test/c/msg/000077500000000000000000000000001361264727400231155ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/msg/CMsg.msg000066400000000000000000000000361361264727400244550ustar00rootroot00000000000000std_msgs/String s a/AMsg amsg catkin-0.8.0/test/mock_resources/src/catkin_test/c/package.xml000066400000000000000000000007301361264727400244440ustar00rootroot00000000000000 c 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/c/src/000077500000000000000000000000001361264727400231165ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/src/c/000077500000000000000000000000001361264727400233405ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/c/src/c/__init__.py000066400000000000000000000000231361264727400254440ustar00rootroot00000000000000print('IMPORTING') catkin-0.8.0/test/mock_resources/src/catkin_test/catkin_test/000077500000000000000000000000001361264727400244155ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/catkin_test/package.xml000066400000000000000000000010321361264727400265260ustar00rootroot00000000000000 catkin_test 3.4.5 foo Somebody Somebody Unknown catkin catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/changelog.em000066400000000000000000000003071361264727400243570ustar00rootroot00000000000000@(CATKIN_PACKAGE_PREFIX)catkin-test (@(Version)@(SnapshotVersion)~@(Distribution)) @(Distribution); urgency=high * These are custom rules generated via empy and python -- @(Maintainer) @(Date) catkin-0.8.0/test/mock_resources/src/catkin_test/d/000077500000000000000000000000001361264727400223305ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/CMakeLists.txt000066400000000000000000000007641361264727400250770ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(d) find_package(catkin REQUIRED) catkin_package( INCLUDE_DIRS include LIBRARIES d ) find_package(c) find_package(b) find_package(a) include_directories(${b_INCLUDE_DIRS}) include_directories(${c_INCLUDE_DIRS}) add_library(d SHARED lib.cpp) target_link_libraries(d ${b_LIBRARIES} ${c_LIBRARIES}) add_message_files( DIRECTORY msg FILES DMsg.msg ) # catkin_python_setup() # enable_python(d) # generate_messages(DEPENDENCIES std_msgs b c a) catkin-0.8.0/test/mock_resources/src/catkin_test/d/include/000077500000000000000000000000001361264727400237535ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/include/d/000077500000000000000000000000001361264727400241765ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/include/d/foo.hpp000066400000000000000000000000531361264727400254700ustar00rootroot00000000000000#pragma once namespace d { void foo(); } catkin-0.8.0/test/mock_resources/src/catkin_test/d/lib.cpp000066400000000000000000000002551361264727400236040ustar00rootroot00000000000000#include #include #include namespace d { void foo() { b::foo(); c::foo(); std::cout << __PRETTY_FUNCTION__ << "\n"; } } catkin-0.8.0/test/mock_resources/src/catkin_test/d/msg/000077500000000000000000000000001361264727400231165ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/msg/DMsg.msg000066400000000000000000000000521361264727400244550ustar00rootroot00000000000000std_msgs/String s b/BMsg bmsg c/CMsg cmsg catkin-0.8.0/test/mock_resources/src/catkin_test/d/package.xml000066400000000000000000000007301361264727400244450ustar00rootroot00000000000000 d 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/d/src/000077500000000000000000000000001361264727400231175ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/src/d/000077500000000000000000000000001361264727400233425ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/d/src/d/__init__.py000066400000000000000000000000231361264727400254460ustar00rootroot00000000000000print('IMPORTING') catkin-0.8.0/test/mock_resources/src/catkin_test/quux_msgs/000077500000000000000000000000001361264727400241405ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/quux_msgs/CMakeLists.txt000066400000000000000000000004161361264727400267010ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(quux_msgs) find_package(catkin REQUIRED) find_package(genmsg REQUIRED) find_package(std_msgs REQUIRED) add_message_files( DIRECTORY msg FILES QuuxString.msg ) generate_messages(DEPENDENCIES std_msgs) catkin_package() catkin-0.8.0/test/mock_resources/src/catkin_test/quux_msgs/msg/000077500000000000000000000000001361264727400247265ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/quux_msgs/msg/QuuxString.msg000066400000000000000000000000601361264727400275630ustar00rootroot00000000000000std_msgs/String string1 std_msgs/String string2 catkin-0.8.0/test/mock_resources/src/catkin_test/quux_msgs/package.xml000066400000000000000000000007401361264727400262560ustar00rootroot00000000000000 quux_msgs 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/000077500000000000000000000000001361264727400241455ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/CMakeLists.txt000066400000000000000000000023731361264727400267120ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(quux_user) find_package(catkin REQUIRED) catkin_package() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) find_package(quux_msgs) assert(quux_msgs_INCLUDE_DIRS) include_directories(${quux_msgs_INCLUDE_DIRS}) find_package(rostime) include_directories(${rostime_INCLUDE_DIRS}) assert(rostime_INCLUDE_DIRS) assert(rostime_LIBRARIES) find_package(cpp_common) include_directories(${cpp_common_INCLUDE_DIRS}) find_package(roscpp_traits) include_directories(${roscpp_traits_INCLUDE_DIRS}) find_package(roscpp_serialization) include_directories(${roscpp_serialization_INCLUDE_DIRS}) assert(roscpp_serialization_LIBRARIES) find_package(sensor_msgs) include_directories(${sensor_msgs_INCLUDE_DIRS}) include_directories(${std_msgs_INCLUDE_DIRS} ${quux_msgs_INCLUDE_DIRS}) add_executable(quux_user-exec src/main.cpp) add_dependencies(quux_user-exec ${sensor_msgs_EXPORTED_TARGETS}) message(STATUS ${roscpp_serialization_LIBRARIES}) target_link_libraries(quux_user-exec ${roscpp_serialization_LIBRARIES} ${rostime_LIBRARIES}) add_executable(quux_srv-exec src/srv_test.cpp) target_link_libraries(quux_srv-exec ${roscpp_serialization_LIBRARIES}) add_dependencies(quux_srv-exec ${sensor_msgs_EXPORTED_TARGETS}) catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/package.xml000066400000000000000000000007401361264727400262630ustar00rootroot00000000000000 quux_user 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy std_msgs ros_comm catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/src/000077500000000000000000000000001361264727400247345ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/src/main.cpp000066400000000000000000000011371361264727400263660ustar00rootroot00000000000000#include int main() { sensor_msgs::PointCloud2 pc_1; pc_1.width = 10; pc_1.height = 20; // todo set other stuff std::cout << "PointCloud2 message: " << std::endl << pc_1 << std::endl; uint8_t buf[1024]; ros::serialization::OStream out(buf, sizeof(buf) ); ros::serialization::serialize(out, pc_1); std::cout << "Message Was Serialized" << std::endl; sensor_msgs::PointCloud2 pc_2; ros::serialization::IStream in(buf, sizeof(buf) ); ros::serialization::deserialize(in, pc_2); std::cout << "Its a message again: " << std::endl << pc_2 << std::endl; } catkin-0.8.0/test/mock_resources/src/catkin_test/quux_user/src/srv_test.cpp000066400000000000000000000011531361264727400273110ustar00rootroot00000000000000#include int main() { sensor_msgs::SetCameraInfo srv; srv.response.status_message = std::string("Some Text"); std::cout << "Srv Response Msg: " << std::endl << srv.response << std::endl; uint8_t buf[1024]; ros::serialization::OStream out(buf, sizeof(buf) ); ros::serialization::serialize(out, srv.response); std::cout << "Its Serialized" << std::endl; sensor_msgs::SetCameraInfo::Response msg2; ros::serialization::IStream in(buf, sizeof(buf) ); ros::serialization::deserialize(in, msg2); std::cout << "Im a message again: " << std::endl << msg2 << std::endl; } catkin-0.8.0/test/mock_resources/src/catkin_test/rules.em000066400000000000000000000005131361264727400235610ustar00rootroot00000000000000#!/usr/bin/make -f # THESE ARE CUSTOM RULES export DH_VERBOSE=1 export DH_OPTIONS=-v %: dh $@@ override_dh_auto_configure: dh_auto_configure -Scmake -- \ -DCMAKE_INSTALL_PREFIX="@(CMAKE_INSTALL_PREFIX)" \ -DCMAKE_PREFIX_PATH="@(CMAKE_PREFIX_PATH)" \ -DCATKIN_PACKAGE_PREFIX="@(CATKIN_PACKAGE_PREFIX)" \ -DCATKIN=YES catkin-0.8.0/test/mock_resources/src/catkin_test/stack.yaml000066400000000000000000000011651361264727400241010ustar00rootroot00000000000000Package: catkin-test Version: 3.4.5 Section: misc Priority: extra Architecture: all Depends: python-empy, cmake, make, catkin, genmsg, genpy, gencpp, std_msgs, roscpp_core, common_msgs Description: Willow Garage low level build system macros and infrastructure Author: Troy Straszheim , Morten Kjaergaard, Ken Conley Maintainer: Troy Straszheim Homepage: http://www.ros.org Catkin-ProjectName: catkin_test Catkin-CopyrightType: willowgarage Catkin-Depends: catkin, genmsg, common_msgs, roscpp_core Catkin-DebRulesType: +rules.em Catkin-ChangelogType: +changelog.em catkin-0.8.0/test/mock_resources/src/linker_options/000077500000000000000000000000001361264727400226345ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/000077500000000000000000000000001361264727400234235ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/leaf_pkg/000077500000000000000000000000001361264727400251735ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/leaf_pkg/CMakeLists.txt000066400000000000000000000010031361264727400277250ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) project(leaf_pkg) find_package(catkin REQUIRED COMPONENTS root_pkg) add_executable(leaf leaf.cpp) target_link_libraries(leaf ${catkin_LIBRARIES}) target_include_directories(leaf PUBLIC ${catkin_INCLUDE_DIRS}) catkin_package() list(LENGTH catkin_LIBRARIES size) math(EXPR size_is_not_3 "${size} - 3") if (size_is_not_3) message(FATAL_ERROR "Wrong size for catkin_LIBRARIES: ${catkin_LIBRARIES} : ${size}") else() message(STATUS "All is OK: ${catkin_LIBRARIES}") endif() catkin-0.8.0/test/mock_resources/src/linker_options/src/leaf_pkg/leaf.cpp000066400000000000000000000002051361264727400266030ustar00rootroot00000000000000#include #include int main() { std::cout << "leaf_pkg calling "; root_pkg::func(); return 0; } catkin-0.8.0/test/mock_resources/src/linker_options/src/leaf_pkg/package.xml000066400000000000000000000005431361264727400273120ustar00rootroot00000000000000 leaf_pkg 3.4.5 Checks library and linker options Somebody Somebody Unknown catkin root_pkg catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/000077500000000000000000000000001361264727400252475ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/CMakeLists.txt000066400000000000000000000010751361264727400300120ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) project(root_pkg) find_package(catkin REQUIRED) add_library(rootlib SHARED root.cpp) target_include_directories(rootlib PUBLIC include) catkin_package( INCLUDE_DIRS include LIBRARIES -pthread -lpthread rootlib ) install(TARGETS rootlib ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/include/000077500000000000000000000000001361264727400266725ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/include/root_pkg/000077500000000000000000000000001361264727400305165ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/include/root_pkg/root.hpp000066400000000000000000000000441361264727400322100ustar00rootroot00000000000000namespace root_pkg { void func(); } catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/package.xml000066400000000000000000000005401361264727400273630ustar00rootroot00000000000000 root_pkg 3.4.5 Exports library and linker options in ${root_pkg_LIBRARIES} Somebody Somebody Unknown catkin catkin-0.8.0/test/mock_resources/src/linker_options/src/root_pkg/root.cpp000066400000000000000000000001771361264727400267430ustar00rootroot00000000000000#include #include "root_pkg/root.hpp" namespace root_pkg { void func() { std::cout << "root_pkg::func()\n"; } } catkin-0.8.0/test/mock_resources/src/nolangs/000077500000000000000000000000001361264727400212365ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/nolangs/CMakeLists.txt000066400000000000000000000004161361264727400237770ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.3) project(nolangs) find_package(catkin REQUIRED) catkin_package() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) add_executable(nolangs_exec main.cpp) install(TARGETS nolangs_exec RUNTIME DESTINATION bin) catkin-0.8.0/test/mock_resources/src/nolangs/main.cpp000066400000000000000000000001341361264727400226640ustar00rootroot00000000000000#include int main(int, char**) { std::cout << __PRETTY_FUNCTION__ << "\n"; } catkin-0.8.0/test/mock_resources/src/nolangs/package.xml000066400000000000000000000006161361264727400233560ustar00rootroot00000000000000 nolangs 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy catkin-0.8.0/test/mock_resources/src/python_test_a/000077500000000000000000000000001361264727400224555ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/python_test_a/msg/000077500000000000000000000000001361264727400232435ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/python_test_a/msg/A.msg000066400000000000000000000000251361264727400241300ustar00rootroot00000000000000std_msgs/String data catkin-0.8.0/test/mock_resources/src/python_test_a/package.xml000066400000000000000000000006241361264727400245740ustar00rootroot00000000000000 python_test_a 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy catkin-0.8.0/test/mock_resources/src/python_test_a/src/000077500000000000000000000000001361264727400232445ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/python_test_a/src/a_uses_std_msgs.py000066400000000000000000000003071361264727400270000ustar00rootroot00000000000000# add build/gen/py to pythonpath before running import std_msgs import std_msgs.msg some_string = std_msgs.msg.String some_string.data = 'Some Data in a std_msgs.msg.String' print(some_string.data) catkin-0.8.0/test/mock_resources/src/ros_user/000077500000000000000000000000001361264727400214365ustar00rootroot00000000000000catkin-0.8.0/test/mock_resources/src/ros_user/main.cpp000066400000000000000000000011031361264727400230610ustar00rootroot00000000000000#include namespace rs = ros::serialization; int main() { sensor_msgs::PointCloud2 pc_1; pc_1.width = 10; pc_1.height = 20; // todo set other stuff std::cout << "PointCloud2 message: " << std::endl << pc_1 << std::endl; uint8_t buf[1024]; rs::OStream out(buf, sizeof(buf) ); rs::serialize(out, pc_1); std::cout << "Message Was Serialized" << std::endl; sensor_msgs::PointCloud2 pc_2; rs::IStream in(buf, sizeof(buf) ); rs::deserialize(in, pc_2); std::cout << "Its a message again: " << std::endl << pc_2 << std::endl; } catkin-0.8.0/test/mock_resources/src/ros_user/package.xml000066400000000000000000000011541361264727400235540ustar00rootroot00000000000000 ros_user 3.4.5 foo Somebody Somebody Unknown catkin gencpp genmsg genpy cpp_common rostime roscpp_traits roscpp_serialization sensor_msgs catkin-0.8.0/test/network_tests/000077500000000000000000000000001361264727400166765ustar00rootroot00000000000000catkin-0.8.0/test/network_tests/__init__.py000066400000000000000000000000001361264727400207750ustar00rootroot00000000000000catkin-0.8.0/test/network_tests/network_test_utils.py000066400000000000000000000024341361264727400232230ustar00rootroot00000000000000import os import shutil from test.utils import AbstractCatkinWorkspaceTest from test.utils import TEMP_DIR from test.utils import create_catkin_workspace from test.utils import rosinstall class AbstractUnstableTest(AbstractCatkinWorkspaceTest): """Parent class for any Test case that download latest ros core stacks from github to build custom stacks against that.""" def __init__(self, testCaseName, name): # for ROS core integration tests, we reuse the same sources # (to save download time), keep in test folder super(AbstractUnstableTest, self).__init__( testCaseName, os.path.join(TEMP_DIR, name)) def setupWorkspaceContents(self): rosinstall(self.workspacedir, os.path.join(os.path.dirname(__file__), 'test.rosinstall')) create_catkin_workspace(self.workspacedir) def tearDown(self): # override parent tearDown which would delete what we # rosinstalled pass def delete_build(self): """ Clean the build folder, run manually in subtests when appropriate. We don't to this in setup because it takes so long to build all of ros core' """ if os.path.isdir(self.builddir): shutil.rmtree(self.builddir) catkin-0.8.0/test/network_tests/test.rosinstall000066400000000000000000000031701361264727400217720ustar00rootroot00000000000000# Using catkin from source instead # - git: # uri: 'git://github.com/ros/catkin.git' # local-name: catkin # version: master - git: uri: 'git://github.com/ros/genmsg.git' local-name: genmsg version: master - git: uri: 'git://github.com/ros/gencpp.git' local-name: gencpp version: master - git: uri: 'git://github.com/ros/genlisp.git' local-name: genlisp version: master - git: uri: 'git://github.com/ros/genpy.git' local-name: genpy version: master - git: uri: 'git://github.com/ros/langs.git' local-name: langs version: master # - git: # uri: 'git://github.com/ros/langs-dev.git' # local-name: langs-dev # version: master - git: uri: 'git://github.com/ros/message_generation.git' local-name: message_generation version: master - git: uri: 'git://github.com/ros/message_runtime.git' local-name: message_runtime version: master - git: uri: 'git://github.com/ros/std_msgs.git' local-name: std_msgs version: master - git: uri: 'git://github.com/ros/roscpp_core.git' local-name: roscpp_core version: master # - git: # uri: 'git://github.com/ros/ros_comm.git' # local-name: ros_comm # - git: # uri: 'git://github.com/ros/ros_tutorials.git' # local-name: ros_tutorials - svn: uri: 'https://code.ros.org/svn/ros/stacks/ros/trunk/' local-name: ros - git: uri: 'git://github.com/ros/common_msgs.git' local-name: common_msgs - git: uri: 'git://github.com/ros/rospack.git' local-name: rospack # - hg: # local-name: actionlib # uri: https://kforge.ros.org/common/actionlib catkin-0.8.0/test/network_tests/test_unstable.py000066400000000000000000000132541361264727400221310ustar00rootroot00000000000000#!/usr/bin/env python import os import shutil import tempfile from test.utils import MAKE_CMD from test.utils import MOCK_DIR from test.utils import PYTHON_INSTALL_PATH from test.utils import assert_exists from test.utils import create_catkin_workspace from test.utils import succeed from .network_test_utils import AbstractUnstableTest class SimpleUnstableTest(AbstractUnstableTest): def __init__(self, testCaseName): super(SimpleUnstableTest, self).__init__(testCaseName, 'unstable_test') def setUp(self): super(SimpleUnstableTest, self).setUp() # a bit dirty here, tester needs to manually delete # test/tmp/unstable_test/build folder. But else, tests take # too long if not os.path.exists(os.path.join(self.builddir, 'Makefile')): self.cmake() # if make fails due to DistributionNotFound, # tester needs to manually delete test/tmp/unstable_test/src succeed(MAKE_CMD, cwd=self.builddir) succeed(MAKE_CMD + ['install'], cwd=self.builddir) def test_make(self): # uses core ros stacks installed in setUp # just checks the result for success self.assertTrue(os.path.exists(self.workspacedir)) assert_exists(self.builddir, 'ros') assert_exists(self.develspace, 'bin', 'etc', 'include', 'lib', 'share') assert_exists(self.installdir, 'bin', 'etc', 'include', 'lib', 'share') def test_common_msgs_against_installed(self): # uses core ros stacks installed in setUp # tries to build common_msgs in separate workspace try: # create another workspace than self.rootdir other_root_dir = tempfile.mkdtemp() other_src_dir = os.path.join(other_root_dir, 'src') create_catkin_workspace(other_src_dir) other_build_dir = os.path.join(other_root_dir, 'build') other_develspace_dir = os.path.join(other_build_dir, 'devel') shutil.copytree(os.path.join(self.workspacedir, 'common_msgs'), os.path.join(other_src_dir, 'common_msgs')) self.cmake(cwd=other_build_dir, srcdir=other_src_dir) succeed(MAKE_CMD, cwd=other_build_dir) assert_exists(other_develspace_dir, PYTHON_INSTALL_PATH + '/nav_msgs/msg/_GridCells.py', 'include/nav_msgs/GridCells.h') succeed(MAKE_CMD + ['install'], cwd=other_build_dir) assert_exists(self.installdir, 'include/geometry_msgs/PointStamped.h', PYTHON_INSTALL_PATH + '/geometry_msgs/msg/_PointStamped.py', 'share/geometry_msgs/msg/PointStamped.msg', # 'share/typelibxml/geometry_msgs/PointStamped.xml', ) finally: # pass shutil.rmtree(other_root_dir) def test_mock_against_installed(self): # uses core ros stacks installed in setUp # tries to build mock project in separate workspace try: # create another workspace than self.rootdir other_root_dir = tempfile.mkdtemp() other_src_dir = os.path.join(other_root_dir, 'src') create_catkin_workspace(other_src_dir) other_build_dir = os.path.join(other_root_dir, 'build') other_develspace_dir = os.path.join(other_build_dir, 'devel') other_install_dir = os.path.join(other_root_dir, 'install') shutil.copytree(os.path.join(MOCK_DIR, 'src', 'catkin_test'), os.path.join(other_src_dir, 'catkin_test')) self.cmake(cwd=other_build_dir, srcdir=other_src_dir, installdir=other_install_dir) succeed(MAKE_CMD, cwd=other_build_dir) assert_exists(other_develspace_dir, 'lib/liba.so', 'lib/libb.so', 'lib/libc-one.so', 'lib/libc-two.so', 'lib/libd.so') assert_exists(other_build_dir, # 'bin/nolangs_exec', 'catkin_test/quux_user/bin/quux_srv-exec') assert_exists(other_develspace_dir, PYTHON_INSTALL_PATH + '/a', # PYTHON_INSTALL_PATH + '/b', # PYTHON_INSTALL_PATH + '/c', # PYTHON_INSTALL_PATH + '/d', PYTHON_INSTALL_PATH + '/a/__init__.py', PYTHON_INSTALL_PATH + '/quux_msgs/__init__.py') # "DESTDIR=" succeed(MAKE_CMD + ['install'], cwd=other_build_dir) assert_exists(other_install_dir, 'lib/pkgconfig/a.pc', 'lib/pkgconfig/b.pc', 'lib/pkgconfig/c.pc', 'lib/pkgconfig/d.pc', 'lib/pkgconfig/quux_msgs.pc', PYTHON_INSTALL_PATH + '/a/__init__.py', PYTHON_INSTALL_PATH + '/quux_msgs/__init__.py') # # make sure python imports work # # succeed([other_build_dir + '/env.sh", 'python -c 'import a'"]) # succeed([other_build_dir + '/env.sh', "python -c 'import b'"]) finally: # pass shutil.rmtree(other_root_dir) catkin-0.8.0/test/unit_tests/000077500000000000000000000000001361264727400161645ustar00rootroot00000000000000catkin-0.8.0/test/unit_tests/__init__.py000066400000000000000000000000001361264727400202630ustar00rootroot00000000000000catkin-0.8.0/test/unit_tests/test_builder.py000066400000000000000000000064361361264727400212340ustar00rootroot00000000000000# -*- coding: utf-8 -*- import os import unittest try: import catkin.builder except ImportError as e: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(e) ) class BuilderTest(unittest.TestCase): # TODO: Add tests for catkin_make and catkin_make_isolated def test_run_command_unicode_string(self): backup_Popen = catkin.builder.subprocess.Popen class StdOut(object): def __init__(self, popen): self.__popen = popen def readline(self): self.__popen.returncode = 0 try: # for Python 2 compatibility only return unichr(2018) except NameError: return chr(2018) class MockPopen(object): def __init__(self, *args, **kwargs): self.returncode = None self.stdout = StdOut(self) def wait(self): return True try: catkin.builder.subprocess.Popen = MockPopen catkin.builder.run_command(['false'], os.getcwd(), True, True) finally: catkin.builder.subprocess.Popen = backup_Popen def test_run_command_unicode_bytes(self): backup_Popen = catkin.builder.subprocess.Popen class StdOut(object): def __init__(self, popen): self.__popen = popen def readline(self): self.__popen.returncode = 0 try: # for Python 2 compatibility only s = unichr(2018) except NameError: s = chr(2018) return s.encode('utf8') class MockPopen(object): def __init__(self, *args, **kwargs): self.returncode = None self.stdout = StdOut(self) def wait(self): return True try: catkin.builder.subprocess.Popen = MockPopen catkin.builder.run_command(['false'], os.getcwd(), True, True) finally: catkin.builder.subprocess.Popen = backup_Popen def test_extract_jobs_flags(self): valid_mflags = [ '-j8 -l8', 'j8 ', '-j', 'j', '-l8', 'l8', '-l', 'l', '-j18', ' -j8 l9', '-j1 -l1', '--jobs=8', '--jobs 8', '--jobs', '--load-average', '--load-average=8', '--load-average 8', '--jobs=8 -l9' ] results = [ '-j8 -l8', 'j8', '-j', 'j', '-l8', 'l8', '-l', 'l', '-j18', '-j8 l9', '-j1 -l1', '--jobs=8', '--jobs 8', '--jobs', '--load-average', '--load-average=8', '--load-average 8', '--jobs=8 -l9' ] for mflag, result in zip(valid_mflags, results): match = catkin.builder.extract_jobs_flags(mflag) assert match == result, "should match '{0}'".format(mflag) print('--') print("input: '{0}'".format(mflag)) print("matched: '{0}'".format(match)) print("expected: '{0}'".format(result)) invalid_mflags = ['', '--jobs= 8', '--jobs8'] for mflag in invalid_mflags: match = catkin.builder.extract_jobs_flags(mflag) assert match is None, "should not match '{0}'".format(mflag) catkin-0.8.0/test/unit_tests/test_catkin_find.py000066400000000000000000000022531361264727400220500ustar00rootroot00000000000000import imp import os import unittest imp.load_source('catkin_find', os.path.join(os.path.dirname(__file__), '..', '..', 'bin', 'catkin_find')) from catkin_find import parse_args # noqa: E402 class CatkinFindTest(unittest.TestCase): def test_parse_args_empty(self): args = parse_args([]) self.assertEqual(False, args.first_only) self.assertIsNone(args.path) self.assertIsNone(args.project) self.assertIsNone(args.install_folders) def test_parse_args_folders(self): args = parse_args(['--etc', '--lib', '--bin']) self.assertEqual(False, args.first_only) self.assertIsNone(args.path) self.assertIsNone(args.project) self.assertEqual(['etc', 'lib', 'bin'], args.install_folders) args = parse_args(['--etc', '--bin', '--lib']) self.assertEqual(['etc', 'bin', 'lib'], args.install_folders) def test_parse_args_first(self): args = parse_args(['--first-only']) self.assertEqual(True, args.first_only) self.assertIsNone(args.path) self.assertIsNone(args.project) self.assertIsNone(args.install_folders) catkin-0.8.0/test/unit_tests/test_catkin_make_isolated.py000066400000000000000000000135131361264727400237320ustar00rootroot00000000000000from __future__ import print_function import imp import os import shutil import subprocess import sys import tempfile import unittest try: from catkin.builder import extract_cmake_and_make_arguments except ImportError as e: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(e) ) imp.load_source('catkin_make_isolated', os.path.join(os.path.dirname(__file__), '..', '..', 'bin', 'catkin_make_isolated')) from catkin_make_isolated import handle_cmake_args # noqa: E402 from catkin_make_isolated import main # noqa: E402 from catkin_make_isolated import parse_args # noqa: E402 class CatkinMakeIsolatedTests(unittest.TestCase): def test_extract_cmake_and_make_arguments(self): args = [] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == [] assert args == [] args = ['-DCMAKE_INSTALL_PREFIX=install'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCMAKE_INSTALL_PREFIX=install'] assert args == [] args = ['-DCMAKE_INSTALL_PREFIX=install', '--install'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCMAKE_INSTALL_PREFIX=install'] assert args == ['--install'] args = [ '-DCMAKE_INSTALL_PREFIX=install', '--install', '--install-space', 'install_isolated' ] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCMAKE_INSTALL_PREFIX=install'] assert args == ['--install', '--install-space', 'install_isolated'] args = ['-DCATKIN_DEVEL_PREFIX=devel'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCATKIN_DEVEL_PREFIX=devel'] assert args == [] args = ['-DCATKIN_DEVEL_PREFIX=devel'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCATKIN_DEVEL_PREFIX=devel'] assert args == [] args = [ '-DCATKIN_DEVEL_PREFIX=devel', '--devel-space', 'devel_isolated' ] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCATKIN_DEVEL_PREFIX=devel'] assert args == ['--devel-space', 'devel_isolated'] def test_handle_cmake_args(self): args = ['-DCMAKE_INSTALL_PREFIX=install', '--install'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCMAKE_INSTALL_PREFIX=install'], cmake_args opts = parse_args(args) cmake_args, opts = handle_cmake_args(cmake_args, opts) assert cmake_args == [], cmake_args assert opts.install assert opts.install_space == 'install' args = [ '-DCMAKE_INSTALL_PREFIX=install', '--install', '--install-space', 'install_isolated' ] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCMAKE_INSTALL_PREFIX=install'], cmake_args opts = parse_args(args) cmake_args, opts = handle_cmake_args(cmake_args, opts) assert cmake_args == [], cmake_args assert opts.install assert opts.install_space == 'install_isolated' args = ['-DCATKIN_DEVEL_PREFIX=devel'] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCATKIN_DEVEL_PREFIX=devel'], cmake_args opts = parse_args(args) cmake_args, opts = handle_cmake_args(cmake_args, opts) assert cmake_args == [], cmake_args assert opts.devel == 'devel' args = [ '-DCATKIN_DEVEL_PREFIX=devel', '--devel-space', 'devel_isolated' ] args, cmake_args, make_args = extract_cmake_and_make_arguments(args) assert cmake_args == ['-DCATKIN_DEVEL_PREFIX=devel'], cmake_args opts = parse_args(args) cmake_args, opts = handle_cmake_args(cmake_args, opts) assert cmake_args == [], cmake_args assert opts.devel == 'devel_isolated' def test_empty_workspace(self): argv = sys.argv environ = os.environ error_msg = None try: ws_dir = tempfile.mkdtemp() src_dir = os.path.join(ws_dir, 'src') os.mkdir(src_dir) sys.argv = ['catkin_make_isolated', '-C', ws_dir] environ['CMAKE_PREFIX_PATH'] = os.path.join(ws_dir, 'install') main() except Exception as e: error_msg = str(e) finally: shutil.rmtree(ws_dir) sys.argv = argv os.environ = environ assert error_msg is None, error_msg def test_symlinked_src(self): argv = sys.argv environ = os.environ cwd = os.getcwd() error_msg = None try: base_dir = tempfile.mkdtemp() ws_dir = os.path.join(base_dir, 'ws') os.mkdir(ws_dir) other_dir = os.path.join(base_dir, 'other') os.mkdir(other_dir) src_dir = os.path.join(ws_dir, 'src') os.symlink(other_dir, src_dir) cmi = os.path.join(os.path.dirname(__file__), '..', '..', 'bin', 'catkin_make_isolated') environ['CMAKE_PREFIX_PATH'] = os.path.join(ws_dir, 'install') environ['PWD'] = src_dir subprocess.check_output(' '.join([sys.executable, cmi, '-C', '..']), cwd=src_dir, env=environ, shell=True) except Exception as e: error_msg = str(e) finally: shutil.rmtree(ws_dir) sys.argv = argv os.environ = environ os.chdir(cwd) assert error_msg is None, error_msg catkin-0.8.0/test/unit_tests/test_download_md5.py000066400000000000000000000044161361264727400221560ustar00rootroot00000000000000import imp import os import shutil import tempfile import unittest imp.load_source('download_checkmd5', os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'test', 'download_checkmd5.py')) from download_checkmd5 import checkmd5 # noqa: E402 from download_checkmd5 import download_md5 # noqa: E402 from download_checkmd5 import main # noqa: E402 class DowloadCheckMd5Test(unittest.TestCase): def test_download(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'testfile') check_file = os.path.join(rootdir, 'checkfile') with open(src_file, 'w') as fhand: fhand.write('foo') download_md5('file://%s' % src_file, check_file) self.assertTrue(os.path.isfile(check_file)) finally: shutil.rmtree(rootdir) def test_checkmd5(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'testfile') realmd5 = 'acbd18db4cc2f85cedef654fccc4a4d8' with open(src_file, 'w') as fhand: fhand.write('foo') result, hexdig = checkmd5(src_file, 'hello') self.assertFalse(result) self.assertEqual(realmd5, hexdig) result, hexdig = checkmd5(src_file, realmd5) self.assertTrue(result) self.assertEqual(realmd5, hexdig) finally: shutil.rmtree(rootdir) def test_main(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'testfile') check_file = os.path.join(rootdir, 'checkfile') realmd5 = 'acbd18db4cc2f85cedef654fccc4a4d8' with open(src_file, 'w') as fhand: fhand.write('foo') main([os.path.join('file://localhost', src_file), check_file]) self.assertTrue(os.path.isfile(check_file)) os.remove(check_file) self.assertFalse(os.path.isfile(check_file)) self.assertNotEqual(main([os.path.join('file://localhost', src_file), check_file, 'hello']), 0) main([os.path.join('file://localhost', src_file), check_file, realmd5]) finally: shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_environment_cache.py000066400000000000000000000060601361264727400232660ustar00rootroot00000000000000import os import shutil import stat import tempfile import unittest from mock import Mock try: import catkin.environment_cache from catkin.environment_cache import _append_header, _set_variable, _append_comment, _is_not_windows, generate_environment_script except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) class PlatformTest(unittest.TestCase): def setUp(self): self.platform_backup = catkin.environment_cache.platform self.winplatform = Mock() self.winplatform.system.return_value = 'Windows' linuxplatform = Mock() linuxplatform.system.return_value = 'Linux' catkin.environment_cache.platform = linuxplatform def tearDown(self): catkin.environment_cache.platform = self.platform_backup def test_is_not_windows(self): self.assertTrue(_is_not_windows()) catkin.environment_cache.platform = self.winplatform self.assertFalse(_is_not_windows()) def test_appends(self): code = [] _append_header(code) self.assertEqual(['#!/usr/bin/env sh', '# generated from catkin/python/catkin/environment_cache.py', ''], code) code = [] _append_comment(code, 'foo') self.assertEqual(['# foo'], code) code = [] _set_variable(code, 'foo', 'bar') self.assertEqual(['export foo="bar"'], code) def test_appends_windows(self): catkin.environment_cache.platform = self.winplatform code = [] _append_header(code) self.assertEqual(['@echo off', 'REM generated from catkin/python/catkin/environment_cache.py', ''], code) code = [] _append_comment(code, 'foo') self.assertEqual(['REM foo'], code) code = [] _set_variable(code, 'foo', 'bar') self.assertEqual(['set foo=bar'], code) def test_generate_environment_script(self): old_environ = os.environ try: fake_environ = os.environ.copy() fake_environ['FOO'] = '/bar' fake_environ['TRICK'] = '/lib' catkin.environment_cache.os.environ = fake_environ rootdir = tempfile.mkdtemp() env_file = os.path.join(rootdir, 'env.sh') with open(env_file, 'a') as fhand: fhand.write("""\ #! /usr/bin/env sh export FOO=/foo:/bar export TRICK=/usr/lib export BAR=/bar exec \"$@\"""") mode = os.stat(env_file).st_mode os.chmod(env_file, mode | stat.S_IXUSR) result = generate_environment_script(env_file) self.assertTrue('export FOO="/foo:$FOO"' in result, result) self.assertTrue('export TRICK="/usr/lib"' in result, result) self.assertTrue('export BAR="/bar"' in result, result) self.assertEqual('#!/usr/bin/env sh', result[0]) finally: os.environ = old_environ catkin.environment_cache.os.environ = os.environ shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_find_in_workspace.py000066400000000000000000000166451361264727400232750ustar00rootroot00000000000000import os import shutil import tempfile import unittest from mock import Mock try: import catkin from catkin.find_in_workspaces import find_in_workspaces, _get_valid_search_dirs from catkin.workspace import CATKIN_MARKER_FILE except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) class FindInWorkspaceTest(unittest.TestCase): def test_get_valid_search_dirs(self): self.assertEqual(['bin', 'etc', 'include', 'lib', 'share'], _get_valid_search_dirs([], None)) self.assertEqual(['bin', 'etc', 'include', 'lib', 'share'], _get_valid_search_dirs(None, None)) self.assertEqual(['etc', 'include', 'libexec', 'share'], _get_valid_search_dirs(None, 'foo')) self.assertEqual(['bin', 'etc', 'include', 'lib', 'share'], _get_valid_search_dirs(None, None)) self.assertEqual(['include', 'bin'], _get_valid_search_dirs(['include', 'bin'], None)) self.assertEqual(['include', 'etc'], _get_valid_search_dirs(['include', 'etc'], 'foo')) self.assertRaises(ValueError, _get_valid_search_dirs, ['foo'], None) self.assertRaises(ValueError, _get_valid_search_dirs, ['bin'], 'foo') self.assertRaises(ValueError, _get_valid_search_dirs, ['libexec'], None) def test_find_in_workspaces(self): existing = find_in_workspaces([], _workspaces=[]) self.assertEqual([], existing) existing = find_in_workspaces([], 'foo', _workspaces=[]) self.assertEqual([], existing) existing = find_in_workspaces([], 'foo', 'foopath', _workspaces=[]) self.assertEqual([], existing) existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=[]) self.assertEqual([], existing) checked = [] existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=['bar'], considered_paths=checked) self.assertEqual([], existing) self.assertEqual(['bar/include/foo/foopath'], checked) checked = [] existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=['bar', 'baz'], considered_paths=checked) self.assertEqual([], existing) self.assertEqual(['bar/include/foo/foopath', 'baz/include/foo/foopath'], checked) checked = [] existing = find_in_workspaces(['include', 'etc', 'libexec'], 'foo', 'foopath', _workspaces=['bar', 'baz'], considered_paths=checked) self.assertEqual([], existing) self.assertEqual(['bar/include/foo/foopath', 'bar/etc/foo/foopath', 'bar/lib/foo/foopath', 'bar/libexec/foo/foopath', 'baz/include/foo/foopath', 'baz/etc/foo/foopath', 'baz/lib/foo/foopath', 'baz/libexec/foo/foopath'], checked) checked = [] existing = find_in_workspaces(['share', 'etc', 'lib'], None, 'foopath', _workspaces=['bar', 'baz'], considered_paths=checked) self.assertEqual([], existing) self.assertEqual(['bar/share/foopath', 'bar/etc/foopath', 'bar/lib/foopath', 'baz/share/foopath', 'baz/etc/foopath', 'baz/lib/foopath'], checked) checked = [] existing = find_in_workspaces(None, None, None, _workspaces=['bar'], considered_paths=checked) self.assertEqual([], existing) self.assertEqual(['bar/bin', 'bar/etc', 'bar/include', 'bar/lib', 'bar/share'], checked) def test_with_sourcepath(self): def create_mock_workspace(root_dir, ws): ws1 = os.path.join(root_dir, ws) inc = os.path.join(ws1, 'include') share = os.path.join(ws1, 'share') p1inc = os.path.join(inc, 'foo') p1share = os.path.join(share, 'foo') os.makedirs(ws1) os.makedirs(inc) os.makedirs(share) os.makedirs(p1inc) os.makedirs(p1share) with open(os.path.join(ws1, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('loc1;loc2') try: fp_backup = catkin.find_in_workspaces.find_packages root_dir = tempfile.mkdtemp() catkin.find_in_workspaces.find_packages = Mock() foomock = Mock() foomock.name = 'foo' barmock = Mock() barmock.name = 'bar' catkin.find_in_workspaces.find_packages.return_value = {'bar': barmock, 'foo': foomock} create_mock_workspace(root_dir, 'ws1') create_mock_workspace(root_dir, 'ws2') checked = [] existing = find_in_workspaces(['share', 'etc'], 'foo', 'foopath', _workspaces=[os.path.join(root_dir, 'ws1')], considered_paths=checked) self.assertEqual([os.path.join(root_dir, 'ws1', 'share', 'foo', 'foopath'), 'loc1/foo/foopath', 'loc2/foo/foopath', os.path.join(root_dir, 'ws1', 'etc', 'foo', 'foopath')], checked) self.assertEqual([], existing) checked = [] existing = find_in_workspaces(['share', 'etc'], 'foo', None, _workspaces=[os.path.join(root_dir, 'ws1')], considered_paths=checked) self.assertEqual([os.path.join(root_dir, 'ws1', 'share', 'foo'), 'loc1/foo', 'loc2/foo', os.path.join(root_dir, 'ws1', 'etc', 'foo')], checked) self.assertEqual([os.path.join(root_dir, 'ws1', 'share', 'foo')], existing) # first-only option checked = [] existing = find_in_workspaces(None, None, None, _workspaces=[os.path.join(root_dir, 'ws1'), os.path.join(root_dir, 'ws2')], considered_paths=checked) self.assertEqual([ os.path.join(root_dir, 'ws1', 'include'), os.path.join(root_dir, 'ws1', 'share'), os.path.join(root_dir, 'ws2', 'include'), os.path.join(root_dir, 'ws2', 'share')], existing) existing = find_in_workspaces(None, None, None, _workspaces=[os.path.join(root_dir, 'ws1'), os.path.join(root_dir, 'ws2')], considered_paths=checked, first_matching_workspace_only=True) self.assertEqual([ os.path.join(root_dir, 'ws1', 'include'), os.path.join(root_dir, 'ws1', 'share')], existing) existing = find_in_workspaces(None, None, None, _workspaces=[os.path.join(root_dir, 'ws1'), os.path.join(root_dir, 'ws2')], considered_paths=checked, first_match_only=True) self.assertEqual([ os.path.join(root_dir, 'ws1', 'include')], existing) # overlay: first_matching_workspace_only=True checked = [] existing = find_in_workspaces(None, 'foo', None, _workspaces=[os.path.join(root_dir, 'ws1'), os.path.join(root_dir, 'ws2')], considered_paths=checked, first_matching_workspace_only=True) self.assertEqual([ os.path.join(root_dir, 'ws1', 'include', 'foo'), os.path.join(root_dir, 'ws1', 'share', 'foo')], existing) finally: catkin.find_in_workspaces.find_packages = fp_backup shutil.rmtree(root_dir) catkin-0.8.0/test/unit_tests/test_init_workspace.py000066400000000000000000000060031361264727400226150ustar00rootroot00000000000000import os import shutil import tempfile import unittest from os.path import join try: from catkin.init_workspace import init_workspace, _symlink_or_copy except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) class InitWorkspaceTest(unittest.TestCase): def test_symlink_or_copy(self): try: root_dir = tempfile.mkdtemp() os.makedirs(join(root_dir, 'subdir')) os.makedirs(join(root_dir, 'subdir2')) with open(join(root_dir, 'subdir', 'foo'), 'ab') as fhand: fhand.write('content'.encode('UTF-8')) _symlink_or_copy(join(root_dir, 'subdir', 'foo'), join(root_dir, 'foolink')) _symlink_or_copy(join(root_dir, 'subdir', 'foo'), join(root_dir, 'subdir', 'foolink')) _symlink_or_copy(os.path.relpath(join(root_dir, 'subdir', 'foo'), os.getcwd()), join(root_dir, 'foolinkrel')) self.assertEqual(join(root_dir, 'subdir', 'foo'), os.readlink(join(root_dir, 'foolink'))) self.assertEqual(join(root_dir, 'subdir', 'foo'), os.readlink(join(root_dir, 'subdir', 'foolink'))) self.assertEqual(os.path.relpath(join(root_dir, 'subdir', 'foo'), os.getcwd()), os.readlink(join(root_dir, 'foolinkrel'))) finally: # pass shutil.rmtree(root_dir) def test_init_workspace(self): try: root_dir = tempfile.mkdtemp() os.makedirs(join(root_dir, 'ws1')) os.makedirs(join(root_dir, 'ws1', 'catkin')) os.makedirs(join(root_dir, 'ws1', 'catkin', 'cmake')) with open(join(root_dir, 'ws1', 'catkin', 'cmake', 'toplevel.cmake'), 'ab') as fhand: fhand.write(''.encode('UTF-8')) with open(join(root_dir, 'ws1', '.catkin'), 'ab') as fhand: fhand.write(''.encode('UTF-8')) os.makedirs(join(root_dir, 'ws2')) with open(join(root_dir, 'ws2', '.catkin'), 'ab') as fhand: fhand.write(''.encode('UTF-8')) init_workspace(join(root_dir, 'ws1')) init_workspace(join(root_dir, 'ws2')) # in same workspace symlink should be relative self.assertEqual( join('catkin', 'cmake', 'toplevel.cmake'), os.readlink(join(root_dir, 'ws1', 'CMakeLists.txt'))) # outside workspace, path should be absolute self.assertTrue( os.path.samefile( join(os.path.dirname(__file__), '..', '..', 'cmake', 'toplevel.cmake'), os.readlink(join(root_dir, 'ws2', 'CMakeLists.txt')))) finally: # pass shutil.rmtree(root_dir) catkin-0.8.0/test/unit_tests/test_interrogate_setup.py000066400000000000000000000176731361264727400233560ustar00rootroot00000000000000import imp import os import shutil import tempfile import unittest imp.load_source('interrogate_setup_dot_py', os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'interrogate_setup_dot_py.py')) from interrogate_setup_dot_py import _create_mock_setup_function # noqa: E402 from interrogate_setup_dot_py import _get_locations # noqa: E402 from interrogate_setup_dot_py import generate_cmake_file # noqa: E402 class InterrogateSetupTest(unittest.TestCase): def test_generate_cmake_file(self): cmake_lines = (generate_cmake_file(package_name='pack1', version='0.0.1', scripts=[], package_dir={'': 'foopath'}, pkgs=['foo', 'bar', 'bar.sub'], modules=[])) self.assertEqual(['set(pack1_SETUP_PY_VERSION "0.0.1")', 'set(pack1_SETUP_PY_SCRIPTS "")', 'set(pack1_SETUP_PY_PACKAGES "foo;bar")', 'set(pack1_SETUP_PY_PACKAGE_DIRS "foopath/foo;foopath/bar")', 'set(pack1_SETUP_PY_MODULES "")', 'set(pack1_SETUP_PY_MODULE_DIRS "")'], cmake_lines) cmake_lines = (generate_cmake_file(package_name='pack1', version='0.0.1', scripts=[], package_dir={}, pkgs=['foo', 'bar', 'bar.sub'], modules=[])) self.assertEqual(['set(pack1_SETUP_PY_VERSION "0.0.1")', 'set(pack1_SETUP_PY_SCRIPTS "")', 'set(pack1_SETUP_PY_PACKAGES "foo;bar")', 'set(pack1_SETUP_PY_PACKAGE_DIRS "foo;bar")', 'set(pack1_SETUP_PY_MODULES "")', 'set(pack1_SETUP_PY_MODULE_DIRS "")'], cmake_lines) cmake_lines = (generate_cmake_file(package_name='pack1', version='0.0.1', scripts=['bin/foo', 'nodes/bar'], package_dir={}, pkgs=['foo', 'bar', 'bar.sub'], modules=[])) self.assertEqual(['set(pack1_SETUP_PY_VERSION "0.0.1")', 'set(pack1_SETUP_PY_SCRIPTS "bin/foo;nodes/bar")', 'set(pack1_SETUP_PY_PACKAGES "foo;bar")', 'set(pack1_SETUP_PY_PACKAGE_DIRS "foo;bar")', 'set(pack1_SETUP_PY_MODULES "")', 'set(pack1_SETUP_PY_MODULE_DIRS "")'], cmake_lines) def test_get_locations(self): self.assertEqual({'foo': 'foo'}, _get_locations(['foo'], {})) self.assertEqual({'foo': 'src/foo'}, _get_locations(['foo'], {'': 'src'})) self.assertEqual({'foo': 'src/foo', 'foo.bar': 'src/foo/bar'}, _get_locations(['foo.bar'], {'': 'src'})) self.assertEqual({'foo': 'src'}, _get_locations(['foo'], {'foo': 'src'})) self.assertEqual({'foo': 'src', 'foo.bar': 'src/bar'}, _get_locations(['foo.bar'], {'foo': 'src'})) def test_generate_cmake_file_noallprefix(self): cmake_lines = (generate_cmake_file(package_name='pack1', version='0.0.1', scripts=[], package_dir={'foo': 'src', 'bar': 'lib'}, pkgs=['foo', 'bar', 'bar.sub'], modules=[])) self.assertEqual(['set(pack1_SETUP_PY_VERSION "0.0.1")', 'set(pack1_SETUP_PY_SCRIPTS "")', 'set(pack1_SETUP_PY_PACKAGES "foo;bar")', 'set(pack1_SETUP_PY_PACKAGE_DIRS "src;lib")', 'set(pack1_SETUP_PY_MODULES "")', 'set(pack1_SETUP_PY_MODULE_DIRS "")'], cmake_lines) def test_generate_cmake_file_msg_srv(self): cmake_lines = (generate_cmake_file(package_name='pack1', version='0.0.1', scripts=[], package_dir={'foo.msg': 'msg', 'foo.srv': 'srv', '': 'src'}, pkgs=['foo.msg', 'foo.srv', 'foo'], modules=[])) self.assertEqual(['set(pack1_SETUP_PY_VERSION "0.0.1")', 'set(pack1_SETUP_PY_SCRIPTS "")', 'set(pack1_SETUP_PY_PACKAGES "foo")', 'set(pack1_SETUP_PY_PACKAGE_DIRS "src/foo")', 'set(pack1_SETUP_PY_MODULES "")', 'set(pack1_SETUP_PY_MODULE_DIRS "")'], cmake_lines) def test_generate_cmake_file_invalid(self): self.assertRaises(RuntimeError, generate_cmake_file, package_name='pack1', version='0.0.1', scripts=[], package_dir={'foo.sub1': 'sub1', 'foo.sub2': 'somewhere', '': 'src'}, pkgs=['foo.sub2', 'foo.sub1', 'foo'], modules=[]) def test_interrogate_setup_py(self): try: rootdir = tempfile.mkdtemp() outfile = os.path.join(rootdir, 'out.cmake') fake_setup = _create_mock_setup_function('foo', outfile) self.assertRaises(RuntimeError, fake_setup, package_dir={'': 'src'}) # simple setup fake_setup(version='0.1.1', package_dir={'': 'src'}) self.assertTrue(os.path.isfile(outfile)) with open(outfile, 'r') as fhand: contents = fhand.read() self.assertEqual("""set(foo_SETUP_PY_VERSION "0.1.1") set(foo_SETUP_PY_SCRIPTS "") set(foo_SETUP_PY_PACKAGES "") set(foo_SETUP_PY_PACKAGE_DIRS "") set(foo_SETUP_PY_MODULES "") set(foo_SETUP_PY_MODULE_DIRS "")""", contents) os.remove(outfile) # packages and scripts fake_setup(version='0.1.1', package_dir={}, packages=['foo', 'bar'], scripts=['bin/foo', 'nodes/bar']) self.assertTrue(os.path.isfile(outfile)) with open(outfile, 'r') as fhand: contents = fhand.read() self.assertEqual("""set(foo_SETUP_PY_VERSION "0.1.1") set(foo_SETUP_PY_SCRIPTS "bin/foo;nodes/bar") set(foo_SETUP_PY_PACKAGES "foo;bar") set(foo_SETUP_PY_PACKAGE_DIRS "foo;bar") set(foo_SETUP_PY_MODULES "") set(foo_SETUP_PY_MODULE_DIRS "")""", contents) os.remove(outfile) # packages and package_dir fake_setup(version='0.1.1', package_dir={'foo': 'src', 'bar': 'lib'}, packages=['foo', 'bar'],) self.assertTrue(os.path.isfile(outfile)) with open(outfile, 'r') as fhand: contents = fhand.read() self.assertEqual("""set(foo_SETUP_PY_VERSION "0.1.1") set(foo_SETUP_PY_SCRIPTS "") set(foo_SETUP_PY_PACKAGES "foo;bar") set(foo_SETUP_PY_PACKAGE_DIRS "src;lib") set(foo_SETUP_PY_MODULES "") set(foo_SETUP_PY_MODULE_DIRS "")""", contents) os.remove(outfile) finally: shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_order_packages_cmake_em.py000066400000000000000000000026431361264727400243740ustar00rootroot00000000000000import os import sys import unittest import em class OrderPackagesEmTest(unittest.TestCase): def test_env_cached_static(self): # hack to fix empy nosetests clash sys.stdout = em.ProxyFile(sys.stdout) template_file = os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'em', 'order_packages.cmake.em') with open(template_file, 'r') as fhand: template = fhand.read() gdict = {'CATKIN_DEVEL_PREFIX': '/foo', 'CMAKE_PREFIX_PATH': ['/bar'], 'CATKIN_GLOBAL_LIB_DESTINATION': '/glob-dest/lib', 'CATKIN_GLOBAL_BIN_DESTINATION': '/glob-dest/bin', 'PYTHON_INSTALL_DIR': '/foo/dist-packages'} result = em.expand(template, gdict, source_root_dir='/tmp/nowhere_dir', whitelisted_packages=[], blacklisted_packages=[], underlay_workspaces=[]) self.assertTrue('set(CATKIN_ORDERED_PACKAGES "")' in result, result) self.assertTrue('set(CATKIN_ORDERED_PACKAGE_PATHS "")' in result, result) self.assertTrue('set(CATKIN_ORDERED_PACKAGES_IS_META "")' in result, result) self.assertTrue('set(CATKIN_ORDERED_PACKAGES_BUILD_TYPE "")' in result, result) self.assertTrue('set(CATKIN_MESSAGE_GENERATORS' in result, result) self.assertEqual(10, len(result.splitlines())) catkin-0.8.0/test/unit_tests/test_order_paths.py000066400000000000000000000013661361264727400221150ustar00rootroot00000000000000import imp import os import unittest imp.load_source('order_paths', os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'order_paths.py')) from order_paths import order_paths # noqa: E402 class OrderPathsTest(unittest.TestCase): def test_order_paths(self): self.assertEqual([], order_paths([], [])) self.assertEqual(['foo/1', 'foo/2', 'bar/1', 'bar/2', 'foo3'], order_paths(['foo3', 'bar/1', 'foo/1', 'foo/2', 'bar/2'], ['foo', 'bar'])) self.assertEqual(['foo/1', 'foo/2'], order_paths(['foo/1', 'foo/2'], [])) self.assertEqual(['foo/1', 'foo/2'], order_paths(['foo/1', 'foo/2'], [''])) catkin-0.8.0/test/unit_tests/test_parse_package_xml.py000066400000000000000000000100041361264727400232350ustar00rootroot00000000000000import imp import os import shutil import tempfile import unittest from mock import Mock imp.load_source('parse_package_xml', os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'parse_package_xml.py')) from parse_package_xml import _get_output # noqa: E402 from parse_package_xml import main # noqa: E402 class ParsePackageXmlTest(unittest.TestCase): def test_get_output(self): pack = Mock() pack.package_format = 2 pack.name = 'foopack' pack.version = '0.1.2' pack.maintainers = ['m1', 'm2'] pack.build_depends = ['bd1', 'bd2'] pack.buildtool_depends = ['catkin'] pack.build_export_depends = ['bed1', 'bed2'] pack.buildtool_export_depends = ['bted1', 'bted2'] pack.exec_depends = ['ed1', 'ed2'] pack.run_depends = ['rd1', 'rd2'] pack.test_depends = ['td1', 'td2'] pack.doc_depends = ['dd1', 'dd2'] pack.urls = [] pack.exports = [] result = _get_output(pack) self.assertEqual( { 'set(_CATKIN_CURRENT_PACKAGE "foopack")', 'set(foopack_MAINTAINER "m1, m2")', 'set(foopack_PACKAGE_FORMAT "2")', 'set(foopack_DEPRECATED "")', 'set(foopack_VERSION "0.1.2")', 'set(foopack_BUILD_DEPENDS "bd1" "bd2")', 'set(foopack_BUILDTOOL_DEPENDS "catkin")', 'set(foopack_BUILD_EXPORT_DEPENDS "bed1" "bed2")', 'set(foopack_BUILDTOOL_EXPORT_DEPENDS "bted1" "bted2")', 'set(foopack_EXEC_DEPENDS "ed1" "ed2")', 'set(foopack_RUN_DEPENDS "rd1" "rd2")', 'set(foopack_TEST_DEPENDS "td1" "td2")', 'set(foopack_DOC_DEPENDS "dd1" "dd2")', 'set(foopack_URL_BUGTRACKER "")', 'set(foopack_URL_REPOSITORY "")', 'set(foopack_URL_WEBSITE "")', }, set(result)) def test_main(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'package.xml') check_file = os.path.join(rootdir, 'foo.cmake') with open(src_file, 'w') as fhand: fhand.write(""" foopack 0.1.2 foo foo foo http://www.example.com/issues http://www.example.com/repo http://www.example.com rd1 rd2 bd1 bd2 """) main([src_file, check_file]) self.assertTrue(os.path.isfile(check_file)) with open(check_file, 'r') as fhand: contents = fhand.read() self.assertEqual( { 'set(_CATKIN_CURRENT_PACKAGE "foopack")', 'set(foopack_MAINTAINER "foo ")', 'set(foopack_PACKAGE_FORMAT "1")', 'set(foopack_DEPRECATED "")', 'set(foopack_VERSION "0.1.2")', 'set(foopack_BUILD_DEPENDS "bd1" "bd2")', 'set(foopack_BUILDTOOL_DEPENDS )', 'set(foopack_BUILD_EXPORT_DEPENDS "rd1" "rd2")', 'set(foopack_BUILDTOOL_EXPORT_DEPENDS )', 'set(foopack_EXEC_DEPENDS "rd1" "rd2")', 'set(foopack_RUN_DEPENDS "rd1" "rd2")', 'set(foopack_TEST_DEPENDS )', 'set(foopack_DOC_DEPENDS )', 'set(foopack_URL_BUGTRACKER "http://www.example.com/issues")', 'set(foopack_URL_REPOSITORY "http://www.example.com/repo")', 'set(foopack_URL_WEBSITE "http://www.example.com")', }, set(contents.splitlines())) finally: shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_run_tests.py000066400000000000000000000043521361264727400216270ustar00rootroot00000000000000import imp import os import shutil import tempfile import unittest imp.load_source('run_tests', os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'test', 'run_tests.py')) from run_tests import main # noqa: E402 class RunTestsTest(unittest.TestCase): def test_main(self): try: rootdir = tempfile.mkdtemp() results_file = os.path.join(rootdir, 'foo', 'testfile.xml') placeholder = os.path.join(rootdir, 'foo', 'MISSING-testfile.xml') # check_file = os.path.join(rootdir, 'checkfile') # with open(src_file, 'w') as fhand: # fhand.write('foo') # self.assertTrue(os.path.isfile(check_file)) main([results_file, 'true', '--working-dir', rootdir]) self.assertFalse(os.path.exists(results_file)) self.assertTrue(os.path.exists(placeholder)) with open(placeholder, 'r') as fhand: contents = fhand.read() self.assertTrue(results_file in contents) os.remove(placeholder) main([results_file, "echo '' > %s" % results_file, '--working-dir', rootdir]) self.assertTrue(os.path.exists(results_file)) self.assertFalse(os.path.exists(placeholder)) os.remove(results_file) # no working dir given main([results_file, "echo '' > %s" % results_file]) self.assertTrue(os.path.exists(results_file)) self.assertFalse(os.path.exists(placeholder)) os.remove(results_file) # make sure resultsfile is deleted main([results_file, 'true', '--working-dir', rootdir]) self.assertFalse(os.path.exists(results_file)) self.assertTrue(os.path.exists(placeholder)) with open(placeholder, 'r') as fhand: contents = fhand.read() self.assertTrue(results_file in contents) finally: shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_setup_util.py000066400000000000000000000145161361264727400220010ustar00rootroot00000000000000import os import shutil import sys import tempfile import unittest from catkin_pkg.cmake import configure_file data = configure_file(os.path.join(os.path.dirname(__file__), '..', '..', 'cmake', 'templates', '_setup_util.py.in'), { 'CATKIN_LIB_ENVIRONMENT_PATHS': "'lib'", 'CATKIN_PKGCONFIG_ENVIRONMENT_PATHS': "os.path.join('lib', 'pkgconfig')", 'CATKIN_GLOBAL_BIN_DESTINATION': 'bin', 'PYTHON_EXECUTABLE': sys.executable, 'PYTHON_INSTALL_DIR': 'pythonX.Y/packages', 'CMAKE_PREFIX_PATH_AS_IS': '', }) with tempfile.NamedTemporaryFile('w+') as setup_util_file: setup_util_file.write(data) setup_util_file.seek(0) import imp imp.load_source('setup_util', setup_util_file.name, setup_util_file.file) from setup_util import CATKIN_MARKER_FILE # noqa: E402 from setup_util import _get_workspaces # noqa: E402 from setup_util import _prefix_env_variable # noqa: E402 from setup_util import _rollback_env_variable # noqa: E402 class SetupUtilTest(unittest.TestCase): def test_get_reversed_workspaces(self): try: rootdir = tempfile.mkdtemp() mock_env = {} self.assertEqual([], _get_workspaces(mock_env)) self.assertEqual([], _get_workspaces(mock_env, 'foo')) foows = os.path.join(rootdir, 'foo') os.makedirs(foows) with open(os.path.join(foows, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('') barws = os.path.join(rootdir, 'bar') os.makedirs(barws) with open(os.path.join(barws, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('') nows = os.path.join(rootdir, 'nows') os.makedirs(nows) mock_env = {'CMAKE_PREFIX_PATH': foows} self.assertEqual([foows], _get_workspaces(mock_env)) mock_env = {'CMAKE_PREFIX_PATH': os.pathsep.join([nows, foows, barws, 'invalid'])} self.assertEqual([foows, barws], _get_workspaces(mock_env)) finally: shutil.rmtree(rootdir) def test_prefix_env(self): try: rootdir = tempfile.mkdtemp() foo_path = os.path.join(rootdir, 'foo') os.makedirs(foo_path) bar_path = os.path.join(rootdir, 'bar') os.makedirs(bar_path) baz_path = os.path.join(rootdir, 'baz') bam_path = os.path.join(rootdir, 'bam') lim_path = os.path.join(rootdir, 'lim') os.makedirs(lim_path) mock_env = {} self.assertEqual('', _prefix_env_variable(mock_env, 'varname', [], '')) self.assertEqual(os.pathsep.join([foo_path, bar_path]), _prefix_env_variable(mock_env, 'varname', [foo_path, bar_path, baz_path], '')) mock_env = {'varname': os.pathsep.join([baz_path, bar_path, bam_path])} self.assertEqual('', _prefix_env_variable(mock_env, 'varname', [], '')) self.assertEqual(foo_path + os.pathsep, _prefix_env_variable(mock_env, 'varname', [foo_path, bar_path], '')) self.assertEqual(os.pathsep.join([foo_path, lim_path]) + os.pathsep, _prefix_env_variable(mock_env, 'varname', [foo_path, lim_path, foo_path, lim_path], '')) finally: shutil.rmtree(rootdir) def test_remove_from_env(self): altsep = os.path.altsep try: rootdir = tempfile.mkdtemp() mock_env = {} # foows foows = os.path.join(rootdir, 'foo') foolib = os.path.join(foows, 'lib') + '/' os.makedirs(foows) with open(os.path.join(foows, '.catkin'), 'w') as fhand: fhand.write('') # barws barws = os.path.join(rootdir, 'bar') barlib = os.path.join(barws, 'lib') os.makedirs(barws) with open(os.path.join(barws, '.catkin'), 'w') as fhand: fhand.write('') # mock_env with one ws in CPP varname = 'varname' wsvarname = 'workspaces' mock_env = {varname: os.pathsep.join([foolib, barlib]), 'CMAKE_PREFIX_PATH': barws} # since workspace foo is not in CMAKE_PREFIX_PATH, it remains in varname self.assertEqual(foolib, _rollback_env_variable(mock_env, varname, ['/lib'])) # mock_env with both ws in CPP mock_env = {varname: os.pathsep.join([foolib, barlib]), wsvarname: os.pathsep.join([foows, barws]), 'CMAKE_PREFIX_PATH': os.pathsep.join([foows, barws])} self.assertEqual(None, _rollback_env_variable(mock_env, varname, [''])) self.assertEqual(None, _rollback_env_variable(mock_env, varname, ['nolib'])) self.assertEqual(None, _rollback_env_variable(mock_env, varname, ['/nolib'])) self.assertEqual('', _rollback_env_variable(mock_env, varname, ['lib'])) self.assertEqual('', _rollback_env_variable(mock_env, varname, ['/lib'])) self.assertEqual(None, _rollback_env_variable(mock_env, varname, [''])) self.assertEqual('', _rollback_env_variable(mock_env, wsvarname, [''])) # nows: not a workspace nows = os.path.join(rootdir, 'nows') nowslib = os.path.join(nows, 'lib') nowslib = os.path.join(nows, 'include') os.makedirs(nows) mock_env = {'varname': os.pathsep.join([foolib, nowslib, barlib, foolib]), 'CMAKE_PREFIX_PATH': os.pathsep.join([foows, barws])} # checks nows/lib remains, and second mention of foolib self.assertEqual(os.pathsep.join([nowslib, foolib]), _rollback_env_variable(mock_env, 'varname', ['/lib'])) self.assertEqual(os.pathsep.join([nowslib, foolib]), _rollback_env_variable(mock_env, 'varname', ['lib'])) # windows pathsep os.path.altsep = '\\' self.assertEqual(os.pathsep.join([nowslib, foolib]), _rollback_env_variable(mock_env, 'varname', ['\\lib'])) finally: os.path.altsep = altsep shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_test_results.py000066400000000000000000000127261361264727400223450ustar00rootroot00000000000000# coding:utf-8 import os import shutil import sys import tempfile import unittest try: from cStringIO import StringIO except ImportError: from io import StringIO try: # 'import as' required to protect nosetests import catkin.test_results as catkin_test_results except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) class TestResultsTest(unittest.TestCase): def test_read_junit(self): try: rootdir = tempfile.mkdtemp() result_file = os.path.join(rootdir, 'test1.xml') with open(result_file, 'w') as fhand: fhand.write('') (num_tests, num_errors, num_failures) = catkin_test_results.read_junit(result_file) self.assertEqual((5, 1, 3), (num_tests, num_errors, num_failures)) (num_tests, num_errors, num_failures, num_skipped) = catkin_test_results.read_junit2(result_file) self.assertEqual((5, 1, 3, 2), (num_tests, num_errors, num_failures, num_skipped)) finally: shutil.rmtree(rootdir) def test_read_junit_skip(self): try: rootdir = tempfile.mkdtemp() result_file = os.path.join(rootdir, 'test1.xml') with open(result_file, 'w') as fhand: fhand.write('') (num_tests, num_errors, num_failures) = catkin_test_results.read_junit(result_file) self.assertEqual((5, 1, 3), (num_tests, num_errors, num_failures)) (num_tests, num_errors, num_failures, num_skipped) = catkin_test_results.read_junit2(result_file) self.assertEqual((5, 1, 3, 2), (num_tests, num_errors, num_failures, num_skipped)) finally: shutil.rmtree(rootdir) def test_test_results(self): try: rootdir = tempfile.mkdtemp() for filename in ['test1.xml', 'test2.xml', 'foo.bar']: result_file = os.path.join(rootdir, filename) with open(result_file, 'w') as fhand: fhand.write('') results = catkin_test_results.test_results(rootdir) self.assertEqual({'test1.xml': (5, 1, 3), 'test2.xml': (5, 1, 3)}, results) results = catkin_test_results.test_results2(rootdir) self.assertEqual({'test1.xml': (5, 1, 3, 2), 'test2.xml': (5, 1, 3, 2)}, results) finally: shutil.rmtree(rootdir) def test_test_results_detail(self): try: oldstdout = sys.stdout sys.stdout = StringIO() rootdir = tempfile.mkdtemp() test_xml = 'test.xml' test_suites = '' result_file = os.path.join(rootdir, test_xml) with open(result_file, 'w') as fhand: fhand.write(test_suites) results = catkin_test_results.test_results(rootdir, show_verbose=True) self.assertEqual({test_xml: (5, 1, 3)}, results) summary = sys.stdout.getvalue() self.assertTrue(test_xml in summary, summary) self.assertTrue(test_suites in summary, summary) finally: shutil.rmtree(rootdir) sys.stdout = oldstdout def test_test_results_detail_with_non_ascii(self): try: oldstdout = sys.stdout sys.stdout = StringIO() rootdir = tempfile.mkdtemp() test_xml = 'test.xml' test_suites = '' result_file = os.path.join(rootdir, test_xml) with open(result_file, 'w') as fhand: fhand.write(test_suites) results = catkin_test_results.test_results(rootdir, show_verbose=True) self.assertEqual({test_xml: (5, 1, 3)}, results) summary = sys.stdout.getvalue() self.assertTrue(test_xml in summary, summary) self.assertTrue(test_suites in summary, summary) finally: shutil.rmtree(rootdir) sys.stdout = oldstdout print(summary) def test_print_summary(self): results = {'test1.xml': (5, 1, 3, 2), 'test2.xml': (7, 2, 4, 1)} try: oldstdout = sys.stdout sys.stdout = StringIO() catkin_test_results.print_summary(results) summary = sys.stdout.getvalue() self.assertTrue('5 tests, 1 errors, 3 failures' in summary, summary) self.assertTrue('7 tests, 2 errors, 4 failures' in summary, summary) self.assertTrue('12 tests, 3 errors, 7 failures' in summary, summary) sys.stdout = StringIO() catkin_test_results.print_summary2(results) summary = sys.stdout.getvalue() self.assertTrue('5 tests, 1 errors, 3 failures, 2 skipped' in summary, summary) self.assertTrue('7 tests, 2 errors, 4 failures, 1 skipped' in summary, summary) self.assertTrue('12 tests, 3 errors, 7 failures, 3 skipped' in summary, summary) finally: sys.stdout = oldstdout catkin-0.8.0/test/unit_tests/test_tidy_xml.py000066400000000000000000000025721361264727400214340ustar00rootroot00000000000000import os import shutil import tempfile import unittest try: from catkin.tidy_xml import tidy_xml, _SAFE_XML_REGEX except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) try: char = unichr except NameError: char = chr class TidyXmlTest(unittest.TestCase): def test_safe_xml_regex(self): for data in [char(0), char(14)]: self.assertIsNotNone(_SAFE_XML_REGEX.match(data)) def test_tiny_xml(self): try: rootdir = tempfile.mkdtemp() not_exist_file = os.path.join(rootdir, 'not_exist') self.assertRaises(ValueError, tidy_xml, not_exist_file) utf8_file = os.path.join(rootdir, 'utf8.xml') with open(utf8_file, 'ab') as fhand: fhand.write(char(0).encode('utf8)')) tidy_xml(utf8_file) with open(utf8_file, 'r') as fhand: contents = fhand.read() self.assertEqual('?', contents) iso_file = os.path.join(rootdir, 'iso.xml') with open(iso_file, 'ab') as fhand: fhand.write(char(0).encode('ascii')) tidy_xml(iso_file) with open(iso_file, 'r') as fhand: contents = fhand.read() self.assertEqual('?', contents) finally: shutil.rmtree(rootdir) catkin-0.8.0/test/unit_tests/test_workspace.py000066400000000000000000000045031361264727400215750ustar00rootroot00000000000000import os import shutil import tempfile import unittest try: from catkin.workspace import get_workspaces, get_source_paths from catkin.workspace import CATKIN_MARKER_FILE import catkin.workspace except ImportError as impe: raise ImportError( 'Please adjust your pythonpath before running this test: %s' % str(impe)) class WorkspaceTest(unittest.TestCase): def test_get_workspaces(self): old_environ = os.environ try: root_dir = tempfile.mkdtemp() ws1 = os.path.join(root_dir, 'ws1') ws2 = os.path.join(root_dir, 'ws2') os.makedirs(ws1) os.makedirs(ws2) with open(os.path.join(ws1, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('loc1;loc2') with open(os.path.join(ws2, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('loc3;loc4') catkin.workspace.os.environ = {} self.assertEqual([], get_workspaces()) catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ''} self.assertEqual([], get_workspaces()) catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ws1} self.assertEqual([ws1], get_workspaces()) catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': 'nowhere'} self.assertEqual([], get_workspaces()) catkin.workspace.os.environ = {'CMAKE_PREFIX_PATH': ws2 + os.pathsep + ws1} self.assertEqual([ws2, ws1], get_workspaces()) finally: shutil.rmtree(root_dir) os.environ = old_environ catkin.workspace.os.environ = os.environ def test_get_source_paths(self): try: root_dir = tempfile.mkdtemp() ws1 = os.path.join(root_dir, 'ws1') ws2 = os.path.join(root_dir, 'ws2') os.makedirs(ws1) os.makedirs(ws2) with open(os.path.join(ws1, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('loc1;loc2') with open(os.path.join(ws2, CATKIN_MARKER_FILE), 'w') as fhand: fhand.write('') self.assertEqual(['loc1', 'loc2'], get_source_paths(ws1)) self.assertEqual([], get_source_paths(ws2)) self.assertRaises(ValueError, get_source_paths, root_dir) finally: shutil.rmtree(root_dir) catkin-0.8.0/test/utils.py000066400000000000000000000153131361264727400155000ustar00rootroot00000000000000from __future__ import print_function from sys import version_info import os import shutil import subprocess import unittest import tempfile # import platform # ubuntudist = platform.dist()[2] PYTHON_INSTALL_PATH = os.path.join('lib', 'python%u.%u' % (version_info[0], version_info[1]), 'dist-packages') TESTS_DIR = os.path.dirname(__file__) CATKIN_DIR = os.path.dirname(TESTS_DIR) TEMP_DIR = os.path.join(TESTS_DIR, 'tmp') if not os.path.isdir(TEMP_DIR): os.makedirs(TEMP_DIR) # network_tests_path = os.path.join(TESTS_DIR, 'network_tests') MOCK_DIR = os.path.join(TESTS_DIR, 'mock_resources') # MAKE_CMD = ['make', 'VERBOSE=1', '-j8'] MAKE_CMD = ['make', '-j8'] def rosinstall(pth, specfile): ''' calls rosinstall in pth with given specfile, then replaces CMakelists with catkin's toplevel.cmake' ''' assert os.path.exists(specfile), specfile # to save testing time, we do not invoke rosinstall when we # already have a .rosinstall file if not os.path.exists(os.path.join(pth, '.rosinstall')): succeed(["rosinstall", "-j8", "--catkin", "-n", pth, specfile, '--continue-on-error'], cwd=TESTS_DIR) def run(args, **kwargs): """ Call to Popen, returns (errcode, stdout, stderr) """ print("run:", args) p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=kwargs.get('cwd', None)) print("P==", p.__dict__) (stdout, stderr) = p.communicate() return (p.returncode, stdout, stderr) def create_catkin_workspace(pth): """ prepares path to be a catkin workspace, by copying catkin and creating a CMakeLists.txt """ if not os.path.isdir(pth): os.makedirs(pth) catkin_dir = os.path.join(pth, 'catkin') if os.path.isdir(catkin_dir): shutil.rmtree(catkin_dir) # copy current catkin sources into workspace # avoid copying tmp, as that may contain all of ros core def notest(folder, contents): if folder.endswith('test'): return ['tmp'] return [] shutil.copytree(CATKIN_DIR, catkin_dir, symlinks=True, ignore=notest) assert (os.path.exists(pth + "/catkin/cmake/toplevel.cmake")), \ pth + "/catkin/cmake/toplevel.cmake" # workaround for current rosinstall creating flawed CMakelists workspace_cmake = os.path.join(pth, "CMakeLists.txt") if os.path.isfile(workspace_cmake): os.remove(workspace_cmake) succeed(["/bin/ln", "-s", "catkin/cmake/toplevel.cmake", "CMakeLists.txt"], cwd=pth) def succeed(cmd, **kwargs): """ Call to Popen, returns stdout, or fails """ print(">>>", cmd, kwargs) (r, out, err) = run(cmd, **kwargs) print("<<<", out) assert r == 0, "cmd failed with result %s:\n %s " % (r, str(cmd)) return out def fail(cmd, **kwargs): """ runs command expecting it to return non-zero """ print(">>>", cmd, kwargs) (r, out, err) = run(cmd, withexitstatus=True, **kwargs) print("<<<", out) assert 0 != r, """cmd succeeded, though should fail: %s result=%u\n output=\n%s""" % (cmd, r, out) return out class AbstractCatkinWorkspaceTest(unittest.TestCase): """ Parent class for any test case that creates a workspace and calls cmake, make, and make install. Creates a suitable folder structure either in /tmp or in a root folder specified on init, that is a build folder, and a src folder with latest catkin from source. """ def __init__(self, testCaseName, rootdir=None): super(AbstractCatkinWorkspaceTest, self).__init__(testCaseName) self.rootdir = rootdir def setUp(self): # directories to delete in teardown self.directories = {} if self.rootdir is None: self.rootdir = tempfile.mkdtemp() self.directories['root'] = self.rootdir self.builddir = os.path.join(self.rootdir, "build") self.develspace = os.path.join(self.builddir, 'devel') self.workspacedir = os.path.join(self.rootdir, "src") self.installdir = os.path.join(self.rootdir, "install") if not os.path.exists(self.builddir): os.makedirs(self.builddir) self.setupWorkspaceContents() def setupWorkspaceContents(self): create_catkin_workspace(self.workspacedir) # comment this to investigate results, cleanup tmp folders # manually def tearDown(self): for d in self.directories: shutil.rmtree(self.directories[d]) self.directories = {} def cmake(self, cwd=None, srcdir=None, installdir=None, prefix_path=None, expect=succeed, **kwargs): """ invokes cmake :param cwd: changes build dir :param srcdir: changes sourcedir :param installdir: changes installdir :param prefix_path: where to cmake against (where to find) :param expect: one of functions: succeed, fail :param kwargs: (cwd, srcdir, expect) or stuff that will be added to the cmake command """ args = [] if cwd is None: cwd = self.builddir if srcdir is None: srcdir = self.workspacedir this_builddir = cwd this_srcdir = srcdir print("v~_", this_builddir, this_srcdir) if 'CATKIN_DPKG_BUILDPACKAGE_FLAGS' not in kwargs: kwargs['CATKIN_DPKG_BUILDPACKAGE_FLAGS'] = '-d;-S;-us;-uc' for k, v in kwargs.items(): print("~v^v~", k, v) args += ["-D%s=%s" % (k, v)] if not 'CMAKE_INSTALL_PREFIX' in kwargs: if installdir is None: installdir = self.installdir args += ["-DCMAKE_INSTALL_PREFIX=%s" % (installdir)] if not 'CMAKE_PREFIX_PATH' in kwargs: if prefix_path is None: prefix_path = self.installdir args += ["-DCMAKE_PREFIX_PATH=%s" % (prefix_path)] if not os.path.isdir(this_builddir): os.makedirs(this_builddir) cmd = ["cmake", this_srcdir] + args o = expect(cmd, cwd=this_builddir) if (expect == succeed): self.assertTrue(os.path.isfile(this_builddir + "/CMakeCache.txt")) self.assertTrue(os.path.isfile(this_builddir + "/Makefile")) return o def assert_exists(prefix, *args): """ Convenience function calling exists for all files in args with prefix """ for arg in args: p = os.path.join(prefix, arg) print("Checking for", p) assert os.path.exists(p), "%s doesn't exist" % p