pax_global_header00006660000000000000000000000064142035611230014507gustar00rootroot0000000000000052 comment=199ac7a046cbf686912a198a41a501858382af60 ament_cmake-1.3.0/000077500000000000000000000000001420356112300137545ustar00rootroot00000000000000ament_cmake-1.3.0/CONTRIBUTING.md000066400000000000000000000016231420356112300162070ustar00rootroot00000000000000Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that [license](http://www.apache.org/licenses/LICENSE-2.0.html): ~~~ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. ~~~ Contributors must sign-off each commit by adding a `Signed-off-by: ...` line to commit messages to certify that they have the right to submit the code they are contributing to the project according to the [Developer Certificate of Origin (DCO)](https://developercertificate.org/). ament_cmake-1.3.0/LICENSE000066400000000000000000000261361420356112300147710ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ament_cmake-1.3.0/ament_cmake/000077500000000000000000000000001420356112300162205ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake/CHANGELOG.rst000066400000000000000000000101671420356112300202460ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Add ament_cmake_gen_version_h package (`#198 `_) * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz, serge-nikulin 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * deprecate ament_export_interfaces() in favor of ament_export_targets() (`#238 `_) * duplicate ament_cmake_export_interfaces to ament_cmake_export_targets * update names in ament_cmake_export_targets after duplicating the files, add deprecation message for ament_export_interfaces(), add ament_cmake_export_targets to ament_cmake * Contributors: Dirk Thomas 0.8.1 (2019-10-23) ------------------ * add CMake macro ament_bump_development_version_if_necessary (`#204 `_) * add CMake macro ament_bump_development_version_if_necessary * Update ament_cmake_version/cmake/ament_bump_development_version_if_necessary.cmake Co-Authored-By: William Woodall * Update ament_cmake_version/cmake/ament_bump_development_version_if_necessary.cmake Co-Authored-By: William Woodall * quote versions in message * spelling: no-op * update macro name, add doc line about multiple invocations * Contributors: Dirk Thomas 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * Merge pull request `#71 `_ from ament/export_link_flags add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * require CMake 3.5 * Merge pull request `#35 `_ from ament/change_test_dependencies remove gmock/gtest/nose packages from ament_cmake * remove gmock/gtest/nose packages from ament_cmake * add explicit build type * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * add ament_cmake_libraries * add ament_cmake_target_dependencies * update cmake code style * add ament_cmake_gmock * add ament_cmake_environment_hooks * add ament_cmake_test, ament_cmake_gtest, ament_cmake_nose * fix dependency * add ament_cmake * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake/CMakeLists.txt000066400000000000000000000011721420356112300207610ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake NONE) find_package(ament_cmake_core REQUIRED) find_package(ament_cmake_export_dependencies REQUIRED) ament_export_dependencies( "ament_cmake_core" "ament_cmake_export_definitions" "ament_cmake_export_dependencies" "ament_cmake_export_include_directories" "ament_cmake_export_interfaces" "ament_cmake_export_libraries" "ament_cmake_export_link_flags" "ament_cmake_export_targets" "ament_cmake_gen_version_h" "ament_cmake_libraries" "ament_cmake_python" "ament_cmake_target_dependencies" "ament_cmake_test" "ament_cmake_version" ) ament_package() ament_cmake-1.3.0/ament_cmake/package.xml000066400000000000000000000034521420356112300203410ustar00rootroot00000000000000 ament_cmake 1.3.0 The entry point package for the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas cmake cmake ament_cmake_core ament_cmake_export_dependencies ament_cmake_core ament_cmake_export_definitions ament_cmake_export_dependencies ament_cmake_export_include_directories ament_cmake_export_interfaces ament_cmake_export_libraries ament_cmake_export_link_flags ament_cmake_export_targets ament_cmake_gen_version_h ament_cmake_libraries ament_cmake_python ament_cmake_target_dependencies ament_cmake_test ament_cmake_version ament_cmake ament_cmake-1.3.0/ament_cmake_auto/000077500000000000000000000000001420356112300172505ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_auto/CHANGELOG.rst000066400000000000000000000103271420356112300212740ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_auto ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Fix typo in ament_auto_find_test_dependencies (`#363 `_) * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Daisuke Nishimatsu 1.2.0 (2021-10-29) ------------------ * Add ament_auto_add_gtest (`#344 `_) * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Joshua Whitley, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * pass unparsed argument of ament_auto_package() to ament_package() (`#194 `_) * Contributors: Dirk Thomas 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ * Add option to ament_auto_package to install to share folder: (`#166 `_) - This will simplify installing folders like 'cmake' and 'launch' into a package's shared folder * Contributors: jpsamper2009 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * Install ament_cmake_auto executables to libexec by default (`#97 `_) * Install ament_cmake_auto executables to libexec by default * update docblock * simplify installing executables * 0.0.2 * Add optional list of required packages for ament_auto_find_build_dependencies (`#93 `_) * Add optional list of required packages * Prefix ARG variables + fixup * REQUIRED_PACKAGES -> REQUIRED * Output all ignored packages at once * Pass REQUIRED in addition to QUIET, not instead of * _ignored_pacakges -> _additional_packages * De-duplicate the find_package call * rename var and small changes * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * Merge pull request `#84 `_ from ament/use_in_list use IN_LIST * use IN_LIST * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * Merge pull request `#3 `_ from ament/windows Windows Support * [windows] fixed installation of dll's * use project(.. NONE) * deal with CMake double expansion * add ament_cmake_libraries * update cmake code style * add ament_cmake_auto * Contributors: Dirk Thomas, William Woodall, dhood ament_cmake-1.3.0/ament_cmake_auto/CMakeLists.txt000066400000000000000000000004261420356112300220120ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_auto NONE) find_package(ament_cmake REQUIRED) find_package(ament_cmake_gtest REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_auto-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_auto/ament_cmake_auto-extras.cmake000066400000000000000000000022301420356112300250470ustar00rootroot00000000000000# 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. # copied from ament_cmake_auto/ament_cmake_auto-extras.cmake find_package(ament_cmake QUIET REQUIRED) include("${ament_cmake_auto_DIR}/ament_auto_add_executable.cmake") include("${ament_cmake_auto_DIR}/ament_auto_add_gtest.cmake") include("${ament_cmake_auto_DIR}/ament_auto_add_library.cmake") include("${ament_cmake_auto_DIR}/ament_auto_generate_code.cmake") include("${ament_cmake_auto_DIR}/ament_auto_find_build_dependencies.cmake") include("${ament_cmake_auto_DIR}/ament_auto_find_test_dependencies.cmake") include("${ament_cmake_auto_DIR}/ament_auto_package.cmake") ament_cmake-1.3.0/ament_cmake_auto/cmake/000077500000000000000000000000001420356112300203305ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_add_executable.cmake000066400000000000000000000055531420356112300265070ustar00rootroot00000000000000# 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. # # Add an executable target. # # All arguments of the CMake function ``add_executable()`` can be # used beside the custom arguments ``DIRECTORY`` and # ``NO_TARGET_LINK_LIBRARIES``. # # :param target: the name of the executable target # :type target: string # :param DIRECTORY: the directory to recursively glob for source # files with the following extensions: c, cc, cpp, cxx # :type DIRECTORY: string # :param NO_TARGET_LINK_LIBRARIES: if set skip linking against # ``${PROJECT_NAME}_LIBRARIES`` # :type NO_TARGET_LINK_LIBRARIES: option # # Append the target to the ``${PROJECT_NAME}_EXECUTABLES`` variable. # # @public # macro(ament_auto_add_executable target) cmake_parse_arguments(ARG "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;NO_TARGET_LINK_LIBRARIES" "DIRECTORY" "" ${ARGN}) if(NOT ARG_DIRECTORY AND NOT ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_auto_add_executable() called without any " "source files and without a DIRECTORY argument") endif() set(_source_files "") if(ARG_DIRECTORY) # glob all source files file( GLOB_RECURSE _source_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${ARG_DIRECTORY}/*.c" "${ARG_DIRECTORY}/*.cc" "${ARG_DIRECTORY}/*.cpp" "${ARG_DIRECTORY}/*.cxx" ) if(NOT _source_files) message(FATAL_ERROR "ament_auto_add_executable() no source files found " "in directory '${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}'") endif() endif() # parse again to "remove" custom arguments cmake_parse_arguments(ARG "NO_TARGET_LINK_LIBRARIES" "DIRECTORY" "" ${ARGN}) add_executable("${target}" ${ARG_UNPARSED_ARGUMENTS} ${_source_files}) # add include directory of this package if it exists if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories("${target}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") endif() # link against other libraries of this package if(NOT ${PROJECT_NAME}_LIBRARIES STREQUAL "" AND NOT ARG_NO_TARGET_LINK_LIBRARIES) target_link_libraries("${target}" ${${PROJECT_NAME}_LIBRARIES}) endif() # add exported information from found build dependencies ament_target_dependencies(${target} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS}) list(APPEND ${PROJECT_NAME}_EXECUTABLES "${target}") endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_add_gtest.cmake000066400000000000000000000077061420356112300255160ustar00rootroot00000000000000# Copyright 2021 Whitley Software Services, LLC # # 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. # # Add a gtest with all found test dependencies. # # Call add_executable(target ARGN), link it against the gtest libraries # and all found test dependencies, and then register the executable as a test. # # If gtest is not available the specified target is not being created and # therefore the target existence should be checked before being used. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param RUNNER: the path to the test runner script (default: # see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the gtest # main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # macro(ament_auto_add_gtest target) cmake_parse_arguments(_ARGN "SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(NOT _ARGN_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_auto_add_gtest() must be invoked with at least one source file") endif() # add executable set(_argn_executable ${_ARGN_UNPARSED_ARGUMENTS}) if(_ARG_SKIP_LINKING_MAIN_LIBRARIES) list(APPEND _argn_executable "SKIP_LINKING_MAIN_LIBRARIES") endif() ament_add_gtest_executable("${target}" ${_argn_executable}) # add include directory of this package if it exists if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories("${target}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") endif() # link against other libraries of this package if(NOT ${PROJECT_NAME}_LIBRARIES STREQUAL "") target_link_libraries("${target}" ${${PROJECT_NAME}_LIBRARIES}) endif() # add exported information from found dependencies ament_target_dependencies(${target} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS} ${${PROJECT_NAME}_FOUND_TEST_DEPENDS} ) # add test set(_argn_test "") if(_ARG_RUNNER) list(APPEND _argn_test "RUNNER" "${_ARG_RUNNER}") endif() if(_ARG_TIMEOUT) list(APPEND _argn_test "TIMEOUT" "${_ARG_TIMEOUT}") endif() if(_ARG_WORKING_DIRECTORY) list(APPEND _argn_test "WORKING_DIRECTORY" "${_ARG_WORKING_DIRECTORY}") endif() if(_ARG_SKIP_TEST) list(APPEND _argn_test "SKIP_TEST") endif() if(_ARG_ENV) list(APPEND _argn_test "ENV" ${_ARG_ENV}) endif() if(_ARG_APPEND_ENV) list(APPEND _argn_test "APPEND_ENV" ${_ARG_APPEND_ENV}) endif() if(_ARG_APPEND_LIBRARY_DIRS) list(APPEND _argn_test "APPEND_LIBRARY_DIRS" ${_ARG_APPEND_LIBRARY_DIRS}) endif() ament_add_gtest_test("${target}" ${_argn_test}) endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_add_library.cmake000066400000000000000000000055221420356112300260260ustar00rootroot00000000000000# 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. # # Add a library target. # # All arguments of the CMake function ``add_library()`` can be used # beside the custom arguments ``DIRECTORY`` and # ``NO_TARGET_LINK_LIBRARIES``. # # :param target: the name of the library target # :type target: string # :param DIRECTORY: the directory to recursively glob for source # files with the following extensions: c, cc, cpp, cxx # :type DIRECTORY: string # :param NO_TARGET_LINK_LIBRARIES: if set skip linking against # ``${PROJECT_NAME}_LIBRARIES`` # :type NO_TARGET_LINK_LIBRARIES: option # # Append the target to the ``${PROJECT_NAME}_LIBRARIES`` variable. # # @public # macro(ament_auto_add_library target) cmake_parse_arguments(ARG "STATIC;SHARED;MODULE;EXCLUDE_FROM_ALL;NO_TARGET_LINK_LIBRARIES" "DIRECTORY" "" ${ARGN}) if(NOT ARG_DIRECTORY AND NOT ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_auto_add_library() called without any source " "files and without a DIRECTORY argument") endif() set(_source_files "") if(ARG_DIRECTORY) # glob all source files file( GLOB_RECURSE _source_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${ARG_DIRECTORY}/*.c" "${ARG_DIRECTORY}/*.cc" "${ARG_DIRECTORY}/*.cpp" "${ARG_DIRECTORY}/*.cxx" ) if(NOT _source_files) message(FATAL_ERROR "ament_auto_add_library() no source files found in " "directory '${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}'") endif() endif() # parse again to "remove" custom arguments cmake_parse_arguments(ARG "NO_TARGET_LINK_LIBRARIES" "DIRECTORY" "" ${ARGN}) add_library("${target}" ${ARG_UNPARSED_ARGUMENTS} ${_source_files}) # add include directory of this package if it exists if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories("${target}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") endif() # link against other libraries of this package if(NOT ${PROJECT_NAME}_LIBRARIES STREQUAL "" AND NOT ARG_NO_TARGET_LINK_LIBRARIES) target_link_libraries("${target}" ${${PROJECT_NAME}_LIBRARIES}) endif() # add exported information from found build dependencies ament_target_dependencies(${target} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS}) list(APPEND ${PROJECT_NAME}_LIBRARIES "${target}") endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_find_build_dependencies.cmake000066400000000000000000000063351420356112300303620ustar00rootroot00000000000000# 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. # # Invoke find_package() for all build and buildtool dependencies. # # :param REQUIRED: an optional list of package names that are known # required CMake dependencies. For these dependencies, find_package() will be # invoked with REQUIRED. # :type REQUIRED: list of strings # # All found package names are appended to the # ``${PROJECT_NAME}_FOUND_BUILD_DEPENDS`` / # ``${PROJECT_NAME}_FOUND_BUILDTOOL_DEPENDS`` variables. # # The content of the package specific variables of build dependencies # ending with ``_DEFINITIONS``, ``_INCLUDE_DIRS`` and ``_LIBRARIES`` # are appended to the same variables starting with # ``${PROJECT_NAME}_FOUND_``. # # @public # macro(ament_auto_find_build_dependencies) cmake_parse_arguments(_ARG "" "" "REQUIRED" ${ARGN}) if(_ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_auto_find_build_dependencies() called with " "unused arguments: ${_ARG_UNPARSED_ARGUMENTS}") endif() if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() # ensure that the caller isn't expecting packages not listed in the manifest set(_unknown_packages "") foreach(_package_name ${_ARG_REQUIRED}) if(NOT _package_name IN_LIST ${PROJECT_NAME}_BUILD_DEPENDS AND NOT _package_name IN_LIST ${PROJECT_NAME}_BUILDTOOL_DEPENDS ) list(APPEND _unknown_packages ${_package_name}) endif() endforeach() if(_unknown_packages) string(REPLACE ";" ", " _unknown_packages_str "${_unknown_packages}") message(FATAL_ERROR "ament_auto_find_build_dependencies() called with " "required packages that are not listed as a build/buildtool dependency " "in the package.xml: ${_unknown_packages_str}") endif() # try to find_package() all build dependencies foreach(_dep ${${PROJECT_NAME}_BUILD_DEPENDS}) set(_REQUIRED_KEYWORD "") if(_dep IN_LIST _ARG_REQUIRED) set(_REQUIRED_KEYWORD "REQUIRED") endif() find_package(${_dep} QUIET ${_REQUIRED_KEYWORD}) if(${_dep}_FOUND) list(APPEND ${PROJECT_NAME}_FOUND_BUILD_DEPENDS ${_dep}) list(APPEND ${PROJECT_NAME}_FOUND_DEFINITIONS ${${_dep}_DEFINITIONS}) list(APPEND ${PROJECT_NAME}_FOUND_INCLUDE_DIRS ${${_dep}_INCLUDE_DIRS}) list(APPEND ${PROJECT_NAME}_FOUND_LIBRARIES ${${_dep}_LIBRARIES}) endif() endforeach() # try to find_package() all buildtool dependencies foreach(_dep ${${PROJECT_NAME}_BUILDTOOL_DEPENDS}) set(_REQUIRED_KEYWORD "") if(_dep IN_LIST _ARG_REQUIRED) set(_REQUIRED_KEYWORD "REQUIRED") endif() find_package(${_dep} QUIET ${_REQUIRED_KEYWORD}) if(${_dep}_FOUND) list(APPEND ${PROJECT_NAME}_FOUND_BUILDTOOL_DEPENDS ${_dep}) endif() endforeach() endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_find_test_dependencies.cmake000066400000000000000000000023731420356112300302400ustar00rootroot00000000000000# Copyright 2021 Whitley Software Services, LLC # # 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. # # Invoke find_package() for all test dependencies. # # All found package names are appended to the # ``${PROJECT_NAME}_FOUND_TEST_DEPENDS`` variables. # # @public # macro(ament_auto_find_test_dependencies) set(_ARGN "${ARGN}") if(_ARGN) message(FATAL_ERROR "ament_auto_find_test_dependencies() called with " "unused arguments: ${_ARGN}") endif() if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() # try to find_package() all test dependencies foreach(_dep ${${PROJECT_NAME}_TEST_DEPENDS}) find_package(${_dep} QUIET) if(${_dep}_FOUND) list(APPEND ${PROJECT_NAME}_FOUND_TEST_DEPENDS ${_dep}) endif() endforeach() endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_generate_code.cmake000066400000000000000000000014061420356112300263330ustar00rootroot00000000000000# 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. # # Execute the extension point ``ament_auto_generate_code``. # # @public # macro(ament_auto_generate_code) ament_execute_extensions(ament_auto_generate_code) endmacro() ament_cmake-1.3.0/ament_cmake_auto/cmake/ament_auto_package.cmake000066400000000000000000000066141420356112300251500ustar00rootroot00000000000000# 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. # # Export information, install files and targets, execute the # extension point ``ament_auto_package`` and invoke # ``ament_package()``. # # :param INSTALL_TO_PATH: if set, install executables to `bin` so that # they are available on the `PATH`. # By default they are being installed into `lib/${PROJECT_NAME}`. # It is currently not possible to install some executable into `bin` # and some into `lib/${PROJECT_NAME}`. # Libraries are not affected by this option. # They are always installed into `lib` and `dll`s into `bin`. # :type INSTALL_TO_PATH: option # :param INSTALL_TO_SHARE: a list of directories to be installed to the # package's share directory # :type INSTALL_TO_SHARE: list of strings # :param ARGN: any other arguments are passed through to ament_package() # :type ARGN: list of strings # # Export all found build dependencies which are also run # dependencies. # If the package has an include directory install all recursively # found header files (ending in h, hh, hpp, hxx) and export the # include directory. # Export and install all library targets and install all executable # targets. # # @public # macro(ament_auto_package) cmake_parse_arguments(_ARG "INSTALL_TO_PATH" "" "INSTALL_TO_SHARE" ${ARGN}) # passing all unparsed arguments to ament_package() # export all found build dependencies which are also run dependencies set(_run_depends ${${PROJECT_NAME}_BUILD_EXPORT_DEPENDS} ${${PROJECT_NAME}_BUILDTOOL_EXPORT_DEPENDS} ${${PROJECT_NAME}_EXEC_DEPENDS}) foreach(_dep ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS} ${${PROJECT_NAME}_FOUND_BUILDTOOL_DEPENDS}) if(_dep IN_LIST _run_depends) ament_export_dependencies("${_dep}") endif() endforeach() # export and install include directory of this package if it has one if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include") ament_export_include_directories("include") install(DIRECTORY include/ DESTINATION include) endif() # export and install all libraries if(NOT ${PROJECT_NAME}_LIBRARIES STREQUAL "") ament_export_libraries(${${PROJECT_NAME}_LIBRARIES}) install( TARGETS ${${PROJECT_NAME}_LIBRARIES} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) endif() # install all executables if(NOT ${PROJECT_NAME}_EXECUTABLES STREQUAL "") if(_ARG_INSTALL_TO_PATH) set(_destination "bin") else() set(_destination "lib/${PROJECT_NAME}") endif() install( TARGETS ${${PROJECT_NAME}_EXECUTABLES} DESTINATION ${_destination} ) endif() # install directories to share foreach(_dir ${_ARG_INSTALL_TO_SHARE}) install( DIRECTORY "${_dir}" DESTINATION "share/${PROJECT_NAME}" ) endforeach() ament_execute_extensions(ament_auto_package) ament_package(${_ARG_UNPARSED_ARGUMENTS}) endmacro() ament_cmake-1.3.0/ament_cmake_auto/package.xml000066400000000000000000000015601420356112300213670ustar00rootroot00000000000000 ament_cmake_auto 1.3.0 The auto-magic functions for ease to use of the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake ament_cmake_gtest ament_cmake ament_cmake_gtest ament_cmake ament_cmake-1.3.0/ament_cmake_core/000077500000000000000000000000001420356112300172305ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/CHANGELOG.rst000066400000000000000000000427161420356112300212630ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_core ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Support commands with executable targets (`#352 `_) * doc/resource_index: Indent list subitems correctly (`#342 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Michal Sojka, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Merge pull request `#287 `_ from ament/mjeronimo/add-condition-support * Check condition attr in package.xml dependencies The condition attribute was already parsed when reading the XML file. Just needed to check the condition when adding dependencies to the list for a particular key/target. Fixes `#266 `_ * Address Dirk's code review feedback * Address Dirk's code review feedback * Check condition attr in package.xml dependencies The condition attribute was already parsed when reading the XML file. Just needed to check the condition when adding dependencies to the list for a particular key/target. Fixes `#266 `_ * Update package maintainers. (`#286 `_) * Contributors: Michael Jeronimo, Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Make it possible to ignore a package deprecation warning Wrap the deprecation warning message in a conditional, letting callers set a variable to quiet the warning. * Use DEPRECATION instead of WARNING for package deprecation messages This makes it possible to treat the warnings differently in downstream packages. Refer to the CMake documentation for more info: https://cmake.org/cmake/help/v3.0/command/message.html * [Windows] Adding .lib into the symlink install file list (`#219 `_) * Adding .lib into the symlink install file list * rework. * conditionally guard by WIN32. * fix escaping of regex (`#217 `_) * Fix symlink install versioned shared library (`#216 `_) * Fix symlink install versioned shared library * Update ament_cmake_symlink_install.cmake.in * Use regex for more clear string manipulation. (`#207 `_) I think this reads better. If you don't agree feel free to reject PR * add .dsv env hooks to the local_setup.dsv (`#210 `_) * Contributors: Dan Rose, Dirk Thomas, Jacob Perron, Jafar Abdi, Sean Yen 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * generate a package.dsv file (`#202 `_) * check existance of uninstall target before creating it (`#195 `_) * ensure that PYTHON_INSTALL_DIR is initialized for generated .dsv file (`#190 `_) * ensure that PYTHON_INSTALL_DIR is initialized for generated .dsv file * use native path of PYTHON_INSTALL_DIR * generate .dsv files beside known environment hooks which describe the intended environment change (`#187 `_) * Rename uninstall target so it is unique per project (`#188 `_) * Rename uninstall target so it is unique per project Fixes `#127 `_ * Revert whitespace change * add cumulative uninstall target * Contributors: Alberto Soragna, Dan Rose, Dirk Thomas 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ * close file handle early (`#169 `_) * Contributors: Dirk Thomas 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ * Add option to exclude packages in ament_execute_extensions: (`#165 `_) - This provides a mechanism for 'ament-auto' packages to have their own exclude options * return prefix path in ament_index_has_resource (`#155 `_) * Contributors: Dirk Thomas, jpsamper2009 0.6.0 (2018-11-13) ------------------ * only add existing directories to PATH (`#149 `_) * Contributors: Dirk Thomas 0.5.1 (2018-07-17) ------------------ * fix wrong FOUND flag on repeated inclusion (`#146 `_) * fix wrong FOUND flag on repeated inclusion * avoid FATAL_ERROR, just set it to false * simplify condition * fix using uninitialized CMake variables (`#145 `_) * add signature parameter to docblock (`#144 `_) * Contributors: Dirk Thomas 0.5.0 (2018-06-13) ------------------ * change order of _CONFIG_EXTRAS_POST `#140 `_ * Fix ${PROJECT_NAME}_CONFIG_EXTRAS_POST (`#140 `_) * Fix `#139 `_. * project specific variable after the global populated by functions * fix typos. (`#138 `_) * Always write generated cmake as utf8 (`#136 `_) * Always write output as utf-8. CMake documentation suggests that we should be writing 7-bit ascii CMake source files or writing UTF-8 with a byte order mark. (Source: https://cmake.org/cmake/help/v3.5/manual/cmake-language.7.html#encoding). This doesn't actually do either of those things. It just cements our position of non-compliance (writing utf-8 without a byte order mark) so that builds don't crash if the system encoding is other than utf-8. Alternatively we could sanitize the generated CMake content so it is 7-bit ascii and explicitly write it as such or consider adding the byte order mark. * Always read package.xml as utf-8. Cherry pick of https://github.com/ament/ament_cmake/commit/3d3c02b26948aa3708a3d2d0a924aa2c61a26cb5 * use catkin_pkg to parse manifests (`#137 `_) * fix symlink install from subdirectories (`#134 `_) * add CONFIG_EXTRAS_POST to ament_package() (`#123 `_) * Contributors: Dirk Thomas, Steven! Ragnarök, csukuangfj 0.4.0 (2017-12-08) ------------------ * populate GROUP_DEPENDS and MEMBER_OF_GROUPS cmake variables (`#119 `_) * Merge pull request `#112 `_ from ament/doc_available_env_hooks add doc about CMake variables for environment hooks * add doc about CMake variables for environment hooks * 0.0.3 * Merge pull request `#107 `_ from ament/flake8_plugins update style to satisfy new flake8 plugins * update style to satisfy new flake8 plugins * AMENT_INDEX_BINARY_DIR arg for register_resource_index (`#106 `_) * make installing the markerfile optional (`#105 `_) * make installing the markerfile optional * correct check for unused args * Merge pull request `#103 `_ from ament/resolve_some_todos Resolve some todos * use file(GLOB LIST_DIRECTORIES * remove obsolete todos * add some more info to resource index doc (`#100 `_) * add some more info to resource index doc * typos * missing word * 0.0.2 * fix spelling in docblock * Merge pull request `#89 `_ from ament/symlink_install_targets_with_configs support symlink install for config specific targets * support symlink install for config specific targets * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * Merge pull request `#84 `_ from ament/use_in_list use IN_LIST * use IN_LIST * remove __future_\_ imports * Merge pull request `#77 `_ from ament/composition allow generator expression in resources * allow generator expression in resources * Merge pull request `#76 `_ from ament/parent_prefix_path_placeholder use {prefix} as a placeholder for the install prefix in the parent_prefix_path resource * use {prefix} as a placeholder for the install prefix in the parent_prefix_path resource * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * remove obsolete policies * require CMake 3.5 * fix comment * Merge pull request `#68 `_ from ament/ctest_build_testing use CTest BUILD_TESTING * use CTest BUILD_TESTING * Ignore dot files and subdirectories in get_resources (`#67 `_) * Ignore directories, and files starting with a dot in find_resources * Copyedit * Specify behaviour of get_resources with directories and hidden files * generate all ament index markers into /ament_index_preinstall * use compliant layout for index resources in build space and allow using those * fix optional arguments of ament_index_register_package * allow to skip the AMENT_PREFIX_PATH and / or the folder in the binary dir * fix error handling error * allow overriding default prefix path for ament index CMake API * undo any ; -> \; substitution done to pass PATH lists on Windows * only replace : with ; when no on Windows * Merge pull request `#63 `_ from ament/make_template_paths_relocatable defer evaluation of template paths to each package * defer evaluation of template paths to each package * Merge pull request `#51 `_ from ament/find_package_xml_in_sub_dir look for the package.xml in the project's source dir * look for the package.xml in the project's source dir * Merge pull request `#49 `_ from ament/delete_broken_symlinks also delete broken symlinks * also delete broken symlinks * Merge pull request `#45 `_ from ament/use_message_status avoid using message without STATUS * avoid using message without STATUS * Merge pull request `#42 `_ from ament/reuse_hook_from_ament_package reuse environment hook provided by ament_package * reuse environment hook provided by ament_package * Merge pull request `#41 `_ from ament/cleanup_windows_setup_files cleanup windows setup files * clean up windows setup files * Merge pull request `#40 `_ from ament/consistent_path_sep use consistent path separator * use platform specific path separators * Merge pull request `#37 `_ from ament/test_labels add labels to tests * fix spelling * Merge pull request `#29 `_ from ament/suppress_cmp0026 set cmp0026 to OLD until we can migrate to use $ * update comment and set the policy in two other places * set cmp0026 to OLD until we can migrate to use $ * Merge pull request `#26 `_ from ament/duplicate_resources never return duplicate resources * never return duplicate resources * Merge pull request `#23 `_ from ament/dump_export_to_cmake provide export tags to cmake * provide export tags to cmake * Merge pull request `#21 `_ from ament/load_config_extras_before_exported_information load CONFIG_EXTRAS before exported information * load CONFIG_EXTRAS before exported information * Merge pull request `#17 `_ from ament/per_package_parent_prefix_path generate per project parent_prefix_path files * generate per project parent_prefix_path files * add explicit build type * Merge pull request `#14 `_ from ament/refactor_prefix_level_files disable generation of prefix level setup files by default * disable generation of prefix level setup files by default * Merge pull request `#13 `_ from ament/uninstall_target implement CMake uninstall target * implement symlinked install(FILES .. RENAME ..) * add CMake uninstall target * fix up-to-date symlink detection, update comments * Merge pull request `#12 `_ from ament/wjwwood_warnings_cleanup Fixing some CMake warnings * use AMENT_ENABLE_TESTING to avoid warnings * Set CMake policy 0042 to avoid warnings on OS X * Merge pull request `#11 `_ from ament/typesupport_for_rmw_impl access content of resource index entries * export type support for rmw implementation * disable debug output * Merge pull request `#9 `_ from ament/symlink_install_directory_pattern implement symlink install for DIRECTORY with PATTERN (EXCLUDE) (fix `#8 `_) * fix exclude pattern * implement symlink install for DIRECTORY with PATTERN (EXCLUDE) (fix `#8 `_) * add missing copyright / license information, update format of existing license information * Merge pull request `#3 `_ from ament/windows Windows Support * Merge pull request `#5 `_ from ament/heterogeneous_destinations improve symlinked install of targets to support different destination types * improve symlinked install of targets to support different destination types based on the file extension (fix `#4 `_) * addressing review comments * [windows] fix AMENT_PREFIX_PATH handling * addressing review comments * [windows] add back IS_WINDOWS in one place * [windows] compact file extension logic * simplify removal of backslashes from generated CMake * [windows] use "arrays" to avoid large env vars the limit is 8192, but that the combined number of characters for all the concatenated env hook paths for each package. i think it could be further separated into one variable per env hook per package, but that seemed like overkill for now. * [windows] add more .bat versions of env hooks * [windows] convert \ in paths to / for CMake Otherwise CMake will interpret them as escape sequences or as line continuations. * add has_resource function * disable messages about install() invocations * update cmake code style only * update dependencies * add marker file with run dependencies * fix registering resources with content * source environment hooks in alphanumeric order * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * fix comments * refactored PYTHON_INSTALL_DIR computation * deal with CMake double expansion * add normalize_path function * fix assert file exists message broken by code style change * update cmake code style * minor fixes * code style only * add ament_cmake_auto * add ament_cmake_core * Contributors: Dirk Thomas, Karsten Knese, Mikael Arguedas, William Woodall, dhood ament_cmake-1.3.0/ament_cmake_core/CMakeLists.txt000066400000000000000000000022371420356112300217740ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_core NONE) # include some CMake functions of this package set(ament_cmake_core_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include("ament_cmake_core-extras.cmake" NO_POLICY_SCOPE) include("ament_cmake_environment-extras.cmake" NO_POLICY_SCOPE) include("ament_cmake_environment_hooks-extras.cmake" NO_POLICY_SCOPE) include("ament_cmake_index-extras.cmake" NO_POLICY_SCOPE) include("ament_cmake_uninstall_target-extras.cmake" NO_POLICY_SCOPE) # must be after uninstall_target include("ament_cmake_symlink_install-extras.cmake" NO_POLICY_SCOPE) ament_package_xml() message(STATUS "ament_cmake_core ${ament_cmake_core_VERSION}") include("ament_cmake_package_templates-extras.cmake" NO_POLICY_SCOPE) ament_package( CONFIG_EXTRAS "ament_cmake_core-extras.cmake" "ament_cmake_environment-extras.cmake" "ament_cmake_environment_hooks-extras.cmake" "ament_cmake_index-extras.cmake" "ament_cmake_package_templates-extras.cmake" "ament_cmake_uninstall_target-extras.cmake" "ament_cmake_symlink_install-extras.cmake" # must be after uninstall_target ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_core/ament_cmake_core-extras.cmake000066400000000000000000000013321420356112300250110ustar00rootroot00000000000000# 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. # copied from ament_cmake_core/ament_cmake_core-extras.cmake include("${ament_cmake_core_DIR}/core/all.cmake" NO_POLICY_SCOPE) ament_cmake-1.3.0/ament_cmake_core/ament_cmake_environment-extras.cmake000066400000000000000000000021171420356112300264270ustar00rootroot00000000000000# 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. # copied from ament_cmake_core/ament_cmake_environment-extras.cmake option(AMENT_CMAKE_ENVIRONMENT_GENERATION "Generate environment files in the CMAKE_INSTALL_PREFIX" OFF) option(AMENT_CMAKE_ENVIRONMENT_PARENT_PREFIX_PATH_GENERATION "Generate marker file containing the parent prefix path" ON) include("${ament_cmake_core_DIR}/environment/ament_generate_environment.cmake") ament_register_extension("ament_package" "ament_cmake_core" "environment/ament_cmake_environment_package_hook.cmake") ament_cmake-1.3.0/ament_cmake_core/ament_cmake_environment_hooks-extras.cmake000066400000000000000000000053761420356112300276440ustar00rootroot00000000000000# 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. # copied from ament_cmake_core/ament_cmake_environment_hooks-extras.cmake option(AMENT_CMAKE_ENVIRONMENT_PACKAGE_GENERATION "Generate environment files in the package share folder" ON) # For each known environment hook the parameters are described # to perform the same behavior as the shell specific scripts. # Each CMake variable starts with `AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_` # followed by the basename of the environment hook. # Each of these variables contains a list of items: # The first item identifies the kind of environment hook: # - `source`: source another script. # This type of environment hook has a second item which contains the path of # the script to be sourced. # If the path is relative the absolute path of the current prefix is # prepended. # - `prepend-non-duplicate`: prepend the value to an environment variable if it # is not already in it. # This type of environment hook has a two more item which contain the name of # the environment variable and the path to be prepended (again absolute, or # relative to the current prefix. # - `prepend-non-duplicate-if-exists`: prepend the value to an environment # variable if it is not already in it and if the path exists. # This type of environment hook has the same items as the previous one. set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_ament_prefix_path "prepend-non-duplicate;AMENT_PREFIX_PATH;") if(NOT WIN32) if(NOT APPLE) set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_library_path "prepend-non-duplicate;LD_LIBRARY_PATH;lib") else() set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_library_path "prepend-non-duplicate;DYLD_LIBRARY_PATH;lib") endif() endif() set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_path "prepend-non-duplicate-if-exists;PATH;bin") set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_pkg_config_path "prepend-non-duplicate;PKG_CONFIG_PATH;lib/pkgconfig") include( "${ament_cmake_core_DIR}/environment_hooks/ament_environment_hooks.cmake") include( "${ament_cmake_core_DIR}/environment_hooks/ament_generate_package_environment.cmake") ament_register_extension("ament_package" "ament_cmake_core" "environment_hooks/ament_cmake_environment_hooks_package_hook.cmake") ament_cmake-1.3.0/ament_cmake_core/ament_cmake_index-extras.cmake000066400000000000000000000022671420356112300252000ustar00rootroot00000000000000# 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. # copied from ament_core/ament_index-extras.cmake include("${ament_cmake_core_DIR}/index/ament_index_get_prefix_path.cmake") include("${ament_cmake_core_DIR}/index/ament_index_get_resource.cmake") include("${ament_cmake_core_DIR}/index/ament_index_get_resources.cmake") include("${ament_cmake_core_DIR}/index/ament_index_has_resource.cmake") include("${ament_cmake_core_DIR}/index/ament_index_register_package.cmake") include("${ament_cmake_core_DIR}/index/ament_index_register_resource.cmake") ament_register_extension("ament_package" "ament_cmake_core" "index/ament_cmake_index_package_hook.cmake") ament_cmake-1.3.0/ament_cmake_core/ament_cmake_package_templates-extras.cmake000066400000000000000000000033401420356112300275330ustar00rootroot00000000000000# 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. # extract information from ament_package.templates if(NOT TARGET Python3::Interpreter) message(FATAL_ERROR "ament_cmake_package_templates: target 'Python3::Interpreter' must exist") endif() # stamp script to generate CMake code set(_generator "${ament_cmake_core_DIR}/package_templates/templates_2_cmake.py") stamp("${_generator}") # invoke generator script set(_generated_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_package_templates/templates.cmake") get_executable_path(_python_interpreter Python3::Interpreter CONFIGURE) set(_cmd "${_python_interpreter}" "${_generator}" "${_generated_file}" ) execute_process( COMMAND ${_cmd} RESULT_VARIABLE _res ) if(NOT _res EQUAL 0) string(REPLACE ";" " " _cmd_str "${_cmd}") message(FATAL_ERROR "execute_process(${_cmd_str}) returned error code ${_res}") endif() # load extracted variables into cmake # for each environment hook defined in `ament_package` # (e.g. `library_path.bat|sh`) a CMake variable is defined starting with # `ament_cmake_package_templates_ENVIRONMENT_HOOK_` # (e.g. `ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH`) include("${_generated_file}") ament_cmake-1.3.0/ament_cmake_core/ament_cmake_symlink_install-extras.cmake000066400000000000000000000053461420356112300273060ustar00rootroot00000000000000# 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. # copied from ament_cmake_core/ament_cmake_symlink_install-extras.cmake option(AMENT_CMAKE_SYMLINK_INSTALL "Replace the CMake install command with a custom implementation using symlinks instead of copying resources" OFF) if(AMENT_CMAKE_SYMLINK_INSTALL) message(STATUS "Override CMake install command with custom implementation " "using symlinks instead of copying resources") include( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_append_install_code.cmake") include( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_directory.cmake") include( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_files.cmake") include( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_programs.cmake") include( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_targets.cmake") include("${ament_cmake_core_DIR}/symlink_install/install.cmake") # create the install script from the template # ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install.cmake.in set(AMENT_CMAKE_SYMLINK_INSTALL_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_symlink_install/ament_cmake_symlink_install.cmake") configure_file( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install.cmake.in" "${AMENT_CMAKE_SYMLINK_INSTALL_INSTALL_SCRIPT}" @ONLY ) # register script for being executed at install time install(SCRIPT "${AMENT_CMAKE_SYMLINK_INSTALL_INSTALL_SCRIPT}") if(AMENT_CMAKE_UNINSTALL_TARGET) # register uninstall script set(AMENT_CMAKE_SYMLINK_INSTALL_UNINSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_symlink_install/ament_cmake_symlink_install_uninstall_script.cmake") configure_file( "${ament_cmake_core_DIR}/symlink_install/ament_cmake_symlink_install_uninstall_script.cmake.in" "${AMENT_CMAKE_SYMLINK_INSTALL_UNINSTALL_SCRIPT}" @ONLY ) ament_cmake_uninstall_target_append_uninstall_code( "include(\"${AMENT_CMAKE_SYMLINK_INSTALL_UNINSTALL_SCRIPT}\")" COMMENTS "uninstall files installed using the symlink install functions") endif() endif() ament_cmake-1.3.0/ament_cmake_core/ament_cmake_uninstall_target-extras.cmake000066400000000000000000000033601420356112300274430ustar00rootroot00000000000000# Copyright 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. # copied from ament_cmake_core/ament_cmake_uninstall_target-extras.cmake option(AMENT_CMAKE_UNINSTALL_TARGET "Generate an uninstall target to revert the effects of the install step" ON) if(AMENT_CMAKE_UNINSTALL_TARGET) include( "${ament_cmake_core_DIR}/uninstall_target/ament_cmake_uninstall_target_append_uninstall_code.cmake") # create the install script from the template # ament_cmake_core/uninstall_target/ament_cmake_uninstall_target.cmake.in set(AMENT_CMAKE_UNINSTALL_TARGET_UNINSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_uninstall_target/ament_cmake_uninstall_target.cmake") configure_file( "${ament_cmake_core_DIR}/uninstall_target/ament_cmake_uninstall_target.cmake.in" "${AMENT_CMAKE_UNINSTALL_TARGET_UNINSTALL_SCRIPT}" @ONLY ) if(NOT TARGET uninstall) add_custom_target(uninstall) endif() if(NOT TARGET ${PROJECT_NAME}_uninstall) # register uninstall target to run generated CMake script add_custom_target(${PROJECT_NAME}_uninstall COMMAND ${CMAKE_COMMAND} -P "${AMENT_CMAKE_UNINSTALL_TARGET_UNINSTALL_SCRIPT}") add_dependencies(uninstall ${PROJECT_NAME}_uninstall) endif() endif() ament_cmake-1.3.0/ament_cmake_core/cmake/000077500000000000000000000000001420356112300203105ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/core/000077500000000000000000000000001420356112300212405ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/core/all.cmake000066400000000000000000000031701420356112300230130ustar00rootroot00000000000000# 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. # prevent multiple inclusion if(DEFINED _AMENT_CMAKE_CORE_INCLUDED) message(FATAL_ERROR "ament_cmake_core/cmake/core/all.cmake included " "multiple times") endif() set(_AMENT_CMAKE_CORE_INCLUDED TRUE) if(NOT DEFINED ament_cmake_core_DIR) message(FATAL_ERROR "ament_cmake_core_DIR is not set") endif() # set RPATH to ON for OS X if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() # the following operations must be performed inside a project context if(NOT PROJECT_NAME) project(ament_cmake_internal NONE) endif() # use BUILD_TESTING to avoid warnings about not using it if(DEFINED BUILD_TESTING AND BUILD_TESTING) endif() # various functions / macros foreach(filename "ament_execute_extensions" "ament_package" "ament_package_xml" "ament_register_extension" "assert_file_exists" "get_executable_path" "list_append_unique" "normalize_path" "python" "stamp" "string_ends_with" ) include(${ament_cmake_core_DIR}/core/${filename}.cmake) endforeach() # ensure that no current package name is set unset(_AMENT_PACKAGE_NAME) ament_cmake-1.3.0/ament_cmake_core/cmake/core/ament_execute_extensions.cmake000066400000000000000000000037451420356112300273600ustar00rootroot00000000000000# 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. # # Include all registered extensions. # # :param extension_point: the name of the extension point # :type extension_point: string # :param EXCLUDE: List of packages that should be skipped # :type EXCLUDE: list of strings # # @public # macro(ament_execute_extensions extension_point) cmake_parse_arguments(_ARG "" "" "EXCLUDE" ${ARGN}) if(_ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_execute_extensions() called with " "unused arguments: ${_ARG_UNPARSED_ARGUMENTS}") endif() if(AMENT_EXTENSIONS_${extension_point}) foreach(_extension ${AMENT_EXTENSIONS_${extension_point}}) string(REPLACE ":" ";" _extension_list "${_extension}") list(LENGTH _extension_list _length) if(NOT _length EQUAL 2) message(FATAL_ERROR "ament_execute_extensions(${extension_point}) " "registered extension '${_extension}' can not be split into package " "name and cmake filename") endif() list(GET _extension_list 0 _pkg_name) if("${_pkg_name}" IN_LIST _ARG_EXCLUDE) continue() endif() list(GET _extension_list 1 _cmake_filename) set(_extension_file "${${_pkg_name}_DIR}/${_cmake_filename}") assert_file_exists("${_extension_file}" "ament_execute_extensions(${extension_point}) registered extension '${_extension_file}' does not exist") include("${_extension_file}") endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_core/cmake/core/ament_package.cmake000066400000000000000000000134541420356112300250300ustar00rootroot00000000000000# 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. # # Install the package.xml file, and generate code for # ``find_package`` so that other packages can get information about # this package. # # .. note:: It must be called once for each package. # It is indirectly calling``ament_package_xml()`` which will # provide additional output variables. # # :param CONFIG_EXTRAS: a list of CMake files containing extra stuff # that should be accessible to users of this package after # ``find_package``\ -ing it. # The file can either be a plain CMake file (ending in '.cmake') or # a template which is expanded using configure_file() (ending in # '.cmake.in') with @ONLY. # If the global variable ${PROJECT_NAME}_CONFIG_EXTRAS is set it # will be appended to the explicitly passed argument. # :type CONFIG_EXTRAS: list of files # :param CONFIG_EXTRAS_POST: a list of CMake files containing extra # stuff that should be accessible to users of this package after # ``find_package``\ -ing it. # The file can either be a plain CMake file (ending in '.cmake') or # a template which is expanded using configure_file() (ending in # '.cmake.in') with @ONLY. # If the global variable ${PROJECT_NAME}_CONFIG_EXTRAS_POST is set it # will be prepended to the explicitly passed argument. # :type CONFIG_EXTRAS_POST: list of files # # @public # macro(ament_package) # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "ament_package() PROJECT_NAME is not set. You must " "call project() before calling ament_package().") endif() if(PROJECT_NAME STREQUAL "Project") message(FATAL_ERROR "ament_package() PROJECT_NAME is set to 'Project', " "which is not a valid project name. " "You must call project() before calling ament_package().") endif() # mark that ament_package() was called # in order to detect wrong order of calling set(_${PROJECT_NAME}_AMENT_PACKAGE TRUE) # call ament_package_xml() if it has not been called before if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() ament_execute_extensions(ament_package) _ament_package(${ARGN}) endmacro() function(_ament_package) cmake_parse_arguments(PACKAGE "" "" "CONFIG_EXTRAS;CONFIG_EXTRAS_POST" ${ARGN}) if(PACKAGE_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_package() called with unused arguments: " "${PACKAGE_UNPARSED_ARGUMENTS}") endif() # set variable required by the configured files set(PACKAGE_VERSION "${${PROJECT_NAME}_VERSION}") set(PACKAGE_DEPRECATED "${${PROJECT_NAME}_DEPRECATED}") # expand and install config extras set(PACKAGE_CONFIG_EXTRA_FILES "") set(extras) if(DEFINED PACKAGE_CONFIG_EXTRAS) list(APPEND extras ${PACKAGE_CONFIG_EXTRAS}) endif() if(DEFINED ${PROJECT_NAME}_CONFIG_EXTRAS) list(APPEND extras ${${PROJECT_NAME}_CONFIG_EXTRAS}) endif() if(DEFINED ${PROJECT_NAME}_CONFIG_EXTRAS_POST) list(APPEND extras ${${PROJECT_NAME}_CONFIG_EXTRAS_POST}) endif() if(DEFINED PACKAGE_CONFIG_EXTRAS_POST) list(APPEND extras ${PACKAGE_CONFIG_EXTRAS_POST}) endif() foreach(extra ${extras}) assert_file_exists("${extra}" "ament_package() called with extra file '${extra}' which does not exist") stamp("${extra}") # expand template string_ends_with("${extra}" ".cmake.in" is_template) if(is_template) get_filename_component(extra_filename "${extra}" NAME) # cut of .in extension string(LENGTH "${extra_filename}" length) math(EXPR offset "${length} - 3") string(SUBSTRING "${extra_filename}" 0 ${offset} extra_filename) configure_file( "${extra}" ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${extra_filename} @ONLY ) set(extra "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${extra_filename}") endif() # install cmake file and register for CMake config file string_ends_with("${extra}" ".cmake" is_cmake) if(is_cmake) install(FILES ${extra} DESTINATION share/${PROJECT_NAME}/cmake ) get_filename_component(extra_filename "${extra}" NAME) list(APPEND PACKAGE_CONFIG_EXTRA_FILES "${extra_filename}") else() message(FATAL_ERROR "ament_package() the CONFIG_EXTRAS file '${extra}' " "does neither end with '.cmake' nor with '.cmake.in'.") endif() endforeach() # generate CMake config file stamp("${ament_cmake_core_DIR}/core/templates/nameConfig.cmake.in") configure_file( ${ament_cmake_core_DIR}/core/templates/nameConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${PROJECT_NAME}Config.cmake @ONLY ) # generate CMake config-version file stamp("${ament_cmake_core_DIR}/core/templates/nameConfig-version.cmake.in") configure_file( ${ament_cmake_core_DIR}/core/templates/nameConfig-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${PROJECT_NAME}Config-version.cmake @ONLY ) # install CMake config and config-version files install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${PROJECT_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core/${PROJECT_NAME}Config-version.cmake DESTINATION share/${PROJECT_NAME}/cmake ) # install package.xml install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/package.xml DESTINATION share/${PROJECT_NAME} ) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/ament_package_xml.cmake000066400000000000000000000071671420356112300257140ustar00rootroot00000000000000# 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. # # Parse package.xml from ``DIRECTORY`` and # make several information available to CMake. # # .. note:: It is called automatically by ``ament_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. # # :param DIRECTORY: the directory of the package.xml (default # ``${CMAKE_CURRENT_SOURCE_DIR}``). # :type DIRECTORY: string # # :outvar PACKAGE_NAME: the name of the package from the manifest # :outvar _VERSION: the version number # :outvar _MAINTAINER: the name and email of the # maintainer(s) # # @public # macro(ament_package_xml) # verify that project() has been called before if(NOT PROJECT_NAME) message(FATAL_ERROR "ament_package_xml() PROJECT_NAME is not set. " "You must call project() before you can call ament_package_xml().") endif() # ensure that function is not called multiple times per package if(DEFINED _AMENT_PACKAGE_NAME) message(FATAL_ERROR "ament_package_xml(): in '${CMAKE_CURRENT_LIST_FILE}'," " _AMENT_PACKAGE_NAME is already set (to: ${_AMENT_PACKAGE_NAME}). " "Did you call ament_package_xml() multiple times?") endif() _ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core ${ARGN}) # verify that the package name from package.xml equals the project() name if(NOT _AMENT_PACKAGE_NAME STREQUAL PROJECT_NAME) message(FATAL_ERROR "ament_package_xml() package name " "'${_AMENT_PACKAGE_NAME}' 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() endmacro() macro(_ament_package_xml dest_dir) cmake_parse_arguments(PACKAGE_XML "" "DIRECTORY" "" ${ARGN}) if(PACKAGE_XML_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_package_xml() called with unused arguments: " "${PACKAGE_XML_UNPARSED_ARGUMENTS}") endif() # set default directory if(NOT PACKAGE_XML_DIRECTORY) set(PACKAGE_XML_DIRECTORY ${PROJECT_SOURCE_DIR}) endif() # stamp package.xml as well as script to generate CMake code from it stamp(${PACKAGE_XML_DIRECTORY}/package.xml) stamp("${ament_cmake_core_DIR}/core/package_xml_2_cmake.py") # extract information from package.xml file(MAKE_DIRECTORY ${dest_dir}) if(NOT TARGET Python3::Interpreter) message(FATAL_ERROR "ament_package_xml() target 'Python3::Interpreter' must exist") endif() get_executable_path(_python_interpreter Python3::Interpreter CONFIGURE) set(_cmd "${_python_interpreter}" "${ament_cmake_core_DIR}/core/package_xml_2_cmake.py" "${PACKAGE_XML_DIRECTORY}/package.xml" "${dest_dir}/package.cmake" ) execute_process( COMMAND ${_cmd} RESULT_VARIABLE _res ) if(NOT _res EQUAL 0) string(REPLACE ";" " " _cmd_str "${_cmd}") message(FATAL_ERROR "execute_process(${_cmd_str}) returned error code ${_res}") endif() # load extracted variables into cmake include(${dest_dir}/package.cmake) endmacro() ament_cmake-1.3.0/ament_cmake_core/cmake/core/ament_register_extension.cmake000066400000000000000000000022561420356112300273530ustar00rootroot00000000000000# 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 filename to be included as part of an extension # point. # # :param extension_point: the name of the extension point # :type extension_point: string # :param package_name: the name of the package containing the CMake # file # :type package_name: string # :param cmake_filename: the path to a CMake file relative to the # ${package_name}_DIR folder # :type cmake_filename: string # # @public # macro(ament_register_extension extension_point package_name cmake_filename) list(APPEND AMENT_EXTENSIONS_${extension_point} "${package_name}:${cmake_filename}") endmacro() ament_cmake-1.3.0/ament_cmake_core/cmake/core/assert_file_exists.cmake000066400000000000000000000015311420356112300261410ustar00rootroot00000000000000# 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. function(assert_file_exists filename error_message) if(NOT IS_ABSOLUTE "${filename}") set(filename "${CMAKE_CURRENT_LIST_DIR}/${filename}") endif() if(NOT EXISTS "${filename}") message(FATAL_ERROR "${error_message}") endif() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/get_executable_path.cmake000066400000000000000000000062401420356112300262400ustar00rootroot00000000000000# Copyright 2021 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. # # Get the path to an executable at build or configure time. # # The argument target_or_path may either be a path to an executable (such as # PYTHON_EXECUTABLE), or an executable target (such as Python3::Interpreter). # If the argument is an executable target then its location will be returned. # otherwise the original argument will be returned unmodified. # # Use CONFIGURE when an executable is to be run at configure time, such as when # using execute_process(). # The returned value will be the path to the process. # Use BUILD when an executable is to be run at build or test time, such as # when using add_custom_command() or add_test(). # The returned value will be either a path or a generator expression that # evaluates to the path of an executable target. # # :param var: the output variable name # :type var: string # :param target_or_path: imported executable target or a path to an executable # :param target_or_path: string # # @public # function(get_executable_path var target_or_path) cmake_parse_arguments(ARG "BUILD;CONFIGURE" "" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "get_executable() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_BUILD AND NOT ARG_CONFIGURE) message(FATAL_ERROR "get_executable_path() must have BUILD or CONFIGURE set" "${ARG_UNPARSED_ARGUMENTS}") endif() # If it isn't a target, return whatever was given unmodified set(output_var "${target_or_path}") if(TARGET ${target_or_path}) # There is a target with this name get_target_property(type "${target_or_path}" TYPE) get_target_property(imported "${target_or_path}" IMPORTED) if("${type}" STREQUAL "EXECUTABLE") # The target is an executable, grab its LOCATION property if(ARG_BUILD) if(imported) # Return a generator expression to get the LOCATION property set(output_var "$") else() # Return a generator expression to get the output location set(output_var "$") endif() else() if(imported) # Return the content of the property directly get_target_property(output_var "${target_or_path}" LOCATION) else() message(WARNING "There exists a non-imported executable target named" " '${target_or_path}', but those cannot be used at configure time." " Assuming it's a path instead.") endif() endif() endif() endif() set("${var}" "${output_var}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/list_append_unique.cmake000066400000000000000000000022541420356112300261350ustar00rootroot00000000000000# 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. # # Append elements to a list if they are not already in the list. # # :param list: the list # :type list: list variable # :param ARGN: the elements # :type ARGN: list of strings # # .. 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. # function(list_append_unique list) foreach(element ${ARGN}) if(NOT element IN_LIST ${list}) list(APPEND ${list} "${element}") endif() endforeach() set(${list} ${${list}} PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/normalize_path.cmake000066400000000000000000000064331420356112300252640ustar00rootroot00000000000000# 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. # # Normalize a path by collapsing redundant parts and up-level references. # # This may change the meaning of a path that contains symbolic links. # # :param var: the output variable name # :type var: string # :param path: the path # :type path: string # function(normalize_path var path) list(LENGTH path length) if(NOT length EQUAL 1) message(FATAL_ERROR "normalize_path() the path '${path}' must neither be empty nor contain semicolons") endif() # convert to list file(TO_CMAKE_PATH "${path}" path) string(REPLACE "/" ";" parts "${path}") _normalize_path__collapse_redundant(parts "${parts}") _normalize_path__collapse_uplevel_reference(parts "${parts}") # check if path has completely collapsed if(parts STREQUAL "") set(parts ".") endif() # convert back to string string(REPLACE ";" "/" normalized "${parts}") set(${var} "${normalized}" PARENT_SCOPE) endfunction() function(_normalize_path__collapse_redundant var) set(parts "${ARGN}") set(index 1) # index 0 is empty for absolute paths while(TRUE) list(LENGTH parts length) if(NOT index LESS length) break() endif() list(GET parts ${index} part) # remove empty parts as well as current directory references if(part STREQUAL "" OR part STREQUAL ".") list(REMOVE_AT parts ${index}) else() math(EXPR index "${index} + 1") endif() endwhile() set(${var} "${parts}" PARENT_SCOPE) endfunction() function(_normalize_path__collapse_uplevel_reference var) set(parts "${ARGN}") set(index 0) while(TRUE) list(LENGTH parts length) if(NOT index LESS length) break() endif() # get previous element set(previous_index ${index}) list(GET parts ${previous_index} previous) math(EXPR index "${index} + 1") if(NOT index LESS length) break() endif() # get current element list(GET parts ${index} current) if(current STREQUAL ".." AND NOT previous STREQUAL "..") # collapse the '..' list(REMOVE_AT parts ${index}) set(index ${previous_index}) if(previous STREQUAL "") # only collapse the '..' when starting with '/../' if(previous_index GREATER 0) string(REPLACE ";" "/" path "${parts}") message(FATAL_ERROR "_normalize_path__collapse_uplevel_reference() the path '${path}' must not contain redundant separators") endif() else() # collapse the '..' as well as the part before list(REMOVE_AT parts ${previous_index}) if(previous_index GREATER 0) math(EXPR index "${previous_index} - 1") else() math(EXPR index 0) endif() endif() endif() endwhile() set(${var} "${parts}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/package_xml_2_cmake.py000066400000000000000000000123031420356112300254450ustar00rootroot00000000000000#!/usr/bin/env python3 # 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. import argparse from collections import OrderedDict import os import sys from catkin_pkg.package import parse_package_string def main(argv=sys.argv[1:]): """ Extract the information from package.xml and make them accessible to CMake. Parse the given package.xml file and print CMake code defining several variables containing the content. """ parser = argparse.ArgumentParser( description='Parse package.xml file and print CMake code defining ' 'several variables', ) parser.add_argument( 'package_xml', type=argparse.FileType('r', encoding='utf-8'), help='The path to a package.xml file', ) parser.add_argument( 'outfile', nargs='?', help='The filename where the output should be written to', ) args = parser.parse_args(argv) try: package = parse_package_string( args.package_xml.read(), filename=args.package_xml.name) except Exception as e: print("Error parsing '%s':" % args.package_xml.name, file=sys.stderr) raise e finally: args.package_xml.close() lines = generate_cmake_code(package) if args.outfile: with open(args.outfile, 'w', encoding='utf-8') as f: for line in lines: f.write('%s\n' % line) else: for line in lines: print(line) def get_dependency_values(key, depends): dependencies = [] # Filter the dependencies, checking for any condition attributes dependencies.append((key, ' '.join([ '"%s"' % str(d) for d in depends if d.condition is None or d.evaluate_condition(os.environ) ]))) 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: dependencies.append(('%s_%s_%s' % (key, str(d), comp.upper()), '"%s"' % value)) return dependencies def generate_cmake_code(package): """ Return a list of CMake set() commands containing the manifest information. :param package: catkin_pkg.package.Package :returns: list of str """ variables = [] variables.append(('VERSION', '"%s"' % package.version)) variables.append(( 'MAINTAINER', '"%s"' % (', '.join([str(m) for m in package.maintainers])))) variables.extend(get_dependency_values('BUILD_DEPENDS', package.build_depends)) variables.extend(get_dependency_values('BUILDTOOL_DEPENDS', package.buildtool_depends)) variables.extend(get_dependency_values('BUILD_EXPORT_DEPENDS', package.build_export_depends)) variables.extend(get_dependency_values('BUILDTOOL_EXPORT_DEPENDS', package.buildtool_export_depends)) variables.extend(get_dependency_values('EXEC_DEPENDS', package.exec_depends)) variables.extend(get_dependency_values('TEST_DEPENDS', package.test_depends)) variables.extend(get_dependency_values('GROUP_DEPENDS', package.group_depends)) variables.extend(get_dependency_values('MEMBER_OF_GROUPS', package.member_of_groups)) deprecated = [e.content for e in package.exports if e.tagname == 'deprecated'] variables.append(('DEPRECATED', '"%s"' % ((deprecated[0] if deprecated[0] else 'TRUE') if deprecated else ''))) lines = [] lines.append('set(_AMENT_PACKAGE_NAME "%s")' % package.name) for (k, v) in variables: lines.append('set(%s_%s %s)' % (package.name, k, v)) lines.append('set(%s_EXPORT_TAGS)' % package.name) replaces = OrderedDict() replaces['${prefix}/'] = '' replaces['\\'] = '\\\\' # escape backslashes replaces['"'] = '\\"' # prevent double quotes to end the CMake string replaces[';'] = '\\;' # prevent semicolons to be interpreted as list separators for export in package.exports: export = str(export) for k, v in replaces.items(): export = export.replace(k, v) lines.append('list(APPEND %s_EXPORT_TAGS "%s")' % (package.name, export)) return lines if __name__ == '__main__': main() ament_cmake-1.3.0/ament_cmake_core/cmake/core/python.cmake000066400000000000000000000016251420356112300235670ustar00rootroot00000000000000# 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. # ament_cmake needs a Python 3 interpreter # If a specific Python version is required then find it before finding ament_cmake # Example: # find_package(Python3 3.8 REQUIRED) # find_package(ament_cmake REQUIRED) if(NOT TARGET Python3::Interpreter) find_package(Python3 REQUIRED COMPONENTS Interpreter) endif() ament_cmake-1.3.0/ament_cmake_core/cmake/core/stamp.cmake000066400000000000000000000020071420356112300233650ustar00rootroot00000000000000# 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. # # :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}/ament_cmake_core/stamps/${filename}.stamp" COPYONLY ) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/string_ends_with.cmake000066400000000000000000000023541420356112300256200ustar00rootroot00000000000000# 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. # # Check if a string ends with a specific suffix. # # :param str: the string # :type str: string # :param suffix: the suffix # :type suffix: string # :param var: the output variable name # :type var: bool # function(string_ends_with str suffix var) string(LENGTH "${str}" str_length) string(LENGTH "${suffix}" suffix_length) set(value FALSE) if(NOT ${str_length} LESS ${suffix_length}) math(EXPR str_offset "${str_length} - ${suffix_length}") string(SUBSTRING "${str}" ${str_offset} ${suffix_length} str_suffix) if(str_suffix STREQUAL suffix) set(value TRUE) endif() endif() set(${var} ${value} PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/core/templates/000077500000000000000000000000001420356112300232365ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/core/templates/nameConfig-version.cmake.in000066400000000000000000000006741420356112300304050ustar00rootroot00000000000000# generated from ament/cmake/core/templates/nameConfig-version.cmake.in set(PACKAGE_VERSION "@PACKAGE_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() ament_cmake-1.3.0/ament_cmake_core/cmake/core/templates/nameConfig.cmake.in000066400000000000000000000025771420356112300267260ustar00rootroot00000000000000# generated from ament/cmake/core/templates/nameConfig.cmake.in # prevent multiple inclusion if(_@PROJECT_NAME@_CONFIG_INCLUDED) # ensure to keep the found flag the same if(NOT DEFINED @PROJECT_NAME@_FOUND) # explicitly set it to FALSE, otherwise CMake will set it to TRUE set(@PROJECT_NAME@_FOUND FALSE) elseif(NOT @PROJECT_NAME@_FOUND) # use separate condition to avoid uninitialized variable warning set(@PROJECT_NAME@_FOUND FALSE) endif() return() endif() set(_@PROJECT_NAME@_CONFIG_INCLUDED TRUE) # output package information if(NOT @PROJECT_NAME@_FIND_QUIETLY) message(STATUS "Found @PROJECT_NAME@: @PACKAGE_VERSION@ (${@PROJECT_NAME@_DIR})") endif() # warn when using a deprecated package if(NOT "@PACKAGE_DEPRECATED@" STREQUAL "") set(_msg "Package '@PROJECT_NAME@' is deprecated") # append custom deprecation text if available if(NOT "@PACKAGE_DEPRECATED@" STREQUAL "TRUE") set(_msg "${_msg} (@PACKAGE_DEPRECATED@)") endif() # optionally quiet the deprecation message if(NOT ${@PROJECT_NAME@_DEPRECATED_QUIET}) message(DEPRECATION "${_msg}") endif() endif() # flag package as ament-based to distinguish it after being find_package()-ed set(@PROJECT_NAME@_FOUND_AMENT_PACKAGE TRUE) # include all config extra files set(_extras "@PACKAGE_CONFIG_EXTRA_FILES@") foreach(_extra ${_extras}) include("${@PROJECT_NAME@_DIR}/${_extra}") endforeach() ament_cmake-1.3.0/ament_cmake_core/cmake/environment/000077500000000000000000000000001420356112300226545ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/environment/ament_cmake_environment_package_hook.cmake000066400000000000000000000035231420356112300332440ustar00rootroot00000000000000# 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. if(AMENT_CMAKE_ENVIRONMENT_GENERATION) ament_generate_environment() endif() function(ament_cmake_environment_generate_package_run_dependencies_marker) # use all run dependencies from the package.xml set(run_depends "") list_append_unique(run_depends ${${PROJECT_NAME}_BUILD_EXPORT_DEPENDS} ${${PROJECT_NAME}_BUILDTOOL_EXPORT_DEPENDS} ${${PROJECT_NAME}_EXEC_DEPENDS} ${${PROJECT_NAME}_TEST_DEPENDS}) # register direct run dependencies ament_index_register_resource("package_run_dependencies" CONTENT "${run_depends}") endfunction() function(ament_cmake_environment_generate_parent_prefix_path_marker) set(prefix_path "$ENV{AMENT_PREFIX_PATH}") while(TRUE) # replace install prefix with placeholder to avoid embedding absolute paths list(FIND prefix_path "${CMAKE_INSTALL_PREFIX}" index) if(index EQUAL -1) break() endif() list(REMOVE_AT prefix_path ${index}) list(INSERT prefix_path ${index} "{prefix}") endwhile() ament_index_register_resource("parent_prefix_path" CONTENT "${prefix_path}") endfunction() if(AMENT_CMAKE_ENVIRONMENT_PARENT_PREFIX_PATH_GENERATION) ament_cmake_environment_generate_package_run_dependencies_marker() ament_cmake_environment_generate_parent_prefix_path_marker() endif() ament_cmake-1.3.0/ament_cmake_core/cmake/environment/ament_generate_environment.cmake000066400000000000000000000035341420356112300312650ustar00rootroot00000000000000# 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. # # Generate setup files in the root of the install prefix. # # @public # function(ament_generate_environment) if(ARGN) message(FATAL_ERROR "ament_generate_environment() called with unused arguments: ${ARGN}") endif() if(NOT TARGET Python3::Interpreter) message(FATAL_ERROR "ament_generate_environment() target 'Python3::Interpreter' must exist") endif() # Default python used in local_setup.* scripts get_executable_path(ament_package_PYTHON_EXECUTABLE Python3::Interpreter CONFIGURE) # configure and install setup files foreach(file ${ament_cmake_package_templates_PREFIX_LEVEL}) # check if the file is a template string_ends_with("${file}" ".in" is_template) if(is_template) # cut of .in extension string(LENGTH "${file}" length) math(EXPR offset "${length} - 3") string(SUBSTRING "${file}" 0 ${offset} name) # expand template get_filename_component(name "${name}" NAME) configure_file( "${file}" "${CMAKE_BINARY_DIR}/ament_cmake_environment/${name}" @ONLY ) set(file "${CMAKE_BINARY_DIR}/ament_cmake_environment/${name}") endif() install( FILES "${file}" DESTINATION "${CMAKE_INSTALL_PREFIX}" ) endforeach() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/000077500000000000000000000000001420356112300240575ustar00rootroot00000000000000ament_cmake_environment_hooks_package_hook.cmake000066400000000000000000000016641420356112300355770ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks# 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. if(WIN32) set(_ext ".bat") else() set(_ext ".sh") endif() ament_environment_hooks( "${ament_cmake_core_DIR}/environment_hooks/environment/ament_prefix_path${_ext}" "${ament_cmake_core_DIR}/environment_hooks/environment/path${_ext}" ) if(AMENT_CMAKE_ENVIRONMENT_PACKAGE_GENERATION) ament_generate_package_environment() endif() ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/ament_environment_hooks.cmake000066400000000000000000000062141420356112300320170ustar00rootroot00000000000000# 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 environment hooks. # # Each file can either be a plain file (ending with a supported extensions) # or a template which is expanded using configure_file() (ending in # '..in') with @ONLY. # # :param ARGN: a list of environment hook files # :type ARGN: list of strings # # @public # function(ament_environment_hooks) if(_${PROJECT_NAME}_AMENT_GENERATE_PACKAGE_ENVIRONMENT) message(FATAL_ERROR "ament_environment_hooks() must be called before " "ament_generate_package_environment() (which is invoked by " "ament_package())") endif() foreach(hook ${ARGN}) assert_file_exists("${hook}" "ament_environment_hooks() the passed hook file '${hook}' does not exist") stamp("${hook}") get_filename_component(hook_filename "${hook}" NAME) # check if the file is a template if(hook_filename MATCHES "^(.*)\\.in$") set(is_template TRUE) # cut off .in extension set(hook_filename "${CMAKE_MATCH_1}") else() set(is_template FALSE) endif() if(hook_filename MATCHES "^.*\\.([^\\.]+)$") # extract the extension set(hook_extension "${CMAKE_MATCH_1}") else() message(FATAL_ERROR "ament_environment_hooks() called with the hook " "'${hook}' which doesn't have a file extension") endif() if(is_template) # expand template configure_file( "${hook}" "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_environment_hooks/${hook_filename}" @ONLY ) set(hook "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_environment_hooks/${hook_filename}") endif() # install hook file install( FILES "${hook}" DESTINATION "share/${PROJECT_NAME}/environment" ) # remember all environment hooks # for generating the package environment files list(APPEND _AMENT_CMAKE_ENVIRONMENT_HOOKS_${hook_extension} "share/${PROJECT_NAME}/environment/${hook_filename}") set(_AMENT_CMAKE_ENVIRONMENT_HOOKS_${hook_extension} "${_AMENT_CMAKE_ENVIRONMENT_HOOKS_${hook_extension}}" PARENT_SCOPE) get_filename_component(hook_basename "${hook}" NAME_WE) if(DEFINED AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_${hook_basename}) # write .dsv file containing the descriptor of the environment hook set(dsv_file "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/${hook_basename}.dsv") file(WRITE "${dsv_file}" "${AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_${hook_basename}}\n") install( FILES "${dsv_file}" DESTINATION "share/${PROJECT_NAME}/environment" ) endif() endforeach() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/ament_generate_package_environment.cmake000066400000000000000000000110031420356112300341310ustar00rootroot00000000000000# 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. # # Generate setup files in share folder of the current package. # # @public # function(ament_generate_package_environment) if(ARGN) message(FATAL_ERROR "ament_generate_package_environment() called with " "unused arguments: ${ARGN}") endif() # mark that ament_generate_package_environment() was called # in order to detect wrong order of calling set(_${PROJECT_NAME}_AMENT_GENERATE_PACKAGE_ENVIRONMENT TRUE PARENT_SCOPE) set(all_hooks "") set(all_package_level_extensions "") # configure and install setup files for the package foreach(file ${ament_cmake_package_templates_PACKAGE_LEVEL}) # check if the file is a template string_ends_with("${file}" ".in" is_template) if(is_template) # cut of the path and the .in extension get_filename_component(name "${file}" NAME) string(LENGTH "${name}" length) math(EXPR offset "${length} - 3") string(SUBSTRING "${name}" 0 ${offset} name) # extract the extension string(FIND "${name}" "." index REVERSE) if(index EQUAL -1) message(FATAL_ERROR "ament_generate_package_environment() called with " "the template '${file}' which doesn't have a file extension") endif() math(EXPR index "${index} + 1") string(SUBSTRING "${name}" ${index} -1 extension) list(APPEND all_package_level_extensions "${extension}") # collect package hooks to be sourced for this extension set(ENVIRONMENT_HOOKS "") if(DEFINED _AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}) list(SORT _AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}) foreach(hook ${_AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}}) set(all_hooks "${all_hooks}source;${hook}\n") set(native_hook "/${hook}") file(TO_NATIVE_PATH "${native_hook}" native_hook) if(WIN32) set(ENVIRONMENT_HOOKS "${ENVIRONMENT_HOOKS}call:ament_append_value AMENT_ENVIRONMENT_HOOKS[${PROJECT_NAME}] \"%AMENT_CURRENT_PREFIX%${native_hook}\"\n") else() set(ENVIRONMENT_HOOKS "${ENVIRONMENT_HOOKS}ament_append_value AMENT_ENVIRONMENT_HOOKS \"$AMENT_CURRENT_PREFIX${native_hook}\"\n") endif() endforeach() endif() # expand template configure_file( "${file}" "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/${name}" @ONLY ) set(file "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/${name}") else() # extract the extension of a non-template file string(FIND "${file}" "." index REVERSE) if(index EQUAL -1) message(FATAL_ERROR "ament_generate_package_environment() called with " "the non-template '${file}' which doesn't have a file extension") endif() math(EXPR index "${index} + 1") string(SUBSTRING "${file}" ${index} -1 extension) list(APPEND all_package_level_extensions "${extension}") endif() install( FILES "${file}" DESTINATION "share/${PROJECT_NAME}" ) endforeach() # generate local_setup.dsv file if(DEFINED _AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv) list(SORT _AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv) foreach(hook ${_AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv}) set(all_hooks "${all_hooks}source;${hook}\n") endforeach() endif() list(APPEND all_package_level_extensions "dsv") set(dsv_file "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/local_setup.dsv") file(WRITE "${dsv_file}" "${all_hooks}") install( FILES "${dsv_file}" DESTINATION "share/${PROJECT_NAME}" ) # generate package.dsv file list(SORT all_package_level_extensions) set(dsv_file "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/package.dsv") file(WRITE "${dsv_file}" "") foreach(ext ${all_package_level_extensions}) file(APPEND "${dsv_file}" "source;share/${PROJECT_NAME}/local_setup.${ext}\n") endforeach() install( FILES "${dsv_file}" DESTINATION "share/${PROJECT_NAME}" ) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/environment/000077500000000000000000000000001420356112300264235ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.bat000066400000000000000000000020421420356112300326060ustar00rootroot00000000000000:: copied from :: ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.bat @echo off call:ament_prepend_unique_value AMENT_PREFIX_PATH "%AMENT_CURRENT_PREFIX%" goto:eof :: Prepend non-duplicate values to environment variables :: using semicolons as separators and avoiding trailing separators. :: first argument: the name of the result variable :: second argument: the value :ament_prepend_unique_value setlocal enabledelayedexpansion :: arguments set "listname=%~1" set "value=%~2" :: expand the list variable set "list=!%listname%!" :: check if the list contains the value set "is_duplicate=" if "%list%" NEQ "" ( for %%v in ("%list:;=";"%") do ( if "%%~v" == "%value%" set "is_duplicate=1" ) ) :: if it is not a duplicate prepend it if "%is_duplicate%" == "" ( :: if not empty, prepend a semi-colon if "!list!" NEQ "" set "list=;!list!" :: prepend the value set "list=%value%!list!" ) endlocal & ( :: set result variable in parent scope set "%~1=%list%" ) goto:eof ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh000066400000000000000000000002401420356112300324500ustar00rootroot00000000000000# copied from # ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh ament_prepend_unique_value AMENT_PREFIX_PATH "$AMENT_CURRENT_PREFIX" ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/environment/path.bat000066400000000000000000000020571420356112300300530ustar00rootroot00000000000000:: copied from ament_cmake_core/cmake/environment_hooks/environment/path.bat @echo off if exist "%AMENT_CURRENT_PREFIX%\bin" call:ament_prepend_unique_value PATH "%AMENT_CURRENT_PREFIX%\bin" goto:eof :: Prepend non-duplicate values to environment variables :: using semicolons as separators and avoiding trailing separators. :: first argument: the name of the result variable :: second argument: the value :ament_prepend_unique_value setlocal enabledelayedexpansion :: arguments set "listname=%~1" set "value=%~2" :: expand the list variable set "list=!%listname%!" :: check if the list contains the value set "is_duplicate=" if "%list%" NEQ "" ( for %%v in ("%list:;=";"%") do ( if "%%~v" == "%value%" set "is_duplicate=1" ) ) :: if it is not a duplicate prepend it if "%is_duplicate%" == "" ( :: if not empty, prepend a semi-colon if "!list!" NEQ "" set "list=;!list!" :: prepend the value set "list=%value%!list!" ) endlocal & ( :: set result variable in parent scope set "%~1=%list%" ) goto:eof ament_cmake-1.3.0/ament_cmake_core/cmake/environment_hooks/environment/path.sh000066400000000000000000000002711420356112300277130ustar00rootroot00000000000000# copied from ament_cmake_core/cmake/environment_hooks/environment/path.sh if [ -d "$AMENT_CURRENT_PREFIX/bin" ]; then ament_prepend_unique_value PATH "$AMENT_CURRENT_PREFIX/bin" fi ament_cmake-1.3.0/ament_cmake_core/cmake/index/000077500000000000000000000000001420356112300214175ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_cmake_index_package_hook.cmake000066400000000000000000000012331420356112300305460ustar00rootroot00000000000000# 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 package name for index ament_index_register_package() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_get_prefix_path.cmake000066400000000000000000000040521420356112300301450ustar00rootroot00000000000000# Copyright 2016 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. # # Get the prefix path including the folder from the binary dir. # # :param var: the output variable name for the prefix path # :type var: string # :param SKIP_AMENT_PREFIX_PATH: if set skip adding the paths from the # environment variable ``AMENT_PREFIX_PATH`` # :type SKIP_AMENT_PREFIX_PATH: option # :param SKIP_BINARY_DIR: if set skip adding the folder within the binary dir # :type SKIP_BINARY_DIR: option # # @public # function(ament_index_get_prefix_path var) cmake_parse_arguments(ARG "SKIP_AMENT_PREFIX_PATH;SKIP_BINARY_DIR" "" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_get_prefix_path() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_SKIP_AMENT_PREFIX_PATH) set(prefix_path $ENV{AMENT_PREFIX_PATH}) if(NOT WIN32) # Convert it to a list if not on Windows. # On Windows, it is already separated by ; and is a list in CMake. string(REPLACE ":" ";" prefix_path "${prefix_path}") endif() else() set(prefix_path "") endif() # Remove CMAKE_INSTALL_PREFIX if it is in the list of paths to search, # and add it to the list at the front list(REMOVE_ITEM prefix_path "${CMAKE_INSTALL_PREFIX}") list(INSERT prefix_path 0 "${CMAKE_INSTALL_PREFIX}") if(NOT ARG_SKIP_BINARY_DIR) # prepend path from binary dir list(INSERT prefix_path 0 "${CMAKE_BINARY_DIR}/ament_cmake_index") endif() set(${var} "${prefix_path}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_get_resource.cmake000066400000000000000000000042261420356112300274660ustar00rootroot00000000000000# Copyright 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. # # Get the content of a specific resource from the index. # # :param var: the output variable name for the content of the requested # resource # :type var: string # :param resource_type: the type of the resource # :type resource_type: string # :param resource_name: the name of the resource # :type resource_name: string # :param PREFIX_PATH: the prefix path to search for (default # ``ament_index_get_prefix_path()``). # :type PREFIX_PATH: list of strings # # @public # function(ament_index_get_resource var resource_type resource_name) if(resource_type STREQUAL "") message(FATAL_ERROR "ament_index_get_resource() called without a 'resource_type'") endif() if(resource_name STREQUAL "") message(FATAL_ERROR "ament_index_get_resource() called without a 'resource_name'") endif() cmake_parse_arguments(ARG "" "PREFIX_PATH" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_get_resource() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(ARG_PREFIX_PATH) set(prefix_path "${ARG_PREFIX_PATH}") else() ament_index_get_prefix_path(prefix_path) endif() foreach(path IN LISTS prefix_path) set(filename "${path}/share/ament_index/resource_index/${resource_type}/${resource_name}") if(EXISTS "${filename}") file(READ "${filename}" retval) set(${var} "${retval}" PARENT_SCOPE) return() endif() endforeach() message(FATAL_ERROR "ament_index_get_resource() called with not existing " "resource ('${resource_type}' '${resource_name}')") endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_get_resources.cmake000066400000000000000000000046511420356112300276530ustar00rootroot00000000000000# 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. # # Get all registered package resources of a specific type from the index. # # :param var: the output variable name # :type var: list of resource names # :param resource_type: the type of the resource # :type resource_type: string # :param PREFIX_PATH: the prefix path to search for (default # ``ament_index_get_prefix_path()``). # :type PREFIX_PATH: list of strings # # @public # function(ament_index_get_resources var resource_type) if(resource_type STREQUAL "") message(FATAL_ERROR "ament_index_get_resources() called without a 'resource_type'") endif() cmake_parse_arguments(ARG "" "PREFIX_PATH" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_get_resources() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(ARG_PREFIX_PATH) set(prefix_path "${ARG_PREFIX_PATH}") else() ament_index_get_prefix_path(prefix_path) endif() # Remove any empty strings and make sure slashes are consistent set(paths_to_search) foreach(path IN LISTS prefix_path) if(NOT path STREQUAL "") string(REPLACE "\\" "/" normalized_path "${path}") list_append_unique(paths_to_search "${normalized_path}") endif() endforeach() set(all_resources "") foreach(path IN LISTS paths_to_search) set(resource_index_path "${path}/share/ament_index/resource_index") file(GLOB resources LIST_DIRECTORIES FALSE RELATIVE "${resource_index_path}/${resource_type}" "${resource_index_path}/${resource_type}/*") foreach(resource IN LISTS resources) string(SUBSTRING "${resource}" 0 1 resource_char0) # Ignore any files starting with a dot if(NOT resource_char0 STREQUAL ".") list_append_unique(all_resources ${resource}) endif() endforeach() endforeach() set(${var} "${all_resources}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_has_resource.cmake000066400000000000000000000037541420356112300274670ustar00rootroot00000000000000# Copyright 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. # # Check if the index contains a specific resource. # # :param var: the prefix path if the resource exists, FALSE otherwise # :type var: string or FALSE # :param resource_type: the type of the resource # :type resource_type: string # :param resource_name: the name of the resource # :type resource_name: string # :param PREFIX_PATH: the prefix path to search for (default # ``ament_index_get_prefix_path()``). # :type PREFIX_PATH: list of strings # # @public # function(ament_index_has_resource var resource_type resource_name) if(resource_type STREQUAL "") message(FATAL_ERROR "ament_index_has_resource() called without a 'resource_type'") endif() if(resource_name STREQUAL "") message(FATAL_ERROR "ament_index_has_resource() called without a 'resource_name'") endif() cmake_parse_arguments(ARG "" "PREFIX_PATH" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_has_resource() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(ARG_PREFIX_PATH) set(prefix_path "${ARG_PREFIX_PATH}") else() ament_index_get_prefix_path(prefix_path) endif() set(retval FALSE) foreach(path IN LISTS prefix_path) if(EXISTS "${path}/share/ament_index/resource_index/${resource_type}/${resource_name}") set(retval "${path}") break() endif() endforeach() set(${var} "${retval}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_register_package.cmake000066400000000000000000000021651420356112300302770ustar00rootroot00000000000000# 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 package name with the resource index. # # :param PACKAGE_NAME: the package name (default: ${PROJECT_NAME}) # :type PACKAGE_NAME: string # function(ament_index_register_package) cmake_parse_arguments(ARG "" "PACKAGE_NAME" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_register_package() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() # register package name with the resource type 'packages' ament_index_register_resource("packages" ${ARGN}) endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/index/ament_index_register_resource.cmake000066400000000000000000000072461420356112300305400ustar00rootroot00000000000000# 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 package resource of a specific type with the index. # # For both CONTENT as well as CONTENT_FILE CMake generator expressions are # supported. # # :param resource_type: the type of the resource # :type resource_type: string # :param CONTENT: the content of the marker file being installed # as a result of the registration (default: empty string) # :type CONTENT: string # :param CONTENT_FILE: the path to a file which will be used to fill # the marker file being installed as a result of the registration. # The file can either be a plain file or a template (ending with # '.in') which is expanded using configure_file() with @ONLY. # (optional, conflicts with CONTENT) # :type CONTENT_FILE: string # :param PACKAGE_NAME: the package name (default: ${PROJECT_NAME}) # :type PACKAGE_NAME: string # :param AMENT_INDEX_BINARY_DIR: the base path of the generated ament # index (default: ${CMAKE_BINARY_DIR}/ament_cmake_index) # :type AMENT_INDEX_BINARY_DIR: string # :param SKIP_INSTALL: if set skip installing the marker file # :type SKIP_INSTALL: option # # @public # function(ament_index_register_resource resource_type) if(resource_type STREQUAL "") message(FATAL_ERROR "ament_index_register_resource() called without a 'resource_type'") endif() cmake_parse_arguments( ARG "SKIP_INSTALL" "PACKAGE_NAME;CONTENT_FILE;AMENT_INDEX_BINARY_DIR" "CONTENT" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_index_register_resource() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(ARG_CONTENT AND ARG_CONTENT_FILE) message(FATAL_ERROR "ament_index_register_resource() called with both " "'CONTENT' and 'CONTENT_FILE', only one is allowed") endif() if(NOT ARG_PACKAGE_NAME) set(ARG_PACKAGE_NAME "${PROJECT_NAME}") endif() if(ARG_CONTENT_FILE) if(NOT IS_ABSOLUTE "${ARG_CONTENT_FILE}") set(ARG_CONTENT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${ARG_CONTENT_FILE}") endif() if(NOT EXISTS "${ARG_CONTENT_FILE}") message(FATAL_ERROR "ament_index_register_resource() the content file " "'${ARG_CONTENT_FILE}' does not exist") endif() string_ends_with("${ARG_CONTENT_FILE}" ".in" is_template) if(NOT is_template) # read non-template file content file(READ "${ARG_CONTENT_FILE}" ARG_CONTENT) endif() endif() if(NOT ARG_AMENT_INDEX_BINARY_DIR) set(ARG_AMENT_INDEX_BINARY_DIR "${CMAKE_BINARY_DIR}/ament_cmake_index") endif() set(destination "share/ament_index/resource_index/${resource_type}") set(marker_file "${ARG_AMENT_INDEX_BINARY_DIR}/${destination}/${ARG_PACKAGE_NAME}") if(ARG_CONTENT OR NOT ARG_CONTENT_FILE) file(GENERATE OUTPUT "${marker_file}" CONTENT "${ARG_CONTENT}") else() # content file is a .in template configure_file( "${ARG_CONTENT_FILE}" "${marker_file}.genexp" @ONLY ) file(GENERATE OUTPUT "${marker_file}" INPUT "${marker_file}.genexp") endif() if(NOT ARG_SKIP_INSTALL) install( FILES "${marker_file}" DESTINATION "${destination}" ) endif() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/package_templates/000077500000000000000000000000001420356112300237615ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/package_templates/templates_2_cmake.py000066400000000000000000000071531420356112300277200ustar00rootroot00000000000000#!/usr/bin/env python3 # 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. import argparse import os import sys from ament_package.templates import get_environment_hook_template_path from ament_package.templates import get_package_level_template_names from ament_package.templates import get_package_level_template_path from ament_package.templates import get_prefix_level_template_names from ament_package.templates import get_prefix_level_template_path IS_WINDOWS = os.name == 'nt' def main(argv=sys.argv[1:]): """ Extract the information about templates provided by ament_package. Call the API provided by ament_package and print CMake code defining several variables containing information about the available templates. """ parser = argparse.ArgumentParser( description='Extract information about templates provided by ' 'ament_package and print CMake code defining several ' 'variables', ) parser.add_argument( 'outfile', nargs='?', help='The filename where the output should be written to', ) args = parser.parse_args(argv) lines = generate_cmake_code() if args.outfile: basepath = os.path.dirname(args.outfile) if not os.path.exists(basepath): os.makedirs(basepath) with open(args.outfile, 'w') as f: for line in lines: f.write('%s\n' % line) else: for line in lines: print(line) def generate_cmake_code(): """ Return a list of CMake set() commands containing the template information. :returns: list of str """ variables = [] if not IS_WINDOWS: variables.append(( 'ENVIRONMENT_HOOK_LIBRARY_PATH', '"%s"' % get_environment_hook_template_path('library_path.sh'))) else: variables.append(('ENVIRONMENT_HOOK_LIBRARY_PATH', '')) ext = '.bat.in' if IS_WINDOWS else '.sh.in' variables.append(( 'ENVIRONMENT_HOOK_PYTHONPATH', '"%s"' % get_environment_hook_template_path('pythonpath' + ext))) templates = [] for name in get_package_level_template_names(): templates.append('"%s"' % get_package_level_template_path(name)) variables.append(( 'PACKAGE_LEVEL', templates)) templates = [] for name in get_prefix_level_template_names(): templates.append('"%s"' % get_prefix_level_template_path(name)) variables.append(( 'PREFIX_LEVEL', templates)) lines = [] for (k, v) in variables: if isinstance(v, list): lines.append('set(ament_cmake_package_templates_%s "")' % k) for vv in v: lines.append('list(APPEND ament_cmake_package_templates_%s %s)' % (k, vv)) else: lines.append('set(ament_cmake_package_templates_%s %s)' % (k, v)) # Ensure backslashes are replaced with forward slashes because CMake cannot # parse files with backslashes in it. return [line.replace('\\', '/') for line in lines] if __name__ == '__main__': main() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/000077500000000000000000000000001420356112300235245ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install.cmake.in000066400000000000000000000247261420356112300327060ustar00rootroot00000000000000# generated from # ament_cmake_core/cmake/symlink_install/ament_cmake_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 cmake_current_source_dir: The CMAKE_CURRENT_SOURCE_DIR when install # was invoked # :type cmake_current_source_dir: string # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(ament_cmake_symlink_install_directory cmake_current_source_dir) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION" "DIRECTORY;PATTERN;PATTERN_EXCLUDE" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_cmake_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() _ament_cmake_symlink_install_create_symlink("${absolute_file}" "${symlink}") endforeach() else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "ament_cmake_symlink_install_directory() can't find '${dir}'") endif() endif() endforeach() endfunction() # # Reimplement CMake install(FILES) command to use symlinks instead of copying # resources. # # :param cmake_current_source_dir: The CMAKE_CURRENT_SOURCE_DIR when install # was invoked # :type cmake_current_source_dir: string # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(ament_cmake_symlink_install_files cmake_current_source_dir) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION;RENAME" "FILES" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_cmake_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 "ament_cmake_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() _ament_cmake_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "ament_cmake_symlink_install_files() can't find '${file}'") endif() endif() endforeach() endfunction() # # Reimplement CMake install(PROGRAMS) command to use symlinks instead of copying # resources. # # :param cmake_current_source_dir: The CMAKE_CURRENT_SOURCE_DIR when install # was invoked # :type cmake_current_source_dir: string # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(ament_cmake_symlink_install_programs cmake_current_source_dir) cmake_parse_arguments(ARG "OPTIONAL" "DESTINATION" "PROGRAMS" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_cmake_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}") _ament_cmake_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "ament_cmake_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(ament_cmake_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 "ament_cmake_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 "ament_cmake_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 MATCHES "\\.so(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?$") 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}") _ament_cmake_symlink_install_create_symlink("${file}" "${symlink}") else() if(NOT ARG_OPTIONAL) message(FATAL_ERROR "ament_cmake_symlink_install_targets() can't find '${file}'") endif() endif() endforeach() endfunction() function(_ament_cmake_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 ament_cmake_symlink_install_append_install_code.cmake000066400000000000000000000023301420356112300362540ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install# 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(ament_cmake_symlink_install_append_install_code) cmake_parse_arguments(ARG "" "" "COMMENTS" ${ARGN}) # append code to install script if(ARG_COMMENTS) file(APPEND "${AMENT_CMAKE_SYMLINK_INSTALL_INSTALL_SCRIPT}" "\n# ${ARG_COMMENTS}\n") endif() foreach(code ${ARG_UNPARSED_ARGUMENTS}) file(APPEND "${AMENT_CMAKE_SYMLINK_INSTALL_INSTALL_SCRIPT}" "${code}\n") endforeach() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install_directory.cmake000066400000000000000000000050471420356112300343600ustar00rootroot00000000000000# 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(ament_cmake_symlink_install_directory directory_keyword) if(NOT directory_keyword STREQUAL "DIRECTORY") message(FATAL_ERROR "ament_cmake_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}\"") ament_cmake_symlink_install_append_install_code( "ament_cmake_symlink_install_directory(\"${CMAKE_CURRENT_SOURCE_DIR}\" DIRECTORY ${argn_quoted})" COMMENTS "install(DIRECTORY ${argn_quoted})" ) endif() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install_files.cmake000066400000000000000000000032511420356112300334510ustar00rootroot00000000000000# 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(ament_cmake_symlink_install_files files_keyword) if(NOT files_keyword STREQUAL "FILES") message(FATAL_ERROR "ament_cmake_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}\"") ament_cmake_symlink_install_append_install_code( "ament_cmake_symlink_install_files(\"${CMAKE_CURRENT_SOURCE_DIR}\" FILES ${argn_quoted})" COMMENTS "install(FILES ${argn_quoted})" ) endif() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install_programs.cmake000066400000000000000000000033321420356112300342010ustar00rootroot00000000000000# 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(ament_cmake_symlink_install_programs programs_keyword) if(NOT programs_keyword STREQUAL "PROGRAMS") message(FATAL_ERROR "ament_cmake_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}\"") ament_cmake_symlink_install_append_install_code( "ament_cmake_symlink_install_programs(\"${CMAKE_CURRENT_SOURCE_DIR}\" PROGRAMS ${argn_quoted})" COMMENTS "install(PROGRAMS ${argn_quoted})" ) endif() endfunction() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install_targets.cmake000066400000000000000000000102771420356112300340260ustar00rootroot00000000000000# 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(__AMENT_CMAKE_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(ament_cmake_symlink_install_targets) if(NOT "${ARGV0}" STREQUAL "TARGETS") message(FATAL_ERROR "ament_cmake_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 "ament_cmake_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 "ament_cmake_symlink_install_targets() '${target}' is not a target") endif() get_target_property(is_imported "${target}" IMPORTED) if(is_imported) message(FATAL_ERROR "ament_cmake_symlink_install_targets() " "'${target}' is an imported target") endif() list(APPEND target_files "$") get_target_property(target_type "${target}" TYPE) if(WIN32 AND "${target_type}" STREQUAL "SHARED_LIBRARY") list(APPEND target_files "$") endif() 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}/ament_cmake_symlink_install_targets_${__AMENT_CMAKE_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 __AMENT_CMAKE_SYMLINK_INSTALL_TARGETS_INDEX "${__AMENT_CMAKE_SYMLINK_INSTALL_TARGETS_INDEX} + 1") set(__AMENT_CMAKE_SYMLINK_INSTALL_TARGETS_INDEX "${__AMENT_CMAKE_SYMLINK_INSTALL_TARGETS_INDEX}" CACHE INTERNAL "Index for unique symlink install targets") file(GENERATE OUTPUT "${generated_file_generator_suffix}" CONTENT "ament_cmake_symlink_install_targets(${target_files_quoted} ${argn_quoted})\n") ament_cmake_symlink_install_append_install_code( "include(\"${generated_file_variable_suffix}\")" COMMENTS "install(${argn_quoted})" ) endif() endfunction() ament_cmake_symlink_install_uninstall_script.cmake.in000066400000000000000000000017321420356112300362740ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install# generated from # ament_cmake_core/cmake/symlink_install/ament_cmake_symlink_install_uninstall_script.cmake.in set(install_manifest "@CMAKE_CURRENT_BINARY_DIR@/symlink_install_manifest.txt") if(NOT EXISTS "${install_manifest}") message(FATAL_ERROR "Cannot find symlink install manifest: ${install_manifest}") endif() file(READ "${install_manifest}" installed_files) string(REGEX REPLACE "\n" ";" installed_files "${installed_files}") foreach(installed_file ${installed_files}) if(EXISTS "${installed_file}" OR IS_SYMLINK "${installed_file}") message(STATUS "Uninstalling: ${installed_file}") file(REMOVE "${installed_file}") if(EXISTS "${installed_file}" OR IS_SYMLINK "${installed_file}") message(FATAL_ERROR "Failed to remove '${installed_file}'") endif() # remove empty parent folders get_filename_component(parent_path "${installed_file}" PATH) ament_cmake_uninstall_target_remove_empty_directories("${parent_path}") endif() endforeach() ament_cmake-1.3.0/ament_cmake_core/cmake/symlink_install/install.cmake000066400000000000000000000031041420356112300261720ustar00rootroot00000000000000# 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. # # Overwrite CMake install command to use symlinks instead of copying resources. # # :param signature: one of the CMake keywords used to choose between the # different install signatures, e.g. DIRECTORY, FILES, PROGRAMS, TARGETS. # :type signature: string # :param ARGN: the same arguments as the CMake install command. # :type ARGN: various # function(install signature) string(TOUPPER "${signature}" signature) if(signature STREQUAL "DIRECTORY") ament_cmake_symlink_install_directory(DIRECTORY ${ARGN}) return() elseif(signature STREQUAL "FILES") ament_cmake_symlink_install_files(FILES ${ARGN}) return() elseif(signature STREQUAL "PROGRAMS") ament_cmake_symlink_install_programs(PROGRAMS ${ARGN}) return() elseif(signature STREQUAL "TARGETS") ament_cmake_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() ament_cmake-1.3.0/ament_cmake_core/cmake/uninstall_target/000077500000000000000000000000001420356112300236675ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/uninstall_target/ament_cmake_uninstall_target.cmake.in000066400000000000000000000041031420356112300331770ustar00rootroot00000000000000# generated from # ament_cmake_core/cmake/uninstall_target/ament_cmake_uninstall_target.cmake.in function(ament_cmake_uninstall_target_remove_empty_directories path) set(install_space "@CMAKE_INSTALL_PREFIX@") if(install_space STREQUAL "") message(FATAL_ERROR "The CMAKE_INSTALL_PREFIX variable must not be empty") endif() string(LENGTH "${install_space}" length) string(SUBSTRING "${path}" 0 ${length} path_prefix) if(NOT path_prefix STREQUAL install_space) message(FATAL_ERROR "The path '${path}' must be within the install space '${install_space}'") endif() if(path STREQUAL install_space) return() endif() # check if directory is empty file(GLOB files "${path}/*") list(LENGTH files length) if(length EQUAL 0) message(STATUS "Uninstalling: ${path}/") execute_process(COMMAND "@CMAKE_COMMAND@" "-E" "remove_directory" "${path}") # recursively try to remove parent directories get_filename_component(parent_path "${path}" PATH) ament_cmake_uninstall_target_remove_empty_directories("${parent_path}") endif() endfunction() # uninstall files installed using the standard install() function set(install_manifest "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") if(NOT EXISTS "${install_manifest}") message(FATAL_ERROR "Cannot find install manifest: ${install_manifest}") endif() file(READ "${install_manifest}" installed_files) string(REGEX REPLACE "\n" ";" installed_files "${installed_files}") foreach(installed_file ${installed_files}) if(EXISTS "${installed_file}" OR IS_SYMLINK "${installed_file}") message(STATUS "Uninstalling: ${installed_file}") file(REMOVE "${installed_file}") if(EXISTS "${installed_file}" OR IS_SYMLINK "${installed_file}") message(FATAL_ERROR "Failed to remove '${installed_file}'") endif() # remove empty parent folders get_filename_component(parent_path "${installed_file}" PATH) ament_cmake_uninstall_target_remove_empty_directories("${parent_path}") endif() endforeach() # end of template message(STATUS "Execute custom uninstall script") # begin of custom uninstall code ament_cmake_uninstall_target_append_uninstall_code.cmake000066400000000000000000000023451420356112300371330ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/cmake/uninstall_target# Copyright 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. # # Register a CMake script for execution at uninstall 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(ament_cmake_uninstall_target_append_uninstall_code) cmake_parse_arguments(ARG "" "" "COMMENTS" ${ARGN}) # append code to uninstall script if(ARG_COMMENTS) file(APPEND "${AMENT_CMAKE_UNINSTALL_TARGET_UNINSTALL_SCRIPT}" "\n# ${ARG_COMMENTS}\n") endif() foreach(code ${ARG_UNPARSED_ARGUMENTS}) file(APPEND "${AMENT_CMAKE_UNINSTALL_TARGET_UNINSTALL_SCRIPT}" "${code}\n") endforeach() endfunction() ament_cmake-1.3.0/ament_cmake_core/doc/000077500000000000000000000000001420356112300177755ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_core/doc/resource_index.md000066400000000000000000000502151420356112300233400ustar00rootroot00000000000000package_resource_indexer ======================== System for cataloging and referencing resources distributed by software packages. Conceptual Overview ------------------- This project provides two main things, the ability for packages to register types of resources they install and the ability to make queries about those resources at runtime. A resource can represent any kind of asset or functionality provided by a package. The queries might be anything from "Which packages are installed?" over "Which packages provide plugins of a certain type?" to "What messages and services does a specific package provide?". This project does not aim to catalog and explicitly reference all individual resources, but rather to provide meta information about what resources are provided by what packages and then providing absolute paths to the prefix containing the package. These are the design requirements: - Prevent recursive crawling - Resources should be cataloged in away in which no recursive crawling of directories is required - Autonomous Participation - Packages which register resources should be able to do so without invoking some other package (like this one) - Avoid installed file collisions - Participation should not require a package to overwrite or modify an existing file when installing - This is useful when packaging for Linux package managers - Do not try to capture all information - Many types of resources already provide mechanism for describing and referencing themselves, do not reinvent this - For example, if a system has plugins then it likely already has a mechanism for describing the plugins, this project should not try to capture all of that kind of meta information about individual resources - Stick to meta information about what resources are provided not meta information about the installed resources - Support overlaying - If a package is installed into multiple prefixes on the system and those prefixes are ordered, return information based on that ordering - Do not depend on externally defined environment variables or file formats - The `ROS_PACKAGE_PATH` and `CMAKE_PREFIX_PATH` environment variables - Parsing `package.xml`'s or `plugin.xml`'s These requirements come from experience with the resource discovery system in [ROS](https://wiki.ros.org/), where packages were located anywhere recursively under one of several paths in the `ROS_PACKAGE_PATH` environment variable. This decision has lead to things like `rospack` caching information, which can get out of date, and then lead to subtle bugs for the users. The catkin build system also requires recursive crawling on the `share` directory for each install prefix in order to find packages. This can be slow even though the crawling stops when a `package.xml` is discovered, because in cases like `/usr` the contents of `share` can be broad and folders with no `package.xml` can be deep. Design ------ After some discussion we decided to implement a system which "registers" meta information about the resources installed by packages using a file system. The benefit of this type of system is two fold. First, there is no crawling because there is a well known location under each prefix (`/usr`, `/opt/ros/indigo`, etc...) in which to look and the contents of that location are defined and finite. Second, it can be implemented in a way which does not cause file collisions on installation nor the running or updating of a database at distribution time, which eases the use of this in Linux packaging. This design has the added benefit of being easy to make use of at run time using any programming language because it does not require parsing of files. ### File System Index Layout The general concept is that we define a well known location, `/share/ament_index/resource_index`, which is reserved and in which all packages can install files. We'll call this the "resource index". In this "resource index" is a file system structure which is setup as a set of folders, each of which represent a "resource type". In each of those "resource type" folders every package which provides a resource of that type can install a file named for the package, called a "marker file". Let's look at an example. Each package wants to make the fact that it is installed available to others. In this case the resource is rather a piece of information than a specific asset or functionality. The resource type `packages` is being used to indicate that a package with the name of the resource is installed. The simplest case is that each package (`foo`, `bar`, and `baz`) provides an empty file with its package name within the resource type subfolder. That would look like this: ``` `-- share `-- ament_index `-- resource_index `-- packages `-- foo # empty file `-- bar # empty file `-- baz # empty file ``` So now the operations to answer "Which packages are installed?" is just (Python): ```python import os return os.listdir(os.path.join(prefix, 'share', 'ament_index', 'resource_index', 'packages')) ``` This can be used to catalog other types of resources with varying degrees of precision. There is a trade-off between the number of files installed and the number of ways things are categorized, but run time search is unaffected by the number of categories. For example, we could keep track of which packages have plugins for `rviz`'s display system: ``` `-- share `-- ament_index `-- resource_index |-- packages | `-- foo | `-- bar | `-- baz |-- plugins.rviz.display `-- foo ``` Answering the question "Which packages have plugins for rviz's display system?" is now simply: ```python import os return os.listdir(os.path.join(prefix, 'share', 'ament_index', 'resource_index', 'plugins.rviz.display')) ``` In both examples the resource was just an empty file. But each resource could also store arbitrary content. This could e.g. be used to store a list of messages and services a package does provide. Please read below for recommendations on how to store information in each resource / how to use the information within a resource to reference additional external information. Currently in ROS, this requires that all packages are discovered first and then each manifest file for each package must be parsed (`package.xml` or `manifest.xml`) and then for each package zero to many `plugin.xml` files must be parsed. For this example system, the `package.xml` file and `plugin.xml` files may still need to be parsed, but instead of discovering all packages, and parsing all `package.xml` files this system can already narrow down the packages which need to be considered. In the above example that only saves us from parsing two out of three packages, but in the presence of hundreds of packages, this could be parsing one or two package manifests versus parsing hundreds. It also prevents us from parsing additional, unrelated, `plugin.xml` files, so the win for this type of system with respect to plugin discovery is potentially huge. For other resources, the speed up at this point is probably minimal, but other examples might include "Which packages have defined message files?" or "Which packages have launch files?". These types of queries can potentially speed up command line tools considerably. ### Resource Index Each prefix which contains any packages should contain a resource index folder located at `/share/ament_index/resource_index`. In this context a "prefix" is a FHS compliant file system and typically will be listed in an environment variable as a list of paths, e.g. `ROS_PACKAGE_PATH` or `CMAKE_PREFIX_PATH`, and will contain the system and user "install spaces", e.g. `/usr`, `/usr/local`, `/opt/ros/indigo`, `/home/user/workspace/install`, etc... Any implementation which allows queries should consider multiple prefixes. Consider a set of prefixes in this order: `/home/user/workspace/install`, `/opt/ros/indigo`, and `/usr`. Also consider that the package `foo` is installed into `/home/user/workspace/install` and `/usr`. Then consider the possible answers to the query "List the location of rviz plugin files." where `foo` provides plugins for `rviz` but no other package does: ```python {'foo': ['/home/user/workspace/install/share/foo/plugin.xml', '/usr/share/foo/plugin.xml']} # This is OK {'foo': ['/usr/share/foo/plugin.xml', '/home/user/workspace/install/share/foo/plugin.xml']} # This is Bad ['/home/user/workspace/share/foo/plugin.xml'] # This is also OK ['/usr/share/foo/plugin.xml'] # This is bad! ``` Where possible the implementation should give the user the option to get multiple responses to a question if multiple locations are available, but when the user is asking for one answer, then the first matched prefix, according to the prefix path ordering, should be returned. Note that when returning the multiple results, that they should be organized by package so that it is clear that they are overlaying each other. Also note that when returning multiple results the prefix based ordering should be preserved. Other data structures are possible, but in any case make sure that overlaid results are not presented as peers and that prefix based ordering is preserved in all cases. ### Resource Types Resource types are represented as folders in the resource index and should be shallow, i.e. there should only be marker files within the resource type folders. This means that there is no nesting of resource types, which keeps the file system flat, and makes answering "What resource types are in this ``?" as easy as simply listing the directories in the resource index folder. Any folders within the resource type folders, and any folders/files starting with a dot (`.`), should be ignored while listing the directories in the resource index folder. Instead of nesting resource type folders, the convention of using prefixes and suffixes separated by periods should be used. Resource type names should be agreed on a priori by the packages utilizing them. The `packages` resource type is reserved and every software package should place a marker file in the `packages` resource type folder. Additionally, anything with a marker file in the `packages` resource type should have any corresponding FHS compliant folders and files located relatively to that marker file within this prefix. For example if `/share/ament_index/resource_index/packages/foo` exists then architecture independent files, like a CMake config file or a `package.xml`, should be located relatively from that file in the package's `share` folder, i.e. `../../../foo`. Spaces in the resource type names are allowed, but underscores should be preferred, either way be consistent. ### Marker Files The contents of these files will remain unspecified, but may be used by other systems which utilize this convention to make them more efficient. Consider the plugin example, for each marker file discovered, you must parse a `package.xml` file to get the location of one or more `plugin.xml` files and then parse them. You could conceivably put the locations of the those `plugin.xml` files into the marker files to prevent the need for parsing the `package.xml` at runtime, potentially saving you some time. The nice thing about this is that if you don't want to parse the marker file, then you can still parse the `package.xml` file and find the `plugin.xml` files that way. This is a good model to follow, feel free to optimize by placing domain specific information into the marker files, but you should avoid making it required to get the information. Implementations should consider that spaces are allowed in marker file names, but it would be a good idea to follow the package naming guidelines for catkin packages: http://www.ros.org/reps/rep-0127.html#name ### Integration with Other Systems You should strive to avoid having other systems depend on this system. That is to say, rather than describing your plugins in the marker file you place in the resource index, have the existence of that marker file imply the existence of another file in the share folder for your package. To make that concrete you could do this: ``` `-- share |-- foo | `-- ... # Other, non-plugin related, stuff |-- ament_index |-- resource_index |-- packages | `-- foo | `-- ... |-- plugins.rviz | `-- foo # Contains XML describing the rviz plugin |-- plugins.rqt `-- foo # Contains XML describing the rqt plugin ``` But in that case if someone just looks at the share folder for `foo` and doesn't have knowledge of this system, then they don't see that you have any plugins. Instead you should do it like this: ``` `-- share |-- foo | `-- ... # Other, non-plugin related, stuff | `-- rviz_plugins.xml | `-- rqt_plugins.xml |-- ament_index |-- resource_index |-- packages | `-- foo | `-- ... |-- plugins.rviz | `-- foo # Contains nothing, or the relative path `../../../foo/rviz_plugins.xml` |-- plugins.rqt `-- foo # Contains nothing, or the relative path `../../../foo/rqt_plugins.xml` ``` That way your package has all its required information in its `share` folder and the files in `share/ament_index/resource_index` are simply used as an optimization. While there are no restrictions about content or format of the marker files, you should try to keep them simple. Implementation -------------- The Design description above should be sufficient for anyone to implement a version of this or implement a client to interact with the resource index. Hopefully by clearly describing the layout of the above system, creating tools to facilitate creation of these files in different build systems should be simple. Additionally, the simple file system based layout should make it relatively easy to interact with and query the resource index from any programming language. ### Registering with the Resource Index Registering that your package installs a resource of a particular type should follow these steps: - Do the `/share/ament_index/resource_index/` folders exist? - No: Create them. - Does the `/share/ament_index/resource_index//` file exist? - Yes: At best, error registration collision, otherwise overwrite (bad behavior, but it may not be possible to detect) - No: Create it, with any content you want (keep it simple) This prescription should be relatively easy to follow for any build system. It is recommended that the interface provided to the user follow something like this (CMake in this example): ```cmake # register_package_resource( [CONTENT ]) register_package_resource(${PROJECT_NAME} "plugin.rviz.display" CONTENT "../../../${PROJECT_NAME}/plugin.xml") # register_package() register_package(${PROJECT_NAME}) # register_package(...) is functionally equivalent to: # register_package_resource(${PROJECT_NAME} "packages") ``` ### Querying the Resource Index Querying the resource index should be relatively simple, only requiring the listing of directories to answer all queries. Optionally, the marker files can have information in the content, but at most an implementation of this would only need to return the content of this file and at least just return the path to the file. There are some obvious queries which any implementation should provide. First consider this function (in Python as a demonstration since it is simple): ```python def list_prefix_of_packages_by_resource(resource_type, prefixes): ... ``` This function should take a resource type name as a string and a list of prefixes as strings. It should silently pass if any of the prefixes do not exist, or if any of them do not have a resource index within them. It should return a data structure like this: ```python { '': '/path/to/first-matched-prefix', ... } ``` Perhaps in C a linked list struct representing a "match" would work better: ```C typedef struct PackageResource_Match { char *package_name; char *package_prefix; struct PackageResource_Match *next; } PackageResource_Match; ``` Either way the answer should not only be a list of which packages matched, but the associated prefix in which the package was found so that the user doesn't assume which prefix was matched. Another useful, but probably not required query is this one: ```python def list_all_prefixes_of_packages_by_resource(resource_type, prefixes): ... ``` This one will return all matching prefixes, not just the first matched one, but preserving the prefix ordering. Equivalent data types in Python: ```Python { '': ['/path/to/first-matched-prefix', ...], ... } ``` And the C equivalent: ```C typedef struct PackageResource_PrefixList { char *package_prefix; struct PackageResource_PrefixList *next; } PackageResource_PrefixList; typedef struct PackageResource_Match { char *package_name; struct PackageResource_PrefixList *package_prefixes; struct PackageResource_Match *next; } PackageResource_Match; ``` If desired, there can be a syntactic sugar version for listing packages: ```python def list_prefix_of_packages(prefixes): return list_prefix_of_packages_by_resource('packages', prefixes) ``` And: ```python def list_all_prefixes_of_packages(prefixes): return list_all_prefixes_of_packages_by_resource('packages', prefixes) ``` Additionally, functions which find the prefix(es) for a particular package are probably useful: ```python def get_prefix_for_package(package_name, prefixes): ... def get_all_prefixes_for_package(package_name, prefixes): ... ``` These functions should have some error state (raise or throw or return None/NULL) if the package is not found in any of the prefixes. ### Locating Resources This project does not aim to index all resources for every package, but simply index meta information about what kinds of resources packages have, in order to narrow down searches and prevent recursive crawling. So, if you wanted to locate a particular file, let's say a particular launch for a given package, then you would need to know where that file is installed to, with respect to the install prefix. In this case, this project is only useful in finding which prefix to find it in. So first, you would find which prefix the given package is in by calling the `get_prefix_for_package` function and from there you can append the FHS defined folders like `bin`, `lib`, `share/`, etc... Let's say you know that the launch file is in the `share/` folder because it is not architecture specific and furthermore that it is in the `launch` folder in the `share/` folder and finally that the name of the launch file is `demo.launch`. From that information, and the prefix you got from `get_prefix_for_package`, you can construct the path to the launch file. Let's take another example, you are looking for the location of a shared library for a particular plugin, called `llama_display` of resource type `plugin.rviz.display`, so that you can call `dlopen` on it, but you don't know which package it is (weird case, but instructional): ```python # First you can narrow down which packages might have the plugin packages = list_prefix_of_packages_by_resource('plugin.rviz.display', list_of_prefixes) # Now you can search for the plugin in this considerably shorter list of packages for package_name, prefix in packages.items(): package_xml_path = os.path.join(prefix, 'share', package_name, 'package.xml') # Use something to parse the package.xml package_obj = catkin_pkg.package.parse_package(package_xml_path) # Use some other system to get the plugins with the package.xml plugins = pluginlib.get_plugins_from_package_manifest(package_obj) for plugin in plugins: if plugin.name == 'llama_display': return plugin.shared_library_path ``` Again, this is a scenario in which this project does not find the plugin for you, but instead makes it more efficient to find the plugin. ament_cmake-1.3.0/ament_cmake_core/package.xml000066400000000000000000000025561420356112300213550ustar00rootroot00000000000000 ament_cmake_core 1.3.0 The core of the ament buildsystem in CMake. Several subcomponents provide specific funtionalities: * environment: provide prefix-level setup files * environment_hooks: provide package-level setup files and environment hooks * index: store information in an index and retrieve them without crawling * package_templates: templates from the ament_package Python package * symlink_install: use symlinks for CMake install commands Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas cmake ament_package python3-catkin-pkg-modules cmake ament_package python3-catkin-pkg-modules ament_cmake ament_cmake-1.3.0/ament_cmake_export_definitions/000077500000000000000000000000001420356112300222145ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_definitions/CHANGELOG.rst000066400000000000000000000060321420356112300242360ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_definitions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * Merge pull request `#71 `_ from ament/export_link_flags add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * minor * add ament_cmake_export_definitions * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_export_definitions/CMakeLists.txt000066400000000000000000000004161420356112300247550ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_definitions NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_definitions-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_definitions/ament_cmake_export_definitions-extras.cmake000066400000000000000000000023401420356112300327610ustar00rootroot00000000000000# 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. # generated from # ament_cmake_export_definitions/ament_cmake_export_definitions-extras.cmake.in # register ament_package() hook for definitions once macro(_ament_cmake_export_definitions_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_DEFINITIONS_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_DEFINITIONS_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_definitions" "ament_cmake_export_definitions_package_hook.cmake") endif() endmacro() include("${ament_cmake_export_definitions_DIR}/ament_export_definitions.cmake") ament_cmake-1.3.0/ament_cmake_export_definitions/cmake/000077500000000000000000000000001420356112300232745ustar00rootroot00000000000000ament_cmake_export_definitions-extras.cmake.in000066400000000000000000000005711420356112300343730ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_definitions/cmake# generated from ament_cmake_export_definitions/cmake/ament_cmake_export_definitions-extras.cmake.in set(_exported_definitions "@_AMENT_CMAKE_EXPORT_DEFINITIONS@") # append definitions to @PROJECT_NAME@_DEFINITIONS if(NOT _exported_definitions STREQUAL "") foreach(_def ${_exported_definitions}) list(APPEND @PROJECT_NAME@_DEFINITIONS "${_def}") endforeach() endif() ament_cmake_export_definitions_package_hook.cmake000066400000000000000000000017511420356112300351560ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_definitions/cmake# 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. # generate and register extra file for definitions set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_definitions/ament_cmake_export_definitions-extras.cmake") configure_file( "${ament_cmake_export_definitions_DIR}/ament_cmake_export_definitions-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") ament_cmake-1.3.0/ament_cmake_export_definitions/cmake/ament_export_definitions.cmake000066400000000000000000000024561420356112300314050ustar00rootroot00000000000000# 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. # # Export definitions to downstream packages. # # Each package name must be find_package()-able with the exact same case. # Additionally the exported variables must have a prefix with the same case # and the suffixes must be INCLUDE_DIRS and LIBRARIES. # # :param ARGN: a list of definitions # :type ARGN: list of strings # # @public # macro(ament_export_definitions) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_definitions() must be called before ament_package()") endif() if(${ARGC} GREATER 0) _ament_cmake_export_definitions_register_package_hook() foreach(_arg ${ARGN}) list(APPEND _AMENT_CMAKE_EXPORT_DEFINITIONS "${_arg}") endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_definitions/package.xml000066400000000000000000000014201420356112300243260ustar00rootroot00000000000000 ament_cmake_export_definitions 1.3.0 The ability to export definitions to downstream packages in the ament buildsystem. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_export_dependencies/000077500000000000000000000000001420356112300223275ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_dependencies/CHANGELOG.rst000066400000000000000000000114661420356112300243600ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * fix cmake list(TRANSFORM ) is only available from version 3.12, (`#296 `_) convert to string instead * fix imported targets with multiple configuration (`#290 `_) * fix imported targets with multiple configuration * taking into account DEBUG_CONFIGURATIONS global variable * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo, siposcsaba89 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ * redo use _TARGETS over deprecated _INTERFACES over classic CMake variables (`#251 `_) * redo use _TARGETS over deprecated _INTERFACES over classic CMake variables * update ament_export_dependencies accordingly * also add IMPORTED_LOCATION to the libraries * simplify conditions * consider IMPORTED_IMPLIB for Windows * Contributors: Dirk Thomas 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * Merge pull request `#71 `_ from ament/export_link_flags add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * Merge pull request `#47 `_ from ament/dedup_info_from_depends deduplicate DEFINITIONS, INCLUDE_DIRS and LIBRARIES from exported dependencies * deduplicate DEFINITIONS, INCLUDE_DIRS and LIBRARIES from exported dependencies * add explicit build type * Merge pull request `#15 `_ from ament/fix_message_dependencies export direct and recursive package dependencies * export direct and recursive package dependencies * disable debug output * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * add definitions to exported variables for dependencies * fix libraries when exporting package dependencies * update cmake code style * minor * add ament_cmake_export_interfaces * add ament_cmake_export_dependencies * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_export_dependencies/CMakeLists.txt000066400000000000000000000004201420356112300250630ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_dependencies NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_dependencies-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_dependencies/ament_cmake_export_dependencies-extras.cmake000066400000000000000000000023471420356112300332160ustar00rootroot00000000000000# 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. # copied from # ament_cmake_export_dependencies/ament_cmake_export_dependencies-extras.cmake # register ament_package() hook for dependencies once macro(_ament_cmake_export_dependencies_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_DEPENDENCIES_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_DEPENDENCIES_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_dependencies" "ament_cmake_export_dependencies_package_hook.cmake") endif() endmacro() include( "${ament_cmake_export_dependencies_DIR}/ament_export_dependencies.cmake") ament_cmake-1.3.0/ament_cmake_export_dependencies/cmake/000077500000000000000000000000001420356112300234075ustar00rootroot00000000000000ament_cmake_export_dependencies-extras.cmake.in000066400000000000000000000076361420356112300346320ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_dependencies/cmake# generated from ament_cmake_export_dependencies/cmake/ament_cmake_export_dependencies-extras.cmake.in set(_exported_dependencies "@_AMENT_CMAKE_EXPORT_DEPENDENCIES@") find_package(ament_cmake_libraries QUIET REQUIRED) # find_package() all dependencies # and append their DEFINITIONS INCLUDE_DIRS, LIBRARIES, and LINK_FLAGS # variables to @PROJECT_NAME@_DEFINITIONS, @PROJECT_NAME@_INCLUDE_DIRS, # @PROJECT_NAME@_LIBRARIES, and @PROJECT_NAME@_LINK_FLAGS. # Additionally collect the direct dependency names in # @PROJECT_NAME@_DEPENDENCIES as well as the recursive dependency names # in @PROJECT_NAME@_RECURSIVE_DEPENDENCIES. if(NOT _exported_dependencies STREQUAL "") find_package(ament_cmake_core QUIET REQUIRED) set(@PROJECT_NAME@_DEPENDENCIES ${_exported_dependencies}) set(@PROJECT_NAME@_RECURSIVE_DEPENDENCIES ${_exported_dependencies}) set(_libraries) foreach(_dep ${_exported_dependencies}) if(NOT ${_dep}_FOUND) find_package("${_dep}" QUIET REQUIRED) endif() # if a package provides modern CMake interface targets use them # exclusively assuming the classic CMake variables only exist for # backward compatibility set(use_modern_cmake FALSE) if(NOT "${${_dep}_TARGETS}" STREQUAL "") foreach(_target ${${_dep}_TARGETS}) # only use actual targets # in case a package uses this variable for other content if(TARGET "${_target}") get_target_property(_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES) if(_include_dirs) list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS "${_include_dirs}") endif() get_target_property(_imported_configurations ${_target} IMPORTED_CONFIGURATIONS) if(_imported_configurations) string(TOUPPER "${_imported_configurations}" _imported_configurations) if(DEBUG_CONFIGURATIONS) string(TOUPPER "${DEBUG_CONFIGURATIONS}" _debug_configurations_uppercase) else() set(_debug_configurations_uppercase "DEBUG") endif() foreach(_imported_config ${_imported_configurations}) get_target_property(_imported_implib ${_target} IMPORTED_IMPLIB_${_imported_config}) if(_imported_implib) set(_imported_implib_config "optimized") if(${_imported_config} IN_LIST _debug_configurations_uppercase) set(_imported_implib_config "debug") endif() list(APPEND _libraries ${_imported_implib_config} ${_imported_implib}) else() get_target_property(_imported_location ${_target} IMPORTED_LOCATION_${_imported_config}) if(_imported_location) list(APPEND _libraries "${_imported_location}") endif() endif() endforeach() endif() get_target_property(_link_libraries ${_target} INTERFACE_LINK_LIBRARIES) if(_link_libraries) list(APPEND _libraries "${_link_libraries}") endif() set(use_modern_cmake TRUE) endif() endforeach() endif() if(NOT use_modern_cmake) if(${_dep}_DEFINITIONS) list_append_unique(@PROJECT_NAME@_DEFINITIONS "${${_dep}_DEFINITIONS}") endif() if(${_dep}_INCLUDE_DIRS) list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}") endif() if(${_dep}_LIBRARIES) list(APPEND _libraries "${${_dep}_LIBRARIES}") endif() if(${_dep}_LINK_FLAGS) list_append_unique(@PROJECT_NAME@_LINK_FLAGS "${${_dep}_LINK_FLAGS}") endif() if(${_dep}_RECURSIVE_DEPENDENCIES) list_append_unique(@PROJECT_NAME@_RECURSIVE_DEPENDENCIES "${${_dep}_RECURSIVE_DEPENDENCIES}") endif() endif() if(_libraries) ament_libraries_deduplicate(_libraries "${_libraries}") list(APPEND @PROJECT_NAME@_LIBRARIES "${_libraries}") endif() endforeach() endif() ament_cmake_export_dependencies_package_hook.cmake000066400000000000000000000017561420356112300354110ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_dependencies/cmake# 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. # generate and register extra file for dependencies set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_dependencies/ament_cmake_export_dependencies-extras.cmake") configure_file( "${ament_cmake_export_dependencies_DIR}/ament_cmake_export_dependencies-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") ament_cmake-1.3.0/ament_cmake_export_dependencies/cmake/ament_export_dependencies.cmake000066400000000000000000000027311420356112300316270ustar00rootroot00000000000000# 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. # # Export dependencies to downstream packages. # # Each package name must be find_package()-able with the exact same case. # Additionally the exported variables must have a prefix with the same case # and the suffixes must be INCLUDE_DIRS and LIBRARIES. # # :param ARGN: a list of package names # :type ARGN: list of strings # # @public # macro(ament_export_dependencies) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_dependencies() must be called before ament_package()") endif() if(${ARGC} GREATER 0) _ament_cmake_export_dependencies_register_package_hook() foreach(_arg ${ARGN}) # only pass package name # will be resolved by downstream packages # must be find_package()-able # and provide _INCLUDE_DIRS and _LIBRARIES list(APPEND _AMENT_CMAKE_EXPORT_DEPENDENCIES "${_arg}") endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_dependencies/package.xml000066400000000000000000000015461420356112300244520ustar00rootroot00000000000000 ament_cmake_export_dependencies 1.3.0 The ability to export dependencies to downstream packages in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_libraries ament_cmake ament_cmake-1.3.0/ament_cmake_export_include_directories/000077500000000000000000000000001420356112300237205ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_include_directories/CHANGELOG.rst000066400000000000000000000056031420356112300257450ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_include_directories ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * avoid duplicate exported include dirs for a package * add normalize_path function * update cmake code style * add ament_cmake_auto * minor * add ament_cmake_export_include_directories * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_export_include_directories/CMakeLists.txt000066400000000000000000000004361420356112300264630ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_include_directories NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_include_directories-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake_export_include_directories-extras.cmake000066400000000000000000000024721420356112300361200ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_include_directories# 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. # copied from ament_cmake_export_include_directories # /ament_cmake_export_include_directories-extras.cmake # register ament_package() hook for include directories once macro(_ament_cmake_export_include_directories_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_INCLUDE_DIRECTORIES_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_INCLUDE_DIRECTORIES_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_include_directories" "ament_cmake_export_include_directories_package_hook.cmake") endif() endmacro() include( "${ament_cmake_export_include_directories_DIR}/ament_export_include_directories.cmake") ament_cmake-1.3.0/ament_cmake_export_include_directories/cmake/000077500000000000000000000000001420356112300250005ustar00rootroot00000000000000ament_cmake_export_include_directories-extras.cmake.in000066400000000000000000000014241420356112300376010ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_include_directories/cmake# generated from ament_cmake_export_include_directories/cmake/ament_cmake_export_include_directories-extras.cmake.in set(_exported_include_dirs "@_AMENT_CMAKE_EXPORT_INCLUDE_DIRECTORIES@") # append include directories to @PROJECT_NAME@_INCLUDE_DIRS # warn about not existing paths if(NOT _exported_include_dirs STREQUAL "") find_package(ament_cmake_core QUIET REQUIRED) foreach(_exported_include_dir ${_exported_include_dirs}) if(NOT IS_DIRECTORY "${_exported_include_dir}") message(WARNING "Package '@PROJECT_NAME@' exports the include directory '${_exported_include_dir}' which doesn't exist") endif() normalize_path(_exported_include_dir "${_exported_include_dir}") list(APPEND @PROJECT_NAME@_INCLUDE_DIRS "${_exported_include_dir}") endforeach() endif() ament_cmake_export_include_directories_package_hook.cmake000066400000000000000000000023131420356112300403610ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_include_directories/cmake# 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. # list relative paths before absolute paths set(_AMENT_CMAKE_EXPORT_INCLUDE_DIRECTORIES ${_AMENT_EXPORT_RELATIVE_INCLUDE_DIRECTORIES} ${_AMENT_EXPORT_ABSOLUTE_INCLUDE_DIRECTORIES}) # generate and register extra file for include directories set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_include_directories/ament_cmake_export_include_directories-extras.cmake") configure_file( "${ament_cmake_export_include_directories_DIR}/ament_cmake_export_include_directories-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") ament_export_include_directories.cmake000066400000000000000000000036321420356112300345330ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_include_directories/cmake# 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. # # Export include directories to downstream packages. # # Relative paths will be exported before absolute paths. # Non existing absolute paths will result in warning. # # :param ARGN: a list of include directories where each value might # be either an absolute path or path relative to the # CMAKE_INSTALL_PREFIX. # :type ARGN: list of strings # # @public # macro(ament_export_include_directories) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_include_directories() must be called " "before ament_package()") endif() if(${ARGC} GREATER 0) _ament_cmake_export_include_directories_register_package_hook() foreach(_arg ${ARGN}) if(NOT IS_ABSOLUTE "${_arg}") # prefix relative paths with CMAKE_INSTALL_PREFIX # while avoiding to embed any absolute path set(_arg "\${${PROJECT_NAME}_DIR}/../../../${_arg}") list_append_unique(_AMENT_EXPORT_RELATIVE_INCLUDE_DIRECTORIES "${_arg}") else() if(NOT IS_DIRECTORY "${_arg}") message(WARNING "ament_export_include_directories() package '${PROJECT_NAME}' " "exports the include directory '${_arg}' which doesn't exist") endif() list_append_unique(_AMENT_EXPORT_ABSOLUTE_INCLUDE_DIRECTORIES "${_arg}") endif() endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_include_directories/package.xml000066400000000000000000000014511420356112300260360ustar00rootroot00000000000000 ament_cmake_export_include_directories 1.3.0 The ability to export include directories to downstream packages in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_export_interfaces/000077500000000000000000000000001420356112300220245ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_interfaces/CHANGELOG.rst000066400000000000000000000072441420356112300240540ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_interfaces ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * deprecate ament_export_interfaces() in favor of ament_export_targets() (`#238 `_) * duplicate ament_cmake_export_interfaces to ament_cmake_export_targets * update names in ament_cmake_export_targets after duplicating the files, add deprecation message for ament_export_interfaces(), add ament_cmake_export_targets to ament_cmake * fix names of exported interfaces in @PROJECT_NAME@_INTERFACES (`#231 `_) * fix names of exported interfaces in @PROJECT_NAME@_INTERFACES * use string(REGEX REPLACE ..) * Contributors: Dirk Thomas 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ * export library path for library interfaces (`#135 `_) * add option to export library path for library interfaces * update doc * add variable with exported interfaces (`#126 `_) * Contributors: Dirk Thomas 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * minor * add ament_cmake_export_interfaces * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_export_interfaces/CMakeLists.txt000066400000000000000000000004141420356112300245630ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_interfaces NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_interfaces-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_interfaces/ament_cmake_export_interfaces-extras.cmake000066400000000000000000000023201420356112300323770ustar00rootroot00000000000000# 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. # copied from # ament_cmake_export_interfaces/ament_cmake_export_interfaces-extras.cmake # register ament_package() hook for interfaces once macro(_ament_cmake_export_interfaces_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_INTERFACES_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_INTERFACES_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_interfaces" "ament_cmake_export_interfaces_package_hook.cmake") endif() endmacro() include("${ament_cmake_export_interfaces_DIR}/ament_export_interfaces.cmake") ament_cmake-1.3.0/ament_cmake_export_interfaces/cmake/000077500000000000000000000000001420356112300231045ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_interfaces/cmake/ament_cmake_export_interfaces-extras.cmake.in000066400000000000000000000017471420356112300341000ustar00rootroot00000000000000# generated from ament_cmake_export_interfaces/cmake/ament_cmake_export_interfaces-extras.cmake.in set(_exported_interfaces "@_AMENT_CMAKE_EXPORT_INTERFACES@") # include all exported interfaces if(NOT _exported_interfaces STREQUAL "") foreach(_interface ${_exported_interfaces}) set(_export_file "${@PROJECT_NAME@_DIR}/${_interface}Export.cmake") include("${_export_file}") # extract the target names associated with the export set(_regex "foreach\\(_expectedTarget (.+)\\)") file( STRINGS "${_export_file}" _foreach_targets REGEX "${_regex}") list(LENGTH _foreach_targets _matches) if(NOT _matches EQUAL 1) message(FATAL_ERROR "Failed to find exported target names in '${_export_file}'") endif() string(REGEX REPLACE "${_regex}" "\\1" _targets "${_foreach_targets}") string(REPLACE " " ";" _targets "${_targets}") list(LENGTH _targets _length) list(APPEND @PROJECT_NAME@_INTERFACES ${_targets}) endforeach() endif() ament_cmake_export_interfaces_package_hook.cmake000066400000000000000000000024661420356112300346020ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_interfaces/cmake# 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. # generate and register extra file for interfaces set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_interfaces/ament_cmake_export_interfaces-extras.cmake") configure_file( "${ament_cmake_export_interfaces_DIR}/ament_cmake_export_interfaces-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") # install export files for interfaces if(NOT _AMENT_CMAKE_EXPORT_INTERFACES STREQUAL "") foreach(_interface ${_AMENT_CMAKE_EXPORT_INTERFACES}) install( EXPORT "${_interface}" DESTINATION share/${PROJECT_NAME}/cmake NAMESPACE "${PROJECT_NAME}::" FILE "${_interface}Export.cmake" ) endforeach() endif() ament_cmake-1.3.0/ament_cmake_export_interfaces/cmake/ament_export_interfaces.cmake000066400000000000000000000036131420356112300310210ustar00rootroot00000000000000# 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. # # Export interfaces to downstream packages. # # Each interface name must have been used to install targets using # ``install(TARGETS ... EXPORT name ...)``. # The ``install(EXPORT ...)`` invocation is handled by this macros. # # :param HAS_LIBRARY_TARGET: if set, an environment variable will be defined # so that the library can be found at runtime # :type HAS_LIBRARY_TARGET: option # :param ARGN: a list of export names # :type ARGN: list of strings # # @public # macro(ament_export_interfaces) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_interfaces() must be called before ament_package()") endif() cmake_parse_arguments(_ARG "HAS_LIBRARY_TARGET" "" "" ${ARGN}) message(DEPRECATION "ament_export_interfaces() is deprecated, use ament_export_targets() " "instead") if(${ARGC} GREATER 0) _ament_cmake_export_interfaces_register_package_hook() foreach(_arg ${_ARG_UNPARSED_ARGUMENTS}) list(APPEND _AMENT_CMAKE_EXPORT_INTERFACES "${_arg}") endforeach() # if the export name contains is a library target # make sure to register an environment hook if(${_ARG_HAS_LIBRARY_TARGET}) find_package(ament_cmake_export_libraries QUIET REQUIRED) _ament_cmake_export_libraries_register_environment_hook() endif() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_interfaces/package.xml000066400000000000000000000015511420356112300241430ustar00rootroot00000000000000 ament_cmake_export_interfaces 1.3.0 The ability to export interfaces to downstream packages in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_export_libraries ament_cmake ament_cmake-1.3.0/ament_cmake_export_libraries/000077500000000000000000000000001420356112300216555ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_libraries/CHANGELOG.rst000066400000000000000000000136311420356112300237020ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_libraries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Add note regarding interface libraries (`#339 `_) * Update maintainers (`#336 `_) * Contributors: Bjar Ne, Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ * Fix variable name in ament_export_libraries.cmake (`#314 `_) * Contributors: Alejandro Hernández Cordero 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * use OUTPUT_NAME of exported library if set (`#239 `_) * Contributors: Dirk Thomas 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * _library_dirs -> _library_dirs_suffix (`#179 `_) * Contributors: Shane Loretz 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ * fix regex for build configuration keywords (`#148 `_) * Contributors: Dirk Thomas 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * Merge pull request `#103 `_ from ament/resolve_some_todos Resolve some todos * move todo to line with comment * 0.0.2 * Revert "consider LOCATION property if IMPORTED_LOCATION is not set" (`#83 `_) * Merge pull request `#81 `_ from ament/consider_location_property consider LOCATION property if IMPORTED_LOCATION is not set * consider LOCATION property if IMPORTED_LOCATION is not set * Merge pull request `#75 `_ from ament/refactor_library_export keep order of exported libraries and allow linker flags * keep order of exported libraries and allow linker flags * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * Merge pull request `#42 `_ from ament/reuse_hook_from_ament_package reuse environment hook provided by ament_package * reuse environment hook provided by ament_package * Merge pull request `#39 `_ from ament/remove_lib_from_path remove the lib folder from the PATH on Windows * remove the lib folder from the PATH on Windows * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * Merge pull request `#3 `_ from ament/windows Windows Support * escalating missing library to FATAL_ERROR It was previously a WARNING in CMake, but that leads to missing symbol errors, which can be misleading since the library was actually not found but the first inclination is to check the library which contains the symbols for errors. We might consider the need to change this back in the future for cases where having the library is not critical. * addressing review comments * addressing review comments * [windows] add missing file ext * [windows] remove redundant .bat * [windows] compact file extension logic * [windows] fix bug in prepend unique bat function * [windows] add batch version of env hooks * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * refactor to use templates provided by ament_package * deal with CMake double expansion * fix exported library names * fix exporting absolute libraries * update cmake code style * add ament_cmake_gmock * add ament_cmake_auto * add ament_cmake_environment_hooks * minor * add ament_cmake_export_libraries * Contributors: Dirk Thomas, Mikael Arguedas, William Woodall ament_cmake-1.3.0/ament_cmake_export_libraries/CMakeLists.txt000066400000000000000000000004121420356112300244120ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_libraries NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_libraries-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_libraries/ament_cmake_export_libraries-extras.cmake000066400000000000000000000033571420356112300320740ustar00rootroot00000000000000# 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. # copied from # ament_cmake_export_libraries/ament_cmake_export_libraries-extras.cmake # register environment hook for libraries once macro(_ament_cmake_export_libraries_register_environment_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_LIBRARIES_ENVIRONMENT_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_LIBRARIES_ENVIRONMENT_HOOK_REGISTERED TRUE) if(NOT WIN32) find_package(ament_cmake_core QUIET REQUIRED) ament_environment_hooks( "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}") endif() endif() endmacro() # register ament_package() hook for libraries once macro(_ament_cmake_export_libraries_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_LIBRARIES_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_LIBRARIES_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_libraries" "ament_cmake_export_libraries_package_hook.cmake") endif() endmacro() include("${ament_cmake_export_libraries_DIR}/ament_export_libraries.cmake") include("${ament_cmake_export_libraries_DIR}/ament_export_library_names.cmake") ament_cmake-1.3.0/ament_cmake_export_libraries/cmake/000077500000000000000000000000001420356112300227355ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries-extras.cmake.in000066400000000000000000000117751420356112300335640ustar00rootroot00000000000000# generated from ament_cmake_export_libraries/cmake/template/ament_cmake_export_libraries.cmake.in set(_exported_libraries "@_AMENT_EXPORT_LIBRARIES@") set(_exported_library_names "@_AMENT_EXPORT_LIBRARY_NAMES@") # populate @PROJECT_NAME@_LIBRARIES if(NOT _exported_libraries STREQUAL "") # loop over libraries, either target names or absolute paths list(LENGTH _exported_libraries _length) set(_i 0) while(_i LESS _length) list(GET _exported_libraries ${_i} _arg) # pass linker flags along if("${_arg}" MATCHES "^-" AND NOT "${_arg}" MATCHES "^-[l|framework]") list(APPEND @PROJECT_NAME@_LIBRARIES "${_arg}") math(EXPR _i "${_i} + 1") continue() endif() if("${_arg}" MATCHES "^(debug|optimized|general)$") # remember build configuration keyword # and get following library set(_cfg "${_arg}") math(EXPR _i "${_i} + 1") if(_i EQUAL _length) message(FATAL_ERROR "Package '@PROJECT_NAME@' passes the build configuration keyword '${_cfg}' as the last exported library") endif() list(GET _exported_libraries ${_i} _library) else() # the value is a library without a build configuration keyword set(_cfg "") set(_library "${_arg}") endif() math(EXPR _i "${_i} + 1") if(NOT IS_ABSOLUTE "${_library}") # search for library target relative to this CMake file set(_lib "NOTFOUND") find_library( _lib NAMES "${_library}" PATHS "${@PROJECT_NAME@_DIR}/../../../lib" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) if(NOT _lib) # warn about not existing library and ignore it message(FATAL_ERROR "Package '@PROJECT_NAME@' exports the library '${_library}' which couldn't be found") elseif(NOT IS_ABSOLUTE "${_lib}") # the found library must be an absolute path message(FATAL_ERROR "Package '@PROJECT_NAME@' found the library '${_library}' at '${_lib}' which is not an absolute path") elseif(NOT EXISTS "${_lib}") # the found library must exist message(FATAL_ERROR "Package '@PROJECT_NAME@' found the library '${_lib}' which doesn't exist") else() list(APPEND @PROJECT_NAME@_LIBRARIES ${_cfg} "${_lib}") endif() else() if(NOT EXISTS "${_library}") # the found library must exist message(WARNING "Package '@PROJECT_NAME@' exports the library '${_library}' which doesn't exist") else() list(APPEND @PROJECT_NAME@_LIBRARIES ${_cfg} "${_library}") endif() endif() endwhile() endif() # find_library() library names with optional LIBRARY_DIRS # and add the libraries to @PROJECT_NAME@_LIBRARIES if(NOT _exported_library_names STREQUAL "") # loop over library names # but remember related build configuration keyword if available list(LENGTH _exported_library_names _length) set(_i 0) while(_i LESS _length) list(GET _exported_library_names ${_i} _arg) # pass linker flags along if("${_arg}" MATCHES "^-" AND NOT "${_arg}" MATCHES "^-[l|framework]") list(APPEND @PROJECT_NAME@_LIBRARIES "${_arg}") math(EXPR _i "${_i} + 1") continue() endif() if("${_arg}" MATCHES "^(debug|optimized|general)$") # remember build configuration keyword # and get following library name set(_cfg "${_arg}") math(EXPR _i "${_i} + 1") if(_i EQUAL _length) message(FATAL_ERROR "Package '@PROJECT_NAME@' passes the build configuration keyword '${_cfg}' as the last exported target") endif() list(GET _exported_library_names ${_i} _library) else() # the value is a library target without a build configuration keyword set(_cfg "") set(_library "${_arg}") endif() math(EXPR _i "${_i} + 1") # extract optional LIBRARY_DIRS from library name string(REPLACE ":" ";" _library_dirs "${_library}") list(GET _library_dirs 0 _library_name) list(REMOVE_AT _library_dirs 0) set(_lib "NOTFOUND") if(NOT _library_dirs) # search for library in the common locations find_library( _lib NAMES "${_library_name}" ) if(NOT _lib) # warn about not existing library and later ignore it message(WARNING "Package '@PROJECT_NAME@' exports library '${_library_name}' which couldn't be found") endif() else() # search for library in the specified directories find_library( _lib NAMES "${_library_name}" PATHS ${_library_dirs} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) if(NOT _lib) # warn about not existing library and later ignore it message(WARNING "Package '@PROJECT_NAME@' exports library '${_library_name}' with LIBRARY_DIRS '${_library_dirs}' which couldn't be found") endif() endif() if(_lib) list(APPEND @PROJECT_NAME@_LIBRARIES ${_cfg} "${_lib}") endif() endwhile() endif() # TODO(dirk-thomas) deduplicate @PROJECT_NAME@_LIBRARIES # while maintaining library order # as well as build configuration keywords # as well as linker flags ament_cmake-1.3.0/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries_package_hook.cmake000066400000000000000000000022361420356112300343360ustar00rootroot00000000000000# 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. # TODO(dirk-thomas) deduplicate _AMENT_EXPORT_LIBRARIES and _AMENT_EXPORT_LIBRARY_NAMES # while maintaining library order # as well as build configuration keywords # as well as linker flags # generate and register extra file for libraries set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_libraries/ament_cmake_export_libraries-extras.cmake") configure_file( "${ament_cmake_export_libraries_DIR}/ament_cmake_export_libraries-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") ament_cmake-1.3.0/ament_cmake_export_libraries/cmake/ament_export_libraries.cmake000066400000000000000000000124141420356112300305020ustar00rootroot00000000000000# 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. # # Export libraries to downstream packages. # # :param ARGN: a list of libraries. # Each element might either be an absolute path to a library, a # CMake library target, or a CMake imported libary target. # Note that this macro is not needed for interface library targets. # If a plain library name is passed it will be redirected to # ament_export_library_names(). # :type ARGN: list of strings # # @public # macro(ament_export_libraries) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_libraries() must be called before ament_package()") endif() if(${ARGC} GREATER 0) _ament_cmake_export_libraries_register_environment_hook() _ament_cmake_export_libraries_register_package_hook() # loop over libraries # but remember related build configuration keyword if available set(_argn ${ARGN}) set(_i 0) while(_i LESS ${ARGC}) list(GET _argn ${_i} _arg) # pass linker flags along if("${_arg}" MATCHES "^-" AND NOT "${_arg}" MATCHES "^-[l|framework]") list(APPEND _AMENT_EXPORT_LIBRARIES "${_arg}") math(EXPR _i "${_i} + 1") continue() endif() if("${_arg}" MATCHES "^(debug|optimized|general)$") # remember build configuration keyword # and get following library set(_cfg "${_arg}") math(EXPR _i "${_i} + 1") if(_i EQUAL ${ARGC}) message(FATAL_ERROR "ament_export_libraries() package " "'${PROJECT_NAME}' passes the build configuration keyword " "'${_cfg}' as the last exported library") endif() list(GET _argn ${_i} _lib) else() # the value is a library without a build configuration keyword set(_cfg "") set(_lib "${_arg}") endif() math(EXPR _i "${_i} + 1") if(IS_ABSOLUTE "${_lib}") # keep absolute libraries as-is if(NOT EXISTS "${_lib}") message(FATAL_ERROR "ament_export_libraries() package '${PROJECT_NAME}' exports the " "library '${_lib}' which doesn't exist") endif() list(APPEND _AMENT_EXPORT_LIBRARIES ${_cfg} "${_lib}") elseif(TARGET "${_lib}") # sometimes cmake dependencies define imported targets # in which case the imported library information is not the target name # but the information is embedded in properties of the imported target get_target_property(_is_imported "${_lib}" IMPORTED) if(_is_imported) set(_imported_libraries "") get_target_property(_imported_location "${_lib}" IMPORTED_LOCATION) if(_imported_location) list(APPEND _imported_libraries ${_imported_location}) else() get_target_property(_imported_configurations "${_lib}" IMPORTED_CONFIGURATIONS) foreach(_cfg ${_imported_configurations}) get_target_property(_imported_location_${_cfg} "${_lib}" IMPORTED_LOCATION_${_cfg}) if(_imported_location_${_cfg}) list(APPEND _imported_libraries ${_imported_location_${_cfg}}) endif() endforeach() endif() foreach(_imported_library ${_imported_libraries}) # verify that imported library is an existing absolute path if(NOT IS_ABSOLUTE "${_imported_library}") message(FATAL_ERROR "ament_export_libraries() package " "'${PROJECT_NAME}' exports the imported library " "'${_imported_library}' which is not an absolute path") endif() if(NOT EXISTS "${_imported_library}") message(FATAL_ERROR "ament_export_libraries() package " "'${PROJECT_NAME}' exports the imported library " "'${_imported_library}' which doesn't exist") endif() list(APPEND _AMENT_EXPORT_LIBRARIES ${_cfg} "${_imported_library}") endforeach() else() # keep plain target names as-is # they will be resolved via find_library() # relative to the CMAKE_INSTALL_PREFIX # when find_package() is invoked from a downstream package get_target_property(_output_name ${_lib} OUTPUT_NAME) if(_output_name) list(APPEND _AMENT_EXPORT_LIBRARIES ${_cfg} "${_output_name}") else() list(APPEND _AMENT_EXPORT_LIBRARIES ${_cfg} "${_lib}") endif() endif() else() # keep plain library names as-is # they will be resolved via find_library() # when find_package() is invoked from a downstream package ament_export_library_names(${_cfg} "${_lib}") endif() endwhile() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_libraries/cmake/ament_export_library_names.cmake000066400000000000000000000040531420356112300313550ustar00rootroot00000000000000# 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. # # Export library names to downstream packages. # The libraries are either searched in the paths passed in as # LIBRARY_DIRS or if none are specified in the default locations. # # :param ARGN: a list of library names. # :type ARGN: list of strings # :param LIBRARY_DIRS: an optional list of search paths. # :type LIBRARY_DIRS: list of paths # # @public # macro(ament_export_library_names) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_library_names() must be called before ament_package()") endif() cmake_parse_arguments(_ARG "" "" "LIBRARY_DIRS" ${ARGN}) if(_ARG_UNPARSED_ARGUMENTS) _ament_cmake_export_libraries_register_environment_hook() _ament_cmake_export_libraries_register_package_hook() # library directories need to be added as a suffix to each library name set(_library_dirs "") if(_ARG_LIBRARY_DIRS) string(REPLACE ";" ":" _library_dirs "${_ARG_LIBRARY_DIRS}") endif() foreach(_library_name ${_ARG_UNPARSED_ARGUMENTS}) if("${_library_name}" MATCHES "^(debug|optimized|general)$") # keep build configuration keyword as-is list(APPEND _AMENT_EXPORT_LIBRARY_NAMES "${_library_name}") else() if(_library_dirs) # append library directories to library name set(_library_name "${_library_name}:${_library_dirs}") endif() list(APPEND _AMENT_EXPORT_LIBRARY_NAMES "${_library_name}") endif() endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_libraries/package.xml000066400000000000000000000014251420356112300237740ustar00rootroot00000000000000 ament_cmake_export_libraries 1.3.0 The ability to export libraries to downstream packages in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_export_link_flags/000077500000000000000000000000001420356112300220125ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_link_flags/CHANGELOG.rst000066400000000000000000000045511420356112300240400ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_link_flags ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * Merge pull request `#84 `_ from ament/use_in_list use IN_LIST * use IN_LIST * Merge pull request `#71 `_ from ament/export_link_flags add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_export_link_flags/CMakeLists.txt000066400000000000000000000004141420356112300245510ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_link_flags NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_link_flags-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_link_flags/ament_cmake_export_link_flags-extras.cmake000066400000000000000000000023241420356112300323570ustar00rootroot00000000000000# Copyright 2016 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. # generated from # ament_cmake_export_link_flags/ament_cmake_export_link_flags-extras.cmake.in # register ament_package() hook for link flags once macro(_ament_cmake_export_link_flags_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_LINK_FLAGS_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_LINK_FLAGS_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_link_flags" "ament_cmake_export_link_flags_package_hook.cmake") endif() endmacro() include("${ament_cmake_export_link_flags_DIR}/ament_export_link_flags.cmake") ament_cmake-1.3.0/ament_cmake_export_link_flags/cmake/000077500000000000000000000000001420356112300230725ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_link_flags/cmake/ament_cmake_export_link_flags-extras.cmake.in000066400000000000000000000006031420356112300340420ustar00rootroot00000000000000# generated from ament_cmake_export_link_flags/cmake/ament_cmake_export_link_flags-extras.cmake.in set(_exported_link_flags "@_AMENT_CMAKE_EXPORT_LINK_FLAGS@") # append link_flags to @PROJECT_NAME@_LINK_FLAGS if(NOT "${_exported_link_flags} " STREQUAL " ") foreach(_link_flag ${_exported_link_flags}) list(APPEND @PROJECT_NAME@_LINK_FLAGS "${_link_flag}") endforeach() endif() ament_cmake_export_link_flags_package_hook.cmake000066400000000000000000000017421420356112300345520ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_link_flags/cmake# Copyright 2016 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. # generate and register extra file for link flags set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_link_flags/ament_cmake_export_link_flags-extras.cmake") configure_file( "${ament_cmake_export_link_flags_DIR}/ament_cmake_export_link_flags-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") ament_cmake-1.3.0/ament_cmake_export_link_flags/cmake/ament_export_link_flags.cmake000066400000000000000000000024501420356112300307730ustar00rootroot00000000000000# Copyright 2016 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. # # Export link flags to downstream packages. # # Each package name must be find_package()-able with the exact same case. # Additionally the exported variables must have a prefix with the same case # and the suffixes must be INCLUDE_DIRS and LIBRARIES. # # :param ARGN: a list of link flags # :type ARGN: list of strings # # @public # macro(ament_export_link_flags) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_link_flags() must be called before ament_package()") endif() if(${ARGC} GREATER 0) _ament_cmake_export_link_flags_register_package_hook() foreach(_arg ${ARGN}) list(APPEND _AMENT_CMAKE_EXPORT_LINK_FLAGS "${_arg}") endforeach() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_link_flags/package.xml000066400000000000000000000012261420356112300241300ustar00rootroot00000000000000 ament_cmake_export_link_flags 1.3.0 The ability to export link flags to downstream packages in the ament buildsystem. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_export_targets/000077500000000000000000000000001420356112300213525ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_targets/CHANGELOG.rst000066400000000000000000000051151420356112300233750ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_export_targets ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ * Fix the order in which *Export.cmake files are included (`#256 `_) * Contributors: Ivan Santiago Paunovic 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ * fix order of including exported targets (`#252 `_) * Contributors: Dirk Thomas 0.9.0 (2020-04-24 12:25) ------------------------ * deprecate ament_export_interfaces() in favor of ament_export_targets() (`#238 `_) * duplicate ament_cmake_export_interfaces to ament_cmake_export_targets * update names in ament_cmake_export_targets after duplicating the files, add deprecation message for ament_export_interfaces(), add ament_cmake_export_targets to ament_cmake * Contributors: Dirk Thomas 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ ament_cmake-1.3.0/ament_cmake_export_targets/CMakeLists.txt000066400000000000000000000004061420356112300241120ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_export_targets NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_export_targets-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_export_targets/ament_cmake_export_targets-extras.cmake000066400000000000000000000022621420356112300312600ustar00rootroot00000000000000# 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. # copied from # ament_cmake_export_targets/ament_cmake_export_targets-extras.cmake # register ament_package() hook for targets once macro(_ament_cmake_export_targets_register_package_hook) if(NOT DEFINED _AMENT_CMAKE_EXPORT_TARGETS_PACKAGE_HOOK_REGISTERED) set(_AMENT_CMAKE_EXPORT_TARGETS_PACKAGE_HOOK_REGISTERED TRUE) find_package(ament_cmake_core QUIET REQUIRED) ament_register_extension("ament_package" "ament_cmake_export_targets" "ament_cmake_export_targets_package_hook.cmake") endif() endmacro() include("${ament_cmake_export_targets_DIR}/ament_export_targets.cmake") ament_cmake-1.3.0/ament_cmake_export_targets/cmake/000077500000000000000000000000001420356112300224325ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in000066400000000000000000000017111420356112300327430ustar00rootroot00000000000000# generated from ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in set(_exported_targets "@_AMENT_CMAKE_EXPORT_TARGETS@") # include all exported targets if(NOT _exported_targets STREQUAL "") foreach(_target ${_exported_targets}) set(_export_file "${@PROJECT_NAME@_DIR}/${_target}Export.cmake") include("${_export_file}") # extract the target names associated with the export set(_regex "foreach\\(_expectedTarget (.+)\\)") file( STRINGS "${_export_file}" _foreach_targets REGEX "${_regex}") list(LENGTH _foreach_targets _matches) if(NOT _matches EQUAL 1) message(FATAL_ERROR "Failed to find exported target names in '${_export_file}'") endif() string(REGEX REPLACE "${_regex}" "\\1" _targets "${_foreach_targets}") string(REPLACE " " ";" _targets "${_targets}") list(LENGTH _targets _length) list(APPEND @PROJECT_NAME@_TARGETS ${_targets}) endforeach() endif() ament_cmake-1.3.0/ament_cmake_export_targets/cmake/ament_cmake_export_targets_package_hook.cmake000066400000000000000000000024251420356112300335300ustar00rootroot00000000000000# 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. # generate and register extra file for targets set(_generated_extra_file "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_export_targets/ament_cmake_export_targets-extras.cmake") configure_file( "${ament_cmake_export_targets_DIR}/ament_cmake_export_targets-extras.cmake.in" "${_generated_extra_file}" @ONLY ) list(APPEND ${PROJECT_NAME}_CONFIG_EXTRAS "${_generated_extra_file}") # install export files for targets if(NOT _AMENT_CMAKE_EXPORT_TARGETS STREQUAL "") foreach(_target ${_AMENT_CMAKE_EXPORT_TARGETS}) install( EXPORT "${_target}" DESTINATION share/${PROJECT_NAME}/cmake NAMESPACE "${PROJECT_NAME}::" FILE "${_target}Export.cmake" ) endforeach() endif() ament_cmake-1.3.0/ament_cmake_export_targets/cmake/ament_export_targets.cmake000066400000000000000000000034101420356112300276700ustar00rootroot00000000000000# 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. # # Export targets to downstream packages. # # Each export name must have been used to install targets using # ``install(TARGETS ... EXPORT name ...)``. # The ``install(EXPORT ...)`` invocation is handled by this macros. # # :param HAS_LIBRARY_TARGET: if set, an environment variable will be defined # so that the library can be found at runtime # :type HAS_LIBRARY_TARGET: option # :param ARGN: a list of export names # :type ARGN: list of strings # # @public # macro(ament_export_targets) if(_${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_targets() must be called before ament_package()") endif() cmake_parse_arguments(_ARG "HAS_LIBRARY_TARGET" "" "" ${ARGN}) if(${ARGC} GREATER 0) _ament_cmake_export_targets_register_package_hook() foreach(_arg ${_ARG_UNPARSED_ARGUMENTS}) list(APPEND _AMENT_CMAKE_EXPORT_TARGETS "${_arg}") endforeach() # if the export name contains is a library target # make sure to register an environment hook if(${_ARG_HAS_LIBRARY_TARGET}) find_package(ament_cmake_export_libraries QUIET REQUIRED) _ament_cmake_export_libraries_register_environment_hook() endif() endif() endmacro() ament_cmake-1.3.0/ament_cmake_export_targets/package.xml000066400000000000000000000015431420356112300234720ustar00rootroot00000000000000 ament_cmake_export_targets 1.3.0 The ability to export targets to downstream packages in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_export_libraries ament_cmake ament_cmake-1.3.0/ament_cmake_gen_version_h/000077500000000000000000000000001420356112300211255ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gen_version_h/CHANGELOG.rst000066400000000000000000000035041420356112300231500ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_gen_version_h ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Add ament_generate_version_header and deprecate ament_cmake_gen_version_h (`#377 `_) * Update forthcoming version in changelog * Contributors: Audrow Nash, Shane Loretz 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Add ament_cmake_gen_version_h package (`#198 `_) * Contributors: serge-nikulin 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ ament_cmake-1.3.0/ament_cmake_gen_version_h/CMakeLists.txt000066400000000000000000000040321420356112300236640ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.5) project(ament_cmake_gen_version_h) find_package(ament_cmake_core REQUIRED) # GTest needs it, Default to C11 if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 11) endif() # GTest needs it, Default to C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() include(CTest) if(BUILD_TESTING) # Simulate pre-installed package set(ament_cmake_gen_version_h_DIR ${CMAKE_SOURCE_DIR}/cmake) include(cmake/ament_cmake_gen_version_h.cmake) include(cmake/ament_generate_version_header.cmake) find_package(ament_cmake_gtest REQUIRED) if(DEFINED CMAKE_WARN_DEPRECATED) set(old_deprecation_value ${CMAKE_WARN_DEPRECATED}) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) # Generate version headers using different scenarios ament_cmake_gen_version_h(NO_INSTALL) ament_cmake_gen_version_h(NO_INSTALL VERSION_FILE_NAME "version1.h") ament_cmake_gen_version_h(NO_INSTALL INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include VERSION_FILE_NAME "version2.h") ament_cmake_gen_version_h( NO_INSTALL TRUE INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include VERSION_FILE_NAME "version_custom.h" VERSION_MAJOR 1 VERSION_MINOR 2 VERSION_PATCH 3 ) if(old_deprecation_value) set(CMAKE_WARN_DEPRECATED ${old_deprecation_value} CACHE BOOL "" FORCE) else() unset(CMAKE_WARN_DEPRECATED CACHE) endif() ament_add_gtest(test_${PROJECT_NAME} test/test_version_custom.cpp test/test_version_h.cpp test/test_version1_h.cpp test/test_version2_h.cpp ) # Generate version headers that don't conflict with existing tests add_library(some_lib INTERFACE) ament_generate_version_header(some_lib SKIP_INSTALL HEADER_PATH "ament_generate_version_header/version.hpp") ament_add_gtest(test_ament_generate_version_header test/test_version_hpp.cpp ) target_link_libraries(test_ament_generate_version_header some_lib) endif() ament_package(CONFIG_EXTRAS "ament_cmake_gen_version_h-extras.cmake") install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_gen_version_h/ament_cmake_gen_version_h-extras.cmake000066400000000000000000000014741420356112300306120ustar00rootroot00000000000000# Copyright 2019 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. # copied from # ament_cmake_version/ament_cmake_version-extras.cmake include("${ament_cmake_gen_version_h_DIR}/ament_cmake_gen_version_h.cmake") include("${ament_cmake_gen_version_h_DIR}/ament_generate_version_header.cmake") ament_cmake-1.3.0/ament_cmake_gen_version_h/cmake/000077500000000000000000000000001420356112300222055ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gen_version_h/cmake/ament_cmake_gen_version_h.cmake000066400000000000000000000120271420356112300303620ustar00rootroot00000000000000# Copyright 2019 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. # # `ament_cmake_gen_version_h` call creates and installs a version header file. # The version is taken from `package.xml` file's `` tag # The function uses a provided "version.h.in" template file to generate # the destination version file in the provided folder. # The generated file is being (re-)created if: # - the file does not exist # - the file does exists but contains a version that differs from the # version in `package.xml` file # # :param NO_INSTALL: whether to autmatically install the generated version file # into DESTINATION include # default value NO_INSTALL: FALSE # :type NO_INSTALL: BOOL # :param INCLUDE_DIR: path to the folder where the file will be generated # ${INCLUDE_DIR} folder will be added to the include paths # the file will be placed into ${INCLUDE_DIR}/${PROJECT_NAME} folder according # to ROS2 standard # default value INCLUDE_DIR: # ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_gen_version_h/include # :type INCLUDE_DIR: string # :param VERSION_FILE_NAME: file name of the generated header file # default value VERSION_FILE_NAME: version.h # :type VERSION_FILE_NAME: string # :param VERSION_MAJOR: override VERSION_MAJOR, default value VERSION_MAJOR # from the package.xml file # :type VERSION_MAJOR: string # :param VERSION_MINOR: override VERSION_MINOR, default value VERSION_MINOR # from the package.xml file # :type VERSION_MINOR: string # :param VERSION_PATCH: override VERSION_PATCH, default value VERSION_PATCH # from the package.xml file # :type VERSION_PATCH: string # # @public # function(ament_cmake_gen_version_h) message(DEPRECATION "The ament_cmake_gen_version_h() function is deprecated. \ Please use ament_generate_version_header(...) instead.") cmake_parse_arguments( ARG "NO_INSTALL" "INCLUDE_DIR;VERSION_FILE_NAME;VERSION_MAJOR;VERSION_MINOR;VERSION_PATCH" "" ${ARGN} ) set(TEMPLATE_FILE "${ament_cmake_gen_version_h_DIR}/version.h.in") if(NOT EXISTS "${TEMPLATE_FILE}") message(FATAL_ERROR "Can't find ${TEMPLATE_FILE}. Reinstall ament_cmake_gen_version_h package.") endif() if(NOT ARG_INCLUDE_DIR) set(ARG_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_gen_version_h/include) endif() include_directories(${ARG_INCLUDE_DIR}) set(TMP_INCLUDE_DIR ${ARG_INCLUDE_DIR}/${PROJECT_NAME}) if(NOT ARG_VERSION_FILE_NAME) set(ARG_VERSION_FILE_NAME version.h) endif() set(VERSION_FILE_NAME ${TMP_INCLUDE_DIR}/${ARG_VERSION_FILE_NAME}) set(NEED_TO_CREATE_VERSION_FILE TRUE) # retrieve version information from .xml file # call ament_package_xml() if it has not been called before if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) set(VERSION_STR ${${PROJECT_NAME}_VERSION}) # parse version information from the version string string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" "" dummy ${VERSION_STR}) if(ARG_VERSION_MAJOR) set(VERSION_MAJOR ${ARG_VERSION_MAJOR}) else() set(VERSION_MAJOR ${CMAKE_MATCH_1}) endif() if(ARG_VERSION_MINOR) set(VERSION_MINOR ${ARG_VERSION_MINOR}) else() set(VERSION_MINOR ${CMAKE_MATCH_2}) endif() if(ARG_VERSION_PATCH) set(VERSION_PATCH ${ARG_VERSION_PATCH}) else() set(VERSION_PATCH ${CMAKE_MATCH_3}) endif() set(VERSION_STR ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) # Check if the version file exist if(EXISTS "${VERSION_FILE_NAME}") # The file exists # Check if it contains the same version set(LINE_PATTERN "#define[ \t]+${PROJECT_NAME_UPPER}_VERSION_STR") file(STRINGS ${VERSION_FILE_NAME} VERSION_FILE_STRINGS REGEX ${LINE_PATTERN}) set(VERSION_PATTERN "^#define[ \t]+${PROJECT_NAME_UPPER}_VERSION_STR[ \t]+\"([0-9]+\.[0-9]+\.[0-9]+)\"") string(REGEX MATCH ${VERSION_PATTERN} dummy ${VERSION_FILE_STRINGS}) if("${CMAKE_MATCH_1}" STREQUAL "${VERSION_STR}") message(STATUS "File and project versions match: \"${CMAKE_MATCH_1}\" == \"${VERSION_STR}\"") set(NEED_TO_CREATE_VERSION_FILE FALSE) endif() endif() if(${NEED_TO_CREATE_VERSION_FILE}) message(STATUS "Create new version file for version ${${PROJECT_NAME}_VERSION}") file(MAKE_DIRECTORY ${TMP_INCLUDE_DIR}) # create the version.h file configure_file(${TEMPLATE_FILE} ${VERSION_FILE_NAME}) else() message(STATUS "Skip version file creation") endif() if(NOT ARG_NO_INSTALL) install( DIRECTORY ${TMP_INCLUDE_DIR} DESTINATION include) endif() endfunction() ament_cmake-1.3.0/ament_cmake_gen_version_h/cmake/ament_generate_version_header.cmake000066400000000000000000000136711420356112300312520ustar00rootroot00000000000000# Copyright 2022 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. # This functions creates and installs a version header file. # # It uses a provided "version.h.in" template file to generate # the destination version file in the provided folder. # The version is taken from `package.xml` file's `` tag. # # The generated file is created when # - the file does not exist or # - the package.xml file changes # # Example with default arguments # # CMake: # project(my_project) # ... # add_library(my_lib ...) # ament_generate_version_header(my_lib) # # How to include the header: # #include # # The header is installed to: # ${CMAKE_INSTALL_PREFIX}/include/my_project/my_project/libversion.h # # Example with HEADER_PATH specified # # CMake: # project(my_project) # ... # add_library(my_lib ...) # ament_generate_version_header(my_lib # HEADER_PATH "foobar/version.hpp") # # How to include the header: # #include # # The header is installed to: # ${CMAKE_INSTALL_PREFIX}/include/my_project/foobar/version.hpp # # Example with INSTALL_PATH specified # # CMake: # project(my_project) # ... # add_library(my_lib ...) # ament_generate_version_header(my_lib # INSTALL_PATH "include") # # How to include the header: # #include # # The header is installed to: # ${CMAKE_INSTALL_PREFIX}/include/my_project/version.hpp # # :param target: A non-imported target to which the generated header will be # made available from. # `target_include_directories(${target} ...)` will be used such that linking # against the target will allow one to include this header. # :type target: string # :param HEADER_PATH: Path of the generated header including the file name # that describes how it should be included by downstream targets. # The default is `${PROJECT_NAME}/version.h` # :type HEADER_PATH: string # :param INSTALL_PATH: Path that the header should be installed at. # The default value is "include/${PROJECT_NAME}" to avoid include directory # search order problems when overriding packages from merged workspaces. # :type INSTALL_PATH: string # :param SKIP_INSTALL: whether to autmatically install the generated version # file. # The default value is FALSE. # :type SKIP_INSTALL: BOOL # # @public # function(ament_generate_version_header target) # Validate arguments cmake_parse_arguments( ARG "SKIP_INSTALL" "HEADER_PATH;INSTALL_PATH" "" ${ARGN} ) if(NOT ARG_HEADER_PATH) set(ARG_HEADER_PATH "${PROJECT_NAME}/version.h") endif() if(NOT ARG_INSTALL_PATH) set(ARG_INSTALL_PATH "include/${PROJECT_NAME}") endif() if(NOT TARGET ${target}) message(FATAL_ERROR "A non-imported target called '${target}' must exist") endif() # Make sure the templates to use are available set(VERSION_TEMPLATE_FILE "${ament_cmake_gen_version_h_DIR}/version.h.in") if(NOT EXISTS "${VERSION_TEMPLATE_FILE}") message(FATAL_ERROR "Can't find ${VERSION_TEMPLATE_FILE}. Reinstall ament_cmake_gen_version_h package.") endif() set(SCRIPT_TEMPLATE_FILE "${ament_cmake_gen_version_h_DIR}/generate_version_header.cmake.in") if(NOT EXISTS "${SCRIPT_TEMPLATE_FILE}") message(FATAL_ERROR "Can't find ${SCRIPT_TEMPLATE_FILE}. Reinstall ament_cmake_gen_version_h package.") endif() # retrieve version information from .xml file if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) set(VERSION_STR ${${PROJECT_NAME}_VERSION}) # parse version information from the version string if(NOT VERSION_STR MATCHES "([0-9]+)\.([0-9]+)\.([0-9]+)") message(FATAL_ERROR "Version string must be of format MAJOR.MINOR.PATCH") endif() set(VERSION_MAJOR ${CMAKE_MATCH_1}) set(VERSION_MINOR ${CMAKE_MATCH_2}) set(VERSION_PATCH ${CMAKE_MATCH_3}) set(BUILDTIME_HEADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/ament_generate_version_header/${target}") set(GENERATED_HEADER_FILE "${BUILDTIME_HEADER_DIR}/${ARG_HEADER_PATH}") # Create a CMake script that will generate the version header set(GENERATOR_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/ament_generate_version_header/${target}/generate_version_header.cmake") configure_file("${SCRIPT_TEMPLATE_FILE}" "${GENERATOR_SCRIPT}" @ONLY) # Setup a command to run the generation script when input files change add_custom_command( OUTPUT "${GENERATED_HEADER_FILE}" COMMAND ${CMAKE_COMMAND} -P "${GENERATOR_SCRIPT}" DEPENDS "${PACKAGE_XML_DIRECTORY}/package.xml" "${VERSION_TEMPLATE_FILE}" "${SCRIPT_TEMPLATE_FILE}" COMMENT "Generating ${ARG_HEADER_PATH}") add_custom_target("ament_generate_version_header__${target}" DEPENDS "${GENERATED_HEADER_FILE}") add_dependencies("${target}" "ament_generate_version_header__${target}") # Make generated header includable to this and downstream targets get_target_property(type "${target}" TYPE) if (${type} STREQUAL "INTERFACE_LIBRARY") set(keyword "INTERFACE") else() set(keyword "PUBLIC") endif() target_include_directories("${target}" "${keyword}" "$" "$") if(NOT ARG_SKIP_INSTALL) get_filename_component(HEADER_FOLDER "${ARG_HEADER_PATH}" DIRECTORY) install(FILES "${BUILDTIME_HEADER_DIR}/${ARG_HEADER_PATH}" DESTINATION "${ARG_INSTALL_PATH}/${HEADER_FOLDER}") endif() endfunction() ament_cmake-1.3.0/ament_cmake_gen_version_h/cmake/generate_version_header.cmake.in000066400000000000000000000020641420356112300304650ustar00rootroot00000000000000# Copyright 2022 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. # Generated from generate_version_header.cmake.in # This file is used by ament_generate_version_header() set(GENERATED_HEADER_FILE "@GENERATED_HEADER_FILE@") set(VERSION_TEMPLATE_FILE "@VERSION_TEMPLATE_FILE@") set(VERSION_MAJOR "@VERSION_MAJOR@") set(VERSION_MINOR "@VERSION_MINOR@") set(VERSION_PATCH "@VERSION_PATCH@") set(VERSION_STR "@VERSION_STR@") set(PROJECT_NAME_UPPER "@PROJECT_NAME_UPPER@") configure_file("${VERSION_TEMPLATE_FILE}" "${GENERATED_HEADER_FILE}") ament_cmake-1.3.0/ament_cmake_gen_version_h/cmake/version.h.in000066400000000000000000000037421420356112300244560ustar00rootroot00000000000000// Copyright 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. #ifndef ${PROJECT_NAME_UPPER}__VERSION_H_ #define ${PROJECT_NAME_UPPER}__VERSION_H_ /// \def ${PROJECT_NAME_UPPER}_VERSION_MAJOR /// Defines ${PROJECT_NAME_UPPER} major version number #define ${PROJECT_NAME_UPPER}_VERSION_MAJOR (${VERSION_MAJOR}) /// \def ${PROJECT_NAME_UPPER}_VERSION_MINOR /// Defines ${PROJECT_NAME_UPPER} minor version number #define ${PROJECT_NAME_UPPER}_VERSION_MINOR (${VERSION_MINOR}) /// \def ${PROJECT_NAME_UPPER}_VERSION_PATCH /// Defines ${PROJECT_NAME_UPPER} version patch number #define ${PROJECT_NAME_UPPER}_VERSION_PATCH (${VERSION_PATCH}) /// \def ${PROJECT_NAME_UPPER}_VERSION_STR /// Defines ${PROJECT_NAME_UPPER} version string #define ${PROJECT_NAME_UPPER}_VERSION_STR "${VERSION_STR}" /// \def ${PROJECT_NAME_UPPER}_VERSION_GTE /// Defines a macro to check whether the version of ${PROJECT_NAME_UPPER} is greater than or equal to /// the given version triple. #define ${PROJECT_NAME_UPPER}_VERSION_GTE(major, minor, patch) ( \ (major < ${PROJECT_NAME_UPPER}_VERSION_MAJOR) ? true \ : (major > ${PROJECT_NAME_UPPER}_VERSION_MAJOR) ? false \ : (minor < ${PROJECT_NAME_UPPER}_VERSION_MINOR) ? true \ : (minor > ${PROJECT_NAME_UPPER}_VERSION_MINOR) ? false \ : (patch < ${PROJECT_NAME_UPPER}_VERSION_PATCH) ? true \ : (patch > ${PROJECT_NAME_UPPER}_VERSION_PATCH) ? false \ : true) #endif // ${PROJECT_NAME_UPPER}__VERSION_H_ ament_cmake-1.3.0/ament_cmake_gen_version_h/package.xml000066400000000000000000000015371420356112300232500ustar00rootroot00000000000000 ament_cmake_gen_version_h 1.3.0 Generate a C header containing the version number of the package Michael Jeronimo Michel Hidalgo Apache License 2.0 Serge Nikulin ament_cmake_core ament_package ament_cmake_core ament_cmake_gtest ament_cmake ament_cmake-1.3.0/ament_cmake_gen_version_h/test/000077500000000000000000000000001420356112300221045ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gen_version_h/test/test_version1_h.cpp000066400000000000000000000021201420356112300257170ustar00rootroot00000000000000// Copyright 2019 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. #include #include #include TEST(test_ament_cmake_gen_version_h, version1) { EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 0, 0)); std::stringstream version; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH; EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, version.str().c_str()); } ament_cmake-1.3.0/ament_cmake_gen_version_h/test/test_version2_h.cpp000066400000000000000000000021201420356112300257200ustar00rootroot00000000000000// Copyright 2019 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. #include #include #include TEST(test_ament_cmake_gen_version_h, version2) { EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 0, 0)); std::stringstream version; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH; EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, version.str().c_str()); } ament_cmake-1.3.0/ament_cmake_gen_version_h/test/test_version_custom.cpp000066400000000000000000000032071420356112300267300ustar00rootroot00000000000000// Copyright 2019 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. #include #include #include TEST(test_ament_cmake_gen_version_h, version_custom) { EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 0, 0)); EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 1, 2)); EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(1, 2, 3)); EXPECT_FALSE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(1, 2, 4)); EXPECT_FALSE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(1, 3, 2)); EXPECT_FALSE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(2, 1, 2)); EXPECT_EQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR, 1); EXPECT_EQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR, 2); EXPECT_EQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH, 3); EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, "1.2.3"); std::stringstream version; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH; EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, version.str().c_str()); } ament_cmake-1.3.0/ament_cmake_gen_version_h/test/test_version_h.cpp000066400000000000000000000021161420356112300256430ustar00rootroot00000000000000// Copyright 2019 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. #include #include #include TEST(test_ament_cmake_gen_version_h, version) { EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 0, 0)); std::stringstream version; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH; EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, version.str().c_str()); } ament_cmake-1.3.0/ament_cmake_gen_version_h/test/test_version_hpp.cpp000066400000000000000000000021341420356112300262030ustar00rootroot00000000000000// Copyright 2022 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. #include #include #include TEST(test_ament_generate_version_header, version_hpp) { EXPECT_TRUE(AMENT_CMAKE_GEN_VERSION_H_VERSION_GTE(0, 0, 0)); std::stringstream version; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MAJOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_MINOR << "."; version << AMENT_CMAKE_GEN_VERSION_H_VERSION_PATCH; EXPECT_STREQ(AMENT_CMAKE_GEN_VERSION_H_VERSION_STR, version.str().c_str()); } ament_cmake-1.3.0/ament_cmake_gmock/000077500000000000000000000000001420356112300174005ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gmock/CHANGELOG.rst000066400000000000000000000151331420356112300214240ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_gmock ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Don't pass FALSE value to ament_add_test when SKIP_TEST is not provided (`#236 `_) * Contributors: Emerson Knapp 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * Revert "Add gtest and gmock headers as system headers: (`#175 `_)" (`#184 `_) This reverts commit e1ff1c1a0a1e08d43e939cdb943a88be601808bd. * Add gtest and gmock headers as system headers: (`#175 `_) Certain gtest and gmock header files contain constructs which generate warnings when certain compile flags are enabled. By including the header files as system headers, the compiler knows that it doesn't need to generate these warnings since they are coming from (third-party) system headers * Add 'runner' option to ament_add_gmock / nose (`#177 `_) * Add 'runner' option to ament_add_gmock * Give ament_add_nose ability to specify a different runner, too * Contributors: Peter Baughman, Shane Loretz, jpsamper2009 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ * Fix unused-arg check in ament_cmake packages: (`#167 `_) Arguments to a macro are not variables, so it's not possible to do 'if(ARGN)' to check for arguments; however, copying ARGN to a variable works. * Contributors: jpsamper2009 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ * Add SKIP_TEST flag to ament_add_gmock() (`#143 `_) * Contributors: Andreas Greimel 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * Merge pull request `#104 `_ from ament/googletest update to googletest 1.8 * update to googletest 1.8 * 0.0.2 * Merge pull request `#94 `_ from ament/logging suppress compiler warnings within gmock/gtest * suppress missing-field-initializers warnings * prevent adding the gmock subdirectory twice (`#91 `_) * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * remove obsolete policies * require CMake 3.5 * Merge pull request `#54 `_ from ament/test_working_dir support WORKING_DIRECTORY in ament_add_nose_test * fix WORKING_DIRECTORY for ament_add_gtest/gmock * follow fixes from `#52 `_ * Merge pull request `#52 `_ from ament/add_test_append_env_option add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * Merge pull request `#50 `_ from ament/pass_extra_env_to_tests add option to pass extra env to ament_add\_*test * addressing comments * Merge pull request `#37 `_ from ament/test_labels add labels to tests * add labels to tests * Merge pull request `#34 `_ from ament/prevent_gtest_in_cache refactor finding GTest / GMock * refactor finding GTest / GMock * Merge pull request `#29 `_ from ament/suppress_cmp0026 set cmp0026 to OLD until we can migrate to use $ * update comment and set the policy in two other places * Merge pull request `#28 `_ from ament/gtest_location fix location of gtest / gmock executables on Windows * add type as extension to test result files * fix location of gtest executable on Windows * Merge pull request `#25 `_ from ament/use_gmock_vendor optionally use gmock_vendor * optionally use gtest/gmock_vendor * update ament_add_gmock to support SKIP_LINKING_MAIN_LIBRARIES * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * update quoting of additional ament_add_test() arguments * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * add ament_cmake_gmock * Contributors: Dirk Thomas, William Woodall ament_cmake-1.3.0/ament_cmake_gmock/CMakeLists.txt000066400000000000000000000003641420356112300221430ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_gmock NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_gmock-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_gmock/ament_cmake_gmock-extras.cmake000066400000000000000000000124111420356112300253310ustar00rootroot00000000000000# 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. # copied from ament_cmake_gmock/ament_cmake_gmock-extras.cmake # find gmock and create library targets once macro(_ament_cmake_gmock_find_gmock) if(NOT DEFINED _AMENT_CMAKE_GMOCK_FIND_GMOCK) set(_AMENT_CMAKE_GMOCK_FIND_GMOCK TRUE) find_package(ament_cmake_test QUIET REQUIRED) find_package(gmock_vendor QUIET) # if gmock sources were not found in a previous run if(NOT GMOCK_FROM_SOURCE_FOUND) # search path for gmock includes and sources set(_search_path_include "") set(_search_path_src "") # option() consider environment variable to find gmock if(NOT $ENV{GMOCK_DIR} STREQUAL "") list(APPEND _search_path_include "$ENV{GMOCK_DIR}/include/gmock") list(APPEND _search_path_src "$ENV{GMOCK_DIR}/src") endif() # check to system installed path (i.e. on Ubuntu) set(_search_path_include "/usr/include/gmock") set(_search_path_src "/usr/src/gmock/src") # check gmock_vendor path, prefer this version over a system installed if(gmock_vendor_FOUND AND gmock_vendor_BASE_DIR) list(INSERT _search_path_include 0 "${gmock_vendor_BASE_DIR}/include/gmock") list(INSERT _search_path_src 0 "${gmock_vendor_BASE_DIR}/src") endif() find_file(_gmock_header_file "gmock.h" PATHS ${_search_path_include} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) find_file(_gmock_src_file "gmock.cc" "gmock-all.cc" PATHS ${_search_path_src} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) if(_gmock_header_file AND _gmock_src_file) # set from-source variables set(GMOCK_FROM_SOURCE_FOUND TRUE CACHE INTERNAL "") get_filename_component(_gmock_base_dir "${_gmock_src_file}" PATH) get_filename_component(_gmock_base_dir "${_gmock_base_dir}" PATH) set(GMOCK_FROM_SOURCE_BASE_DIR "${_gmock_base_dir}" CACHE INTERNAL "") get_filename_component(_gmock_include_dir "${_gmock_header_file}" PATH) get_filename_component(_gmock_include_dir ${_gmock_include_dir} PATH) set(GMOCK_FROM_SOURCE_INCLUDE_DIRS "${_gmock_include_dir}" CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/gmock" CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_LIBRARIES "gmock" CACHE INTERNAL "") set(GMOCK_FROM_SOURCE_MAIN_LIBRARIES "gmock_main" CACHE INTERNAL "") endif() endif() if(GMOCK_FROM_SOURCE_FOUND) message(STATUS "Found gmock sources under '${GMOCK_FROM_SOURCE_BASE_DIR}': " "C++ tests using 'Google Mock' will be built") # if gmock is already a target, do not add again # this can happen when ament_add_gmock() is called from a subdirectory if(NOT TARGET gmock) # add CMakeLists.txt from gmock dir add_subdirectory("${GMOCK_FROM_SOURCE_BASE_DIR}" "${CMAKE_BINARY_DIR}/gmock") if(NOT WIN32) set(_gmock_compile_flags "-Wno-missing-field-initializers") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(_gmock_compile_flags "${_gmock_compile_flags} -Wno-unused-const-variable") endif() set_target_properties(gmock gmock_main PROPERTIES COMPILE_FLAGS "${_gmock_compile_flags}") endif() # mark gmock targets with EXCLUDE_FROM_ALL to only build # when tests are built which depend on them set_target_properties(gmock gmock_main PROPERTIES EXCLUDE_FROM_ALL 1) endif() # set the same variables as find_package() would set # but do NOT set GMOCK_FOUND in the cache when using gmock from source # since the subdirectory must always be added to add the gmock targets 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}) if(GMOCK_FROM_SOURCE_BASE_DIR STREQUAL gmock_vendor_BASE_DIR) # the GMock headers require the GTest headers find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() list(APPEND GMOCK_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}) endif() endif() if(NOT GMOCK_FOUND) message(WARNING "'gmock' not found, C++ tests using 'Google Mock' can not be built. " "Please install the 'Google Mock' headers globally in your system to " "enable these tests (e.g. on Ubuntu/Debian install the package " "'google-mock') or get the ament package 'gmock_vendor'") endif() endif() endmacro() include("${ament_cmake_gmock_DIR}/ament_add_gmock.cmake") include("${ament_cmake_gmock_DIR}/ament_find_gmock.cmake") ament_cmake-1.3.0/ament_cmake_gmock/cmake/000077500000000000000000000000001420356112300204605ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gmock/cmake/ament_add_gmock.cmake000066400000000000000000000101201420356112300245500ustar00rootroot00000000000000# 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. # # Add a gmock. # # Call add_executable(target ARGN), link it against the gmock library # and register the executable as a test. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param RUNNER: the path to the test runner script (default: see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the gmock # main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # macro(ament_add_gmock target) _ament_cmake_gmock_find_gmock() if(GMOCK_FOUND) _ament_add_gmock("${target}" ${ARGN}) endif() endmacro() function(_ament_add_gmock target) cmake_parse_arguments(ARG "SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(NOT ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_gmock() must be invoked with at least one source file") endif() # should be EXCLUDE_FROM_ALL if it would be possible # to add this target as a dependency to the "test" target add_executable("${target}" ${ARG_UNPARSED_ARGUMENTS}) target_include_directories("${target}" PUBLIC "${GMOCK_INCLUDE_DIRS}") if(NOT ARG_SKIP_LINKING_MAIN_LIBRARIES) target_link_libraries("${target}" ${GMOCK_MAIN_LIBRARIES}) endif() target_link_libraries("${target}" ${GMOCK_LIBRARIES}) set(executable "$") set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${target}.gtest.xml") set(cmd "${executable}" "--gtest_output=xml:${result_file}") if(ARG_ENV) set(ARG_ENV "ENV" ${ARG_ENV}) endif() if(ARG_APPEND_ENV) set(ARG_APPEND_ENV "APPEND_ENV" ${ARG_APPEND_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS}) endif() # Options come out TRUE or FALSE but need to be passed as value or empty if(ARG_SKIP_TEST) set(ARG_SKIP_TEST "SKIP_TEST") else() set(ARG_SKIP_TEST "") endif() if(ARG_RUNNER) set(ARG_RUNNER "RUNNER" ${ARG_RUNNER}) endif() if(ARG_TIMEOUT) set(ARG_TIMEOUT "TIMEOUT" ${ARG_TIMEOUT}) endif() if(ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "WORKING_DIRECTORY" "${ARG_WORKING_DIRECTORY}") endif() ament_add_test( "${target}" COMMAND ${cmd} OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_gmock/${target}.txt" RESULT_FILE "${result_file}" ${ARG_RUNNER} ${ARG_ENV} ${ARG_APPEND_ENV} ${ARG_APPEND_LIBRARY_DIRS} ${ARG_SKIP_TEST} ${ARG_TIMEOUT} ${ARG_WORKING_DIRECTORY} ) set_tests_properties( "${target}" PROPERTIES REQUIRED_FILES "${executable}" LABELS "gmock" ) endfunction() ament_cmake-1.3.0/ament_cmake_gmock/cmake/ament_find_gmock.cmake000066400000000000000000000020561420356112300247510ustar00rootroot00000000000000# 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. # # Find gmock. # # Set the variables ``GMOCK_FOUND``, ``GMOCK_INCLUDE_DIRS``, # ``GMOCK_LIBRARIES`` and ``GMOCK_MAIN_LIBRARIES``. # # Note: you should only link against one of the variables, either # ``GMOCK_LIBRARIES`` or ``GMOCK_MAIN_LIBRARIES`` # # @public # macro(ament_find_gmock) set(_ARGN "${ARGN}") if(_ARGN) message(FATAL_ERROR "ament_find_gmock() called with unused arguments: ${_ARGN}") endif() _ament_cmake_gmock_find_gmock() endmacro() ament_cmake-1.3.0/ament_cmake_gmock/package.xml000066400000000000000000000017101420356112300215140ustar00rootroot00000000000000 ament_cmake_gmock 1.3.0 The ability to add Google mock-based tests in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_gtest ament_cmake_test gmock_vendor google-mock ament_cmake ament_cmake-1.3.0/ament_cmake_google_benchmark/000077500000000000000000000000001420356112300215665ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_google_benchmark/CHANGELOG.rst000066400000000000000000000113121420356112300236050ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_google_benchmark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ * Serialize benchmarks within CTest by default (`#308 `_) * Contributors: Scott K Logan 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Handle runtime failures in Google Benchmark (`#294 `_) This change will handle runtime failures in Google Benchmark by propagating error information from Google Benchmark to both CTest and the Jenkins benchmark plugin. * Use consistent string format and resolve flake8 (`#295 `_) Follow-up to a5fb3112b5c46c42b1824c96af4171d469eb13bf * Make ament_cmake_test a dep of ament_cmake_google_benchmark (`#293 `_) * Catch JSONDecodeError and printout some debug info (`#291 `_) * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo, Scott K Logan, brawner 1.0.1 (2020-09-10) ------------------ * Make AMENT_RUN_PERFORMANCE_TESTS a CMake option (`#280 `_) * Skip performance tests using a CMake variable (`#278 `_) These tests can be fairly heavy, so we don't want to run them by default. It would be better if there was a way to skip the tests by default in such a way that they could be specifically un-skipped at runtime, but I can't find a mechanism in CMake or CTest that would allow us to achieve that behavior without leveraging environment variables. * Handle Google Benchmark 'aggregate' results (`#276 `_) Previously, I assumed all results generated by Google Benchmark were of 'iteration' type. Now that I have more experience with Google Benchmark, I've started generating aggregate results, which contain some different properties. This change adds support for aggregate results and should make it easy to add any other result schemas we encounter in the future. For forward-compatibility, unsupported types will generate a warning message but will not fail the test. This makes the conversion tolerant to Google Benchmark adding new measures for existing mechanisms. * Initial Google Benchmark results conversion (`#275 `_) * Contributors: Scott K Logan 1.0.0 (2020-07-22) ------------------ * Handle missing results file for Google Benchmark (`#265 `_) * Initial ament_cmake_google_benchmark package (`#261 `_) * Contributors: Scott K Logan 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ ament_cmake-1.3.0/ament_cmake_google_benchmark/CMakeLists.txt000066400000000000000000000007151420356112300243310ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_google_benchmark NONE) # find dependencies find_package(ament_cmake_core REQUIRED) find_package(ament_cmake_export_dependencies REQUIRED) find_package(ament_cmake_python REQUIRED) ament_python_install_package(${PROJECT_NAME}) ament_export_dependencies(ament_cmake_test) ament_package( CONFIG_EXTRAS "${PROJECT_NAME}-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_google_benchmark/README.md000066400000000000000000000046231420356112300230520ustar00rootroot00000000000000# ament\_cmake\_google\_benchmark This package contains logic for invoking [Google Benchmark](https://github.com/google/benchmark#readme) tests and is comprised of three main parts: 1. The `ament_add_google_benchmark*` CMake macros.\ These macros are used in ament packages to compile Google Benchmark executables, run Google Benchmark tests with CTest, or both. 2. The `run_and_convert.py` test wrapper.\ This script is used to convert the Google Benchmark JSON results to a custom format which can be consumed by the [Jenkins Benchmark plugin](https://plugins.jenkins.io/benchmark/). The script also combines the generated results with elements from an overlay file, which may contain additional context for the benchmarks, such as descriptions or value thresholds. 3. The `benchmark_schema.json` output schema.\ This schema describes the output format for the `run_and_convert.py` test wrapper, and should be used by Jenkins in parsing the results for aggregation and threshold checks. It is also the schema used by the overlay file. ### Examples The source file format is well-described in the Google Benchmark README. Here is a simple example: ```c++ #include static void increment_perf(benchmark::State & state) { size_t i = 0; for (auto _ : state) { i++; } } BENCHMARK(increment_perf); ``` To compile and run this benchmark, the following is added to the `CMakeLists.txt`: ```cmake if(BUILD_TESTING) find_package(ament_cmake_google_benchmark REQUIRED) ament_add_google_benchmark(simple_benchmark test/simple_benchmark.cpp) endif() ``` Jenkins can also trigger a build warning when the metrics exceed predefined thresholds. Here is an example overlay file to sets a threshold of 0.6% deviation above or below the average metric from all previous Jenkins job builds which include that metric: ```json { "package_name.simple_benchmark": { "increment_perf": { "real_time": { "thresholds": [ { "method": "percentageaverage", "percentage": 0.6 } ] } } } } ``` This overlay file can be generated at build time or checked in as a static file. The location of the file is communicated to this package using the `AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY` CMake variable. For example: ```cmake if(BUILD_TESTING) set(AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY test/benchmark_thresholds.json) ... endif() ``` ament_cmake-1.3.0/ament_cmake_google_benchmark/ament_cmake_google_benchmark-extras.cmake000066400000000000000000000035151420356112300317120ustar00rootroot00000000000000# Copyright 2020 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. macro(_ament_cmake_google_benchmark_find_benchmark) if(NOT DEFINED _AMENT_CMAKE_GOOGLE_BENCHMARK_FIND_BENCHMARK) set(_AMENT_CMAKE_GOOGLE_BENCHMARK_FIND_BENCHMARK TRUE) option(AMENT_RUN_PERFORMANCE_TESTS "Enable performance tests instead of unconditionally skipping them" OFF) find_package(benchmark QUIET) if(NOT benchmark_FOUND) message(WARNING "'benchmark' not found, C++ tests using 'Google Benchmark' can not be " "built. Please install the 'Google Benchmark' headers globally in " "your system to enable these tests (e.g. on Ubuntu/Debian install the " "package 'libbenchmark-dev') or get the ament package " "'google_benchmark_vendor'") elseif(NOT AMENT_RUN_PERFORMANCE_TESTS) message(STATUS "Performance tests are disabled by default, so Google Benchmark tests " "will be skipped. To enable these tests, set the CMake variable " "'AMENT_RUN_PERFORMANCE_TESTS'.") endif() endif() endmacro() include("${ament_cmake_google_benchmark_DIR}/ament_add_google_benchmark.cmake") include("${ament_cmake_google_benchmark_DIR}/ament_add_google_benchmark_executable.cmake") include("${ament_cmake_google_benchmark_DIR}/ament_add_google_benchmark_test.cmake") ament_cmake-1.3.0/ament_cmake_google_benchmark/ament_cmake_google_benchmark/000077500000000000000000000000001420356112300274005ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_google_benchmark/ament_cmake_google_benchmark/__init__.py000066400000000000000000000161631420356112300315200ustar00rootroot00000000000000# Copyright 2020 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. import argparse import json import os import subprocess import sys common_test_properties = { 'name', 'run_name', 'run_type', 'repetitions', 'repetition_index', 'threads', 'time_unit', } common_aggregate_test_properties = common_test_properties | { 'aggregate_name', } common_iteration_test_properties = common_test_properties | { 'iterations', 'real_time', 'cpu_time', } def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser( description='Run a Google Benchmark test and convert the results to ' 'a common format.') parser.add_argument( 'result_file_in', help='The path to the Google Benchmark result file') parser.add_argument( 'result_file_out', help='The path to where the common result file should be written') parser.add_argument( '--package-name', default=None, help="The package name to be used as a prefix for the 'group' " 'value in benchmark result files') parser.add_argument( '--command', nargs='+', help='The test command to execute. ' 'It must be passed after other arguments since it collects all ' 'following options.') parser.add_argument( '--result-file-overlay', default=None, help='If specified, this json file will be overlaid on top of the ' 'generated results. This is primarily useful for specifying ' 'descriptions and/or thresholds.') if '--command' in argv: index = argv.index('--command') argv, command = argv[0:index + 1] + ['dummy'], argv[index + 1:] args = parser.parse_args(argv) args.command = command print('Executing benchmark test command: %s\n\n' % ' '.join(args.command)) res = subprocess.run(args.command) print('\n\nTest command returned result status %d' % res.returncode) try: with open(args.result_file_in, 'r') as in_file: in_text = in_file.read() except FileNotFoundError: if res.returncode == 0: print( 'ERROR: No performance test results were found at: %s' % args.result_file_in, file=sys.stderr) res.returncode = 1 return res.returncode if not in_text and res.returncode == 0: print( 'NOTE: Performance test results file was empty at: %s' % args.result_file_in, file=sys.stderr) open(args.result_file_out, 'w').close() return res.returncode try: in_data = json.loads(in_text) except json.decoder.JSONDecodeError as e: print( 'Failure parsing performance results file at: %s' % args.result_file_in, file=sys.stderr) print(e) if res.returncode == 0: res.returncode = 1 return res.returncode overlay_data = None if args.result_file_overlay: with open(args.result_file_overlay, 'r') as overlay_file: overlay_data = json.load(overlay_file) out_data = convert_google_benchark_to_jenkins_benchmark( in_data, overlay_data, args.package_name) with open(args.result_file_out, 'w') as out_file: json.dump(out_data, out_file) if res.returncode == 0 and any( b.get('error_occurred') for b in in_data.get('benchmarks', [])): res.returncode = 1 return res.returncode def convert_google_benchark_to_jenkins_benchmark( in_data, overlay_data=None, package_name=None, ): group_name = os.path.basename(in_data['context']['executable']) if package_name: group_name = '%s.%s' % (package_name, group_name) out_data = { group_name: {}, } for benchmark in in_data.get('benchmarks', []): benchmark_type = benchmark['run_type'] if benchmark_type == 'aggregate': out_data[group_name][benchmark['name']] = convert_aggregate_benchmark(benchmark) elif benchmark_type == 'iteration': out_data[group_name][benchmark['name']] = convert_iteration_benchmark(benchmark) else: print("WARNING: Unsupported benchmark type '%s'" % benchmark_type, file=sys.stderr) if not out_data[group_name]: print( 'WARNING: The performance test results file contained no results', file=sys.stderr) if overlay_data: _merge_results(out_data[group_name], overlay_data.get(group_name, {})) return out_data def convert_aggregate_benchmark(in_data): out_data = { 'parameters': { 'repetitions': { 'value': in_data['repetitions'], }, }, } value_override = None if in_data.get('error_occurred', False): value_override = 'failure' out_data.update(convert_extra_metrics( in_data, common_aggregate_test_properties, value_override)) return out_data def convert_iteration_benchmark(in_data): out_data = { 'parameters': { 'iterations': { 'value': in_data['iterations'], }, 'repetitions': { 'value': in_data['repetitions'], }, }, 'cpu_time': { 'unit': in_data['time_unit'], }, 'real_time': { 'unit': in_data['time_unit'], }, } value_override = None if in_data.get('error_occurred', False): value_override = 'failure' out_data['cpu_time']['value'] = value_override out_data['real_time']['value'] = value_override else: out_data['cpu_time']['dblValue'] = in_data['cpu_time'] out_data['real_time']['dblValue'] = in_data['real_time'] out_data.update(convert_extra_metrics( in_data, common_iteration_test_properties, value_override)) return out_data def convert_extra_metrics(in_data, properties_to_ignore, value_override=None): for k, v in in_data.items(): if k in properties_to_ignore: continue if value_override: yield k, { 'value': value_override, } elif isinstance(v, bool): yield k, { 'boolValue': 'true' if v else 'false', } elif isinstance(v, (int, float)): yield k, { 'dblValue': v, } else: yield k, { 'value': v, } def _merge_results(target, overlay): for k, v in overlay.items(): if isinstance(v, dict) and isinstance(target.get(k), dict): _merge_results(target[k], v) else: target[k] = v ament_cmake-1.3.0/ament_cmake_google_benchmark/cmake/000077500000000000000000000000001420356112300226465ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_google_benchmark/cmake/ament_add_google_benchmark.cmake000066400000000000000000000071651420356112300311430ustar00rootroot00000000000000# Copyright 2020 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. # # Add a google benchmark test. # # Call add_executable(target ARGN), link it against the google benchmark # libraries and register the executable as a test. # # If google benchmark is not available the specified target is not being created # and therefore the target existence should be checked before being used. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param RUNNER: the path to the test runner script (default: see # ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param RUN_PARALLEL: if set allow the test to be run in parallel # with other tests # :type RUN_PARALLEL: option # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the google # benchmark main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # macro(ament_add_google_benchmark target) cmake_parse_arguments(_ARG "RUN_PARALLEL;SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(NOT _ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_google_benchmark() must be invoked with at least one " "source file") endif() # add executable set(_argn_executable ${_ARG_UNPARSED_ARGUMENTS}) if(_ARG_SKIP_LINKING_MAIN_LIBRARIES) list(APPEND _argn_executable "SKIP_LINKING_MAIN_LIBRARIES") endif() ament_add_google_benchmark_executable("${target}" ${_argn_executable}) # add test set(_argn_test "") if(_ARG_RUNNER) list(APPEND _argn_test "RUNNER" "${_ARG_RUNNER}") endif() if(_ARG_TIMEOUT) list(APPEND _argn_test "TIMEOUT" "${_ARG_TIMEOUT}") endif() if(_ARG_WORKING_DIRECTORY) list(APPEND _argn_test "WORKING_DIRECTORY" "${_ARG_WORKING_DIRECTORY}") endif() if(_ARG_RUN_PARALLEL) list(APPEND _argn_test "RUN_PARALLEL") endif() if(_ARG_SKIP_TEST) list(APPEND _argn_test "SKIP_TEST") endif() if(_ARG_ENV) list(APPEND _argn_test "ENV" ${_ARG_ENV}) endif() if(_ARG_APPEND_ENV) list(APPEND _argn_test "APPEND_ENV" ${_ARG_APPEND_ENV}) endif() if(_ARG_APPEND_LIBRARY_DIRS) list(APPEND _argn_test "APPEND_LIBRARY_DIRS" ${_ARG_APPEND_LIBRARY_DIRS}) endif() ament_add_google_benchmark_test("${target}" ${_argn_test}) endmacro() ament_cmake-1.3.0/ament_cmake_google_benchmark/cmake/ament_add_google_benchmark_executable.cmake000066400000000000000000000041441420356112300333360ustar00rootroot00000000000000# Copyright 2020 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. # # Add an executable using google benchmark. # # Call add_executable(target ARGN) and link it against the google benchmark # libraries. # It does not register the executable as a test. # # If google benchmark is not available the specified target is not being created # and therefore the target existence should be checked before being used. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the google # benchmark main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # # @public # macro(ament_add_google_benchmark_executable target) _ament_cmake_google_benchmark_find_benchmark() if(benchmark_FOUND) _ament_add_google_benchmark_executable("${target}" ${ARGN}) endif() endmacro() function(_ament_add_google_benchmark_executable target) cmake_parse_arguments(ARG "SKIP_LINKING_MAIN_LIBRARIES" "" "" ${ARGN}) if(NOT ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_google_benchmark_executable() must be invoked with at least " "one source file") endif() # should be EXCLUDE_FROM_ALL if it would be possible # to add this target as a dependency to the "test" target add_executable("${target}" ${ARG_UNPARSED_ARGUMENTS}) if(NOT ARG_SKIP_LINKING_MAIN_LIBRARIES) target_link_libraries("${target}" benchmark::benchmark_main) endif() target_link_libraries("${target}" benchmark::benchmark) endfunction() ament_cmake-1.3.0/ament_cmake_google_benchmark/cmake/ament_add_google_benchmark_test.cmake000066400000000000000000000105701420356112300321740ustar00rootroot00000000000000# Copyright 2020 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. # # Add an existing executable using google benchmark as a test. # # Register an executable created with ament_add_google_benchmark_executable() as # a test. # If the specified target does not exist the registration is skipped. # # :param target: the target name which will also be used as the test name # :type target: string # :param RUNNER: the path to the test runner script (default: see # ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param RUN_PARALLEL: if set allow the test to be run in parallel # with other tests # :type RUN_PARALLEL: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # function(ament_add_google_benchmark_test target) if(NOT TARGET ${target}) return() endif() cmake_parse_arguments(ARG "RUN_PARALLEL;SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_google_benchmark_test() called with unused arguments: ${ARGN}") endif() if(AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY AND NOT IS_ABSOLUTE ${AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY}) get_filename_component(AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY ${CMAKE_CURRENT_SOURCE_DIR}/${AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY} ABSOLUTE) set(OVERLAY_ARG "--result-file-overlay" "${AMENT_CMAKE_GOOGLE_BENCHMARK_OVERLAY}") endif() get_executable_path(python_interpreter Python3::Interpreter BUILD) set(executable "$") set(benchmark_out "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${target}.google_benchmark.json") set(common_out "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${target}.benchmark.json") set(cmd "${python_interpreter}" "-u" "${ament_cmake_google_benchmark_DIR}/run_and_convert.py" "${benchmark_out}" "${common_out}" "--package-name" "${PROJECT_NAME}" ${OVERLAY_ARG} "--command" "${executable}" "--benchmark_out_format=json" "--benchmark_out=${benchmark_out}") if(ARG_ENV) set(ARG_ENV "ENV" ${ARG_ENV}) endif() if(ARG_APPEND_ENV) set(ARG_APPEND_ENV "APPEND_ENV" ${ARG_APPEND_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS}) endif() if(ARG_RUNNER) set(ARG_RUNNER "RUNNER" ${ARG_RUNNER}) endif() if(ARG_TIMEOUT) set(ARG_TIMEOUT "TIMEOUT" ${ARG_TIMEOUT}) endif() if(ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "WORKING_DIRECTORY" "${ARG_WORKING_DIRECTORY}") endif() if(NOT ARG_RUN_PARALLEL) set(PROP_RUN_SERIAL "RUN_SERIAL" "TRUE") endif() if(ARG_SKIP_TEST OR NOT AMENT_RUN_PERFORMANCE_TESTS) set(ARG_SKIP_TEST "SKIP_TEST") endif() ament_add_test( "${target}" COMMAND ${cmd} OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_google_benchmark/${target}.txt" GENERATE_RESULT_FOR_RETURN_CODE_ZERO ${ARG_SKIP_TEST} ${ARG_ENV} ${ARG_APPEND_ENV} ${ARG_APPEND_LIBRARY_DIRS} ${ARG_TIMEOUT} ${ARG_WORKING_DIRECTORY} ) set_tests_properties( "${target}" PROPERTIES REQUIRED_FILES "${executable}" LABELS "google_benchmark;performance" ${PROP_RUN_SERIAL} ) endfunction() ament_cmake-1.3.0/ament_cmake_google_benchmark/cmake/run_and_convert.py000066400000000000000000000013611420356112300264070ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright 2020 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. import sys import ament_cmake_google_benchmark if __name__ == '__main__': sys.exit(ament_cmake_google_benchmark.main()) ament_cmake-1.3.0/ament_cmake_google_benchmark/doc/000077500000000000000000000000001420356112300223335ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_google_benchmark/doc/benchmark_schema.json000066400000000000000000000063071420356112300265060ustar00rootroot00000000000000{ "description": "Jenkins Benchmark schema for ROS performance test results", "failure": { "value": "failure" }, "type": "object", "additionalProperties": { "type": "object", "properties": { "description": { "type": "description" }, "parameters": { "type": "object", "additionalProperties": { "type": "parameter", "properties": { "description": { "type": "description" }, "unit": { "type": "unit" }, "value": { "type": "value" } }, "required": [ "value" ], "additionalProperties": false } } }, "additionalProperties": { "type": "object", "properties": { "description": { "type": "description" }, "parameters": { "type": "object", "additionalProperties": { "type": "parameter", "properties": { "description": { "type": "description" }, "unit": { "type": "unit" }, "value": { "type": "value" } }, "required": [ "value" ], "additionalProperties": false } } }, "additionalProperties": { "type": "result", "properties": { "description": { "type": "description" }, "parameters": { "type": "object", "additionalProperties": { "type": "parameter", "properties": { "description": { "type": "description" }, "unit": { "type": "unit" }, "value": { "type": "value" } }, "required": [ "value" ], "additionalProperties": false } }, "boolValue": { "type": "boolean" }, "dblValue": { "type": "double" }, "intValue": { "type": "integer" }, "unit": { "type": "unit" }, "value": { "type": "value" }, "thresholds": { "type": "array", "items": { "type": "threshold", "properties": { "delta": { "type": "delta" }, "method": { "type": "method" }, "maximum": { "type": "maximum" }, "minimum": { "type": "minimum" }, "percentage": { "type": "percentage" } }, "required": [ "method" ], "additionalProperties": false } }, "additionalProperties": false } } } } } ament_cmake-1.3.0/ament_cmake_google_benchmark/package.xml000066400000000000000000000017071420356112300237100ustar00rootroot00000000000000 ament_cmake_google_benchmark 1.3.0 The ability to add Google Benchmark tests in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas Scott K Logan ament_cmake_core ament_cmake_export_dependencies ament_cmake_python ament_cmake_test google_benchmark_vendor ament_cmake ament_cmake-1.3.0/ament_cmake_gtest/000077500000000000000000000000001420356112300174265ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gtest/CHANGELOG.rst000066400000000000000000000206641420356112300214570ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_gtest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ * Disable gtest warning when building in Release (`#298 `_) https://github.com/google/googletest/issues/1303 * Contributors: Victor Lopez 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ * [ament_cmake_gtest] ensure gtest to consume the correct headers. (`#267 `_) * ensure gtest to consume the correct headers. * add another patch. * Contributors: Sean Yen 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * Revert "Add gtest and gmock headers as system headers: (`#175 `_)" (`#184 `_) This reverts commit e1ff1c1a0a1e08d43e939cdb943a88be601808bd. * Add gtest and gmock headers as system headers: (`#175 `_) Certain gtest and gmock header files contain constructs which generate warnings when certain compile flags are enabled. By including the header files as system headers, the compiler knows that it doesn't need to generate these warnings since they are coming from (third-party) system headers * Add runner option to ament_add_test (`#174 `_) * ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID * ament_cmake move run_test.py to a python module - This should let us see the history * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package * Contributors: Peter Baughman, Shane Loretz, jpsamper2009 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ * Fix unused-arg check in ament_cmake packages: (`#167 `_) Arguments to a macro are not variables, so it's not possible to do 'if(ARGN)' to check for arguments; however, copying ARGN to a variable works. * Contributors: jpsamper2009 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * Merge pull request `#104 `_ from ament/googletest update to googletest 1.8 * update to googletest 1.8 * 0.0.2 * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * Merge pull request `#85 `_ from ament/split_gtest_function Split ament_add_gtest function * refactor ament_add_gtest to be composed out of two separate functions to create the executable and register it as a test * duplicate ament_add_gtest.cmake before refactoring it * add missing doc for SKIP_TEST * Merge pull request `#82 `_ from firesurfer/master Fixed rebasing error, fixed indentation, looking for pthread on non w… * removed GTEST argument form target_link_libraries * Fixed rebasing error, fixed indentation, looking for pthread on non windows systems * Skipped tests (`#80 `_) * support skipping tests * add SKIP_TEST to ament_add_nose_test * use keyword args not positional * discard positional args after first * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * remove obsolete policies * require CMake 3.5 * Merge pull request `#54 `_ from ament/test_working_dir support WORKING_DIRECTORY in ament_add_nose_test * fix WORKING_DIRECTORY for ament_add_gtest/gmock * follow fixes from `#52 `_ * Merge pull request `#52 `_ from ament/add_test_append_env_option add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * Merge pull request `#50 `_ from ament/pass_extra_env_to_tests add option to pass extra env to ament_add\_*test * addressing comments * add option to pass extra env to ament_add\_*test * Merge pull request `#37 `_ from ament/test_labels add labels to tests * add labels to tests * Merge pull request `#34 `_ from ament/prevent_gtest_in_cache refactor finding GTest / GMock * refactor finding GTest / GMock * Merge pull request `#29 `_ from ament/suppress_cmp0026 set cmp0026 to OLD until we can migrate to use $ * update comment and set the policy in two other places * Merge pull request `#28 `_ from ament/gtest_location fix location of gtest / gmock executables on Windows * add type as extension to test result files * fix location of gtest executable on Windows * Merge pull request `#25 `_ from ament/use_gmock_vendor optionally use gmock_vendor * optionally use gtest/gmock_vendor * Merge pull request `#18 `_ from ament/gtest_docs adding basic usage to description * adding basic usage documentation * Merge pull request `#19 `_ from ament/improve_test_runner improve test runner * improve test runner * add note that gtest target might not be created * fix linking of gtest libraries (regression of `#16 `_) * Merge pull request `#16 `_ from ament/gtest_main_libraries automatically link gtest main libraries and add an option to skip it * automatically link gtest main libraries and add an option to skip it * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * update quoting of additional ament_add_test() arguments * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * add ament_cmake_gmock * add ament_cmake_environment_hooks * tests are always built when being enabled * add ament_cmake_test, ament_cmake_gtest, ament_cmake_nose * Contributors: Dirk Thomas, Lennart Nachtigall, Mikael Arguedas, Tully Foote, William Woodall ament_cmake-1.3.0/ament_cmake_gtest/CMakeLists.txt000066400000000000000000000003641420356112300221710ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_gtest NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_gtest-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_gtest/ament_cmake_gtest-extras.cmake000066400000000000000000000121751420356112300254140ustar00rootroot00000000000000# 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. # copied from ament_cmake_gtest/ament_cmake_gtest-extras.cmake # find gtest and create library targets once macro(_ament_cmake_gtest_find_gtest) if(NOT DEFINED _AMENT_CMAKE_GTEST_FIND_GTEST) set(_AMENT_CMAKE_GTEST_FIND_GTEST TRUE) find_package(ament_cmake_test QUIET REQUIRED) # if gtest sources were not found in a previous run if(NOT GTEST_FROM_SOURCE_FOUND) # search path for gtest includes and sources set(_search_path_include "") set(_search_path_src "") # option() consider environment variable to find gtest if(NOT $ENV{GTEST_DIR} STREQUAL "") list(APPEND _search_path_include "$ENV{GTEST_DIR}/include/gtest") list(APPEND _search_path_src "$ENV{GTEST_DIR}/src") endif() # check to system installed path (i.e. on Ubuntu) set(_search_path_include "/usr/include/gtest") set(_search_path_src "/usr/src/gtest/src") # check gtest_vendor path, prefer this version over a system installed find_package(gtest_vendor QUIET) if(gtest_vendor_FOUND AND gtest_vendor_BASE_DIR) list(INSERT _search_path_include 0 "${gtest_vendor_BASE_DIR}/include/gtest") list(INSERT _search_path_src 0 "${gtest_vendor_BASE_DIR}/src") endif() find_file(_gtest_header_file "gtest.h" PATHS ${_search_path_include} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) find_file(_gtest_src_file "gtest.cc" "gtest-all.cc" PATHS ${_search_path_src} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) if(_gtest_header_file AND _gtest_src_file) # set from-source variables set(GTEST_FROM_SOURCE_FOUND TRUE CACHE INTERNAL "") get_filename_component(_gtest_base_dir "${_gtest_src_file}" PATH) get_filename_component(_gtest_base_dir "${_gtest_base_dir}" PATH) set(GTEST_FROM_SOURCE_BASE_DIR "${_gtest_base_dir}" CACHE INTERNAL "") get_filename_component(_gtest_include_dir "${_gtest_header_file}" PATH) get_filename_component(_gtest_include_dir ${_gtest_include_dir} PATH) set(GTEST_FROM_SOURCE_INCLUDE_DIRS "${_gtest_include_dir}" CACHE INTERNAL "") set(GTEST_FROM_SOURCE_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/gtest" CACHE INTERNAL "") set(GTEST_FROM_SOURCE_LIBRARIES "gtest" CACHE INTERNAL "") set(GTEST_FROM_SOURCE_MAIN_LIBRARIES "gtest_main" CACHE INTERNAL "") endif() endif() if(GTEST_FROM_SOURCE_FOUND) message(STATUS "Found gtest sources under '${GTEST_FROM_SOURCE_BASE_DIR}': " "C++ tests using 'Google Test' will be built") # if the gtest sources are from a subfolder of gmock (not the case for gmock_vendor) # the subdirectory was already added by gmock if(NOT TARGET gtest) # add CMakeLists.txt from gtest dir add_subdirectory("${GTEST_FROM_SOURCE_BASE_DIR}" "${CMAKE_BINARY_DIR}/gtest") # mark gtest targets with EXCLUDE_FROM_ALL to only build # when tests are built which depend on them set_target_properties(gtest gtest_main PROPERTIES EXCLUDE_FROM_ALL 1) if(NOT WIN32) target_compile_options(gtest PRIVATE -Wno-null-dereference) endif() target_include_directories(gtest BEFORE PUBLIC "${GTEST_FROM_SOURCE_INCLUDE_DIRS}") target_include_directories(gtest_main BEFORE PUBLIC "${GTEST_FROM_SOURCE_INCLUDE_DIRS}") endif() # set the same variables as find_package() # but do NOT set GTEST_FOUND in the cache when using gtest from source # since the subdirectory must always be added to add the gtest targets 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() if(NOT GTEST_FOUND) message(WARNING "'gtest' not found, C++ tests using 'Google Test' can not be built. " "Please install the 'Google Test' headers globally in your system " "to enable these tests (e.g. on Ubuntu/Debian install the package " "'libgtest-dev') or get the ament package 'gtest_vendor'") endif() endif() endmacro() include("${ament_cmake_gtest_DIR}/ament_add_gtest.cmake") include("${ament_cmake_gtest_DIR}/ament_add_gtest_executable.cmake") include("${ament_cmake_gtest_DIR}/ament_add_gtest_test.cmake") include("${ament_cmake_gtest_DIR}/ament_find_gtest.cmake") ament_cmake-1.3.0/ament_cmake_gtest/cmake/000077500000000000000000000000001420356112300205065ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gtest/cmake/ament_add_gtest.cmake000066400000000000000000000065011420356112300246340ustar00rootroot00000000000000# 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. # # Add a gtest. # # Call add_executable(target ARGN), link it against the gtest libraries # and register the executable as a test. # # If gtest is not available the specified target is not being created and # therefore the target existence should be checked before being used. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param RUNNER: the path to the test runner script (default: see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the gtest # main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # macro(ament_add_gtest target) cmake_parse_arguments(_ARG "SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(NOT _ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_gtest() must be invoked with at least one source file") endif() # add executable set(_argn_executable ${_ARG_UNPARSED_ARGUMENTS}) if(_ARG_SKIP_LINKING_MAIN_LIBRARIES) list(APPEND _argn_executable "SKIP_LINKING_MAIN_LIBRARIES") endif() ament_add_gtest_executable("${target}" ${_argn_executable}) # add test set(_argn_test "") if(_ARG_RUNNER) list(APPEND _argn_test "RUNNER" "${_ARG_RUNNER}") endif() if(_ARG_TIMEOUT) list(APPEND _argn_test "TIMEOUT" "${_ARG_TIMEOUT}") endif() if(_ARG_WORKING_DIRECTORY) list(APPEND _argn_test "WORKING_DIRECTORY" "${_ARG_WORKING_DIRECTORY}") endif() if(_ARG_SKIP_TEST) list(APPEND _argn_test "SKIP_TEST") endif() if(_ARG_ENV) list(APPEND _argn_test "ENV" ${_ARG_ENV}) endif() if(_ARG_APPEND_ENV) list(APPEND _argn_test "APPEND_ENV" ${_ARG_APPEND_ENV}) endif() if(_ARG_APPEND_LIBRARY_DIRS) list(APPEND _argn_test "APPEND_LIBRARY_DIRS" ${_ARG_APPEND_LIBRARY_DIRS}) endif() ament_add_gtest_test("${target}" ${_argn_test}) endmacro() ament_cmake-1.3.0/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake000066400000000000000000000043341420356112300270370ustar00rootroot00000000000000# Copyright 2014-2016 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. # # Add an executable using gtest. # # Call add_executable(target ARGN) and link it against the gtest libraries. # It does not register the executable as a test. # # If gtest is not available the specified target is not being created and # therefore the target existence should be checked before being used. # # :param target: the target name which will also be used as the test name # :type target: string # :param ARGN: the list of source files # :type ARGN: list of strings # :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the gtest # main libraries # :type SKIP_LINKING_MAIN_LIBRARIES: option # # @public # macro(ament_add_gtest_executable target) _ament_cmake_gtest_find_gtest() if(GTEST_FOUND) _ament_add_gtest_executable("${target}" ${ARGN}) endif() endmacro() function(_ament_add_gtest_executable target) cmake_parse_arguments(ARG "SKIP_LINKING_MAIN_LIBRARIES" "" "" ${ARGN}) if(NOT ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_gtest_executable() must be invoked with at least one source file") endif() # should be EXCLUDE_FROM_ALL if it would be possible # to add this target as a dependency to the "test" target add_executable("${target}" ${ARG_UNPARSED_ARGUMENTS}) target_include_directories("${target}" BEFORE PUBLIC "${GTEST_INCLUDE_DIRS}") if(NOT ARG_SKIP_LINKING_MAIN_LIBRARIES) target_link_libraries("${target}" ${GTEST_MAIN_LIBRARIES}) endif() target_link_libraries("${target}" ${GTEST_LIBRARIES}) if(NOT WIN32) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries("${target}" Threads::Threads) endif() endfunction() ament_cmake-1.3.0/ament_cmake_gtest/cmake/ament_add_gtest_test.cmake000066400000000000000000000064751420356112300257050ustar00rootroot00000000000000# Copyright 2014-2016 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. # # Add an existing executable using gtest as a test. # # Register an executable created with ament_add_gtest_executable() as a test. # If the specified target does not exist the registration is skipped. # # :param target: the target name which will also be used as the test name # :type target: string # :param RUNNER: the path to the test runner script (default: see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # executable in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # function(ament_add_gtest_test target) if(NOT TARGET ${target}) return() endif() cmake_parse_arguments(ARG "SKIP_TEST" "RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_gtest_test() called with unused arguments: ${ARGN}") endif() set(executable "$") set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${target}.gtest.xml") set(cmd "${executable}" "--gtest_output=xml:${result_file}") if(ARG_ENV) set(ARG_ENV "ENV" ${ARG_ENV}) endif() if(ARG_APPEND_ENV) set(ARG_APPEND_ENV "APPEND_ENV" ${ARG_APPEND_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS}) endif() if(ARG_RUNNER) set(ARG_RUNNER "RUNNER" ${ARG_RUNNER}) endif() if(ARG_TIMEOUT) set(ARG_TIMEOUT "TIMEOUT" ${ARG_TIMEOUT}) endif() if(ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "WORKING_DIRECTORY" "${ARG_WORKING_DIRECTORY}") endif() if(ARG_SKIP_TEST) set(ARG_SKIP_TEST "SKIP_TEST") endif() ament_add_test( "${target}" COMMAND ${cmd} OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_gtest/${target}.txt" RESULT_FILE "${result_file}" ${ARG_RUNNER} ${ARG_SKIP_TEST} ${ARG_ENV} ${ARG_APPEND_ENV} ${ARG_APPEND_LIBRARY_DIRS} ${ARG_TIMEOUT} ${ARG_WORKING_DIRECTORY} ) set_tests_properties( "${target}" PROPERTIES REQUIRED_FILES "${executable}" LABELS "gtest" ) endfunction() ament_cmake-1.3.0/ament_cmake_gtest/cmake/ament_find_gtest.cmake000066400000000000000000000021211420356112300250160ustar00rootroot00000000000000# 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. # # Find gtest. # # Set the variables ``GTEST_FOUND``, ``GTEST_INCLUDE_DIRS``, # ``GTEST_LIBRARIES``, ``GTEST_MAIN_LIBRARIES`` and # ``GTEST_BOTH_LIBRARIES``. # # Note: you should always link against ``GTEST_LIBRARIES`` and optionally # additionally against ``GTEST_MAIN_LIBRARIES``. # # @public # macro(ament_find_gtest) set(_ARGN "${ARGN}") if(_ARGN) message(FATAL_ERROR "ament_find_gtest() called with unused arguments: ${_ARGN}") endif() _ament_cmake_gtest_find_gtest() endmacro() ament_cmake-1.3.0/ament_cmake_gtest/doc/000077500000000000000000000000001420356112300201735ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_gtest/doc/usage.md000066400000000000000000000006051420356112300216220ustar00rootroot00000000000000 ## Usage To use this package do the following things. - add a test dependency to your packages.xml: `ament_cmake_gtest` - Write a gtest executable: Use `#include ` and standard gtest methods. - Find package gtest in your CMakeLists.txt: `find_package(ament_cmake_gtest REQUIRED)` - Add a cmake target using the `ament_add_gtest` cmake macro ament_cmake-1.3.0/ament_cmake_gtest/package.xml000066400000000000000000000015651420356112300215520ustar00rootroot00000000000000 ament_cmake_gtest 1.3.0 The ability to add gtest-based tests in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_test gtest gtest_vendor ament_cmake ament_cmake-1.3.0/ament_cmake_include_directories/000077500000000000000000000000001420356112300223175ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_include_directories/CHANGELOG.rst000066400000000000000000000063441420356112300243470ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_include_directories ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Make ament_include_directories_order a function to allow paths with backslashes on windows. (`#371 `_) * Repalce backslashes with forward slashes on Windows * Typo * Replace slashes in ARGN * Don't quote * Check ARGN has values before trying to string(REPLACE them * Make ament_include_directories_order a function * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Shane Loretz 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ * fix behavior of ament_include_directories_order on non-Windows (`#157 `_) * Contributors: Dirk Thomas 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * add explicit build type * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * add ament_cmake_include_directories * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_include_directories/CMakeLists.txt000066400000000000000000000004201420356112300250530ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_include_directories NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_include_directories-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_include_directories/ament_cmake_include_directories-extras.cmake000066400000000000000000000014201420356112300331650ustar00rootroot00000000000000# 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. # copied from # ament_cmake_include_directories/ament_cmake_include_directories-extras.cmake include("${ament_cmake_include_directories_DIR}/ament_include_directories_order.cmake") ament_cmake-1.3.0/ament_cmake_include_directories/cmake/000077500000000000000000000000001420356112300233775ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_include_directories/cmake/ament_include_directories_order.cmake000066400000000000000000000043601420356112300330020ustar00rootroot00000000000000# 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. # # Order include directories according to chain of prefixes. # # :param var: the output variable name # :type var: string # :param ARGN: a list of include directories. # :type ARGN: list of strings # # @public # function(ament_include_directories_order var) set(prefixes "$ENV{AMENT_PREFIX_PATH}") if(NOT WIN32) string(REPLACE ":" ";" prefixes "${prefixes}") endif() # create list of empty slots, one per prefix and one for unknown prefixes list(LENGTH prefixes prefix_count) foreach(index RANGE ${prefix_count}) set(slot_${index} "") endforeach() # append the include directories to the first matching prefix foreach(include_dir ${ARGN}) string(LENGTH "${include_dir}" include_dir_length) set(index 0) while(TRUE) if(NOT ${index} LESS ${prefix_count}) # no match break() endif() list(GET prefixes ${index} prefix) # exact match if(prefix STREQUAL include_dir) break() endif() string(LENGTH "${prefix}" prefix_length) if(${prefix_length} LESS ${include_dir_length}) math(EXPR prefix_length_plus_one "${prefix_length} + 1") string(SUBSTRING "${include_dir}" 0 ${prefix_length_plus_one} include_dir_prefix) # prefix match if("${prefix}/" STREQUAL "${include_dir_prefix}") break() endif() endif() math(EXPR index "${index} + 1") endwhile() list(APPEND slot_${index} "${include_dir}") endforeach() # join the slot lists set(ordered "") foreach(index RANGE ${prefix_count}) list(APPEND ordered ${slot_${index}}) endforeach() set(${var} "${ordered}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_include_directories/package.xml000066400000000000000000000014611420356112300244360ustar00rootroot00000000000000 ament_cmake_include_directories 1.3.0 The functionality to order include directories according to a chain of prefixes in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_libraries/000077500000000000000000000000001420356112300202545ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_libraries/CHANGELOG.rst000066400000000000000000000060411420356112300222760ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_libraries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ * fix regex for build configuration keywords (`#148 `_) * Contributors: Dirk Thomas 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * require CMake 3.5 * add explicit build type * add missing copyright / license information, update format of existing license information * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * add ament_cmake_libraries * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_libraries/CMakeLists.txt000066400000000000000000000003741420356112300230200ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_libraries NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_libraries-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_libraries/ament_cmake_libraries-extras.cmake000066400000000000000000000017221420356112300270640ustar00rootroot00000000000000# 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. # copied from ament_cmake_libraries/ament_cmake_libraries-extras.cmake set(AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR ":") include("${ament_cmake_libraries_DIR}/ament_libraries_deduplicate.cmake") include("${ament_cmake_libraries_DIR}/ament_libraries_pack_build_configuration.cmake") include("${ament_cmake_libraries_DIR}/ament_libraries_unpack_build_configuration.cmake") ament_cmake-1.3.0/ament_cmake_libraries/cmake/000077500000000000000000000000001420356112300213345ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake000066400000000000000000000024051420356112300300420ustar00rootroot00000000000000# 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. # # Deduplicate libraries. # # If the list contains duplicates only the last value is kept. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries. # Each element might either a build configuration keyword or a library. # :type ARGN: list of strings # # @public # macro(ament_libraries_deduplicate VAR) ament_libraries_pack_build_configuration(_packed ${ARGN}) set(_unique "") foreach(_lib ${_packed}) # remove existing value if it exists list(REMOVE_ITEM _unique ${_lib}) # append value to the end list(APPEND _unique ${_lib}) endforeach() ament_libraries_unpack_build_configuration(${VAR} ${_unique}) endmacro() ament_cmake-1.3.0/ament_cmake_libraries/cmake/ament_libraries_pack_build_configuration.cmake000066400000000000000000000033171420356112300326060ustar00rootroot00000000000000# 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. # # 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 easily. # # :param VAR: the output variable name # :type VAR: string # :param ARGN: a list of libraries # :type ARGN: list of strings # macro(ament_libraries_pack_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 "ament_libraries_pack_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}${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}") else() list(APPEND ${VAR} "${_lib}") endif() math(EXPR _index "${_index} + 1") endwhile() endmacro() ament_cmake-1.3.0/ament_cmake_libraries/cmake/ament_libraries_unpack_build_configuration.cmake000066400000000000000000000022351420356112300331470ustar00rootroot00000000000000# 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. # # 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 # macro(ament_libraries_unpack_build_configuration VAR) set(${VAR} "") foreach(_lib ${ARGN}) string(REGEX REPLACE "^(debug|optimized|general)${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" _lib "${_lib}") list(APPEND ${VAR} "${_lib}") endforeach() endmacro() ament_cmake-1.3.0/ament_cmake_libraries/package.xml000066400000000000000000000014021420356112300223660ustar00rootroot00000000000000 ament_cmake_libraries 1.3.0 The functionality to deduplicate libraries in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_nose/000077500000000000000000000000001420356112300172445ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_nose/CHANGELOG.rst000066400000000000000000000163271420356112300212760ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_nose ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Support commands with executable targets (`#352 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * Add 'runner' option to ament_add_gmock / nose (`#177 `_) * Add 'runner' option to ament_add_gmock * Give ament_add_nose ability to specify a different runner, too * Contributors: Peter Baughman 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ * Fix unused-arg check in ament_cmake packages: (`#167 `_) Arguments to a macro are not variables, so it's not possible to do 'if(ARGN)' to check for arguments; however, copying ARGN to a variable works. * Contributors: jpsamper2009 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * Merge pull request `#103 `_ from ament/resolve_some_todos Resolve some todos * remove obsolete todos * Get nose tests to immediately print console output (`#98 `_) This is useful for tests that timeout and get killed without an opportunity to print the console output that was captured * 0.0.2 * Use python3-nose rosdep key. (`#95 `_) * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * Merge pull request `#85 `_ from ament/split_gtest_function Split ament_add_gtest function * add doc for SKIP_TEST * Skipped tests (`#80 `_) * support skipping tests * add SKIP_TEST to ament_add_nose_test * use keyword args not positional * discard positional args after first * remove trailing whitespace * update schema url * add schema to manifest files * Windows python debug (`#73 `_) * add python interpreter to nose test parameters * update doc * rename interpreter to executable and add doc * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * remove trailing spaces from comparisons, obsolete quotes and explicit variable expansion * require CMake 3.5 * run nosetests with the python executable (`#70 `_) * run nosetests with the python executable * comment to describe the source of the issue * fixup * Merge pull request `#55 `_ from ament/generator_expression allow tests with generator expression in the path * allow tests with generator expression in the path * Merge pull request `#54 `_ from ament/test_working_dir support WORKING_DIRECTORY in ament_add_nose_test * add WORKING_DIRECTORY to ament_add_nose_test * follow fixes from `#52 `_ * Merge pull request `#52 `_ from ament/add_test_append_env_option add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * Merge pull request `#46 `_ from ament/nosetest_prefix_testsuite use --xunit-prefix-with-testsuite-name option of upcoming nosetests version * use --xunit-prefix-with-testsuite-name option of upcoming nosetests version * Merge pull request `#43 `_ from ament/fix_build_with_spaces invoke nosetest through Python executable * invoke nosetest through Python executable * Merge pull request `#37 `_ from ament/test_labels add labels to tests * add labels to tests * Merge pull request `#36 `_ from ament/version_less_cmake Use VERSION_LESS to test the Nose version * Use VERSION_LESS to test the Nose version `VERSION_LESS` is used for checking versions: http://cmake.org/cmake/help/v2.8.12/cmake.html#command:if * Merge pull request `#33 `_ from ament/nosetest_version determine nosetest version in CMake and use --xunit-testsuite-name when available * determine nosetest version in CMake and use --xunit-testsuite-name when available * Merge pull request `#28 `_ from ament/gtest_location fix location of gtest / gmock executables on Windows * add type as extension to test result files * fix name of nosetests output file * Merge pull request `#19 `_ from ament/improve_test_runner improve test runner * improve test runner * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * update quoting of additional ament_add_test() arguments * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * add ament_cmake_environment_hooks * add ament_cmake_test, ament_cmake_gtest, ament_cmake_nose * Contributors: Dirk Thomas, Esteve Fernandez, Mikael Arguedas, Steven! Ragnarök, William Woodall, dhood ament_cmake-1.3.0/ament_cmake_nose/CMakeLists.txt000066400000000000000000000003621420356112300220050ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_nose NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_nose-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_nose/ament_cmake_nose-extras.cmake000066400000000000000000000050361420356112300250460ustar00rootroot00000000000000# 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. # copied from ament_cmake_nose/ament_cmake_nose-extras.cmake # find nosetests once macro(_ament_cmake_nose_find_nosetests) if(NOT DEFINED _AMENT_CMAKE_NOSE_FIND_NOSETESTS) set(_AMENT_CMAKE_NOSE_FIND_NOSETESTS TRUE) find_package(ament_cmake_core QUIET REQUIRED) find_package(ament_cmake_test QUIET REQUIRED) find_program(NOSETESTS NAMES "nosetests${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" "nosetests-${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" "nosetests${Python3_VERSION_MAJOR}" "nosetests-${Python3_VERSION_MAJOR}" "nosetests") if(NOSETESTS) # if Python is located in a path containing spaces the shebang line of nosetests is invalid # to avoid using the shebang line of nosetests the script is being invoked through Python get_executable_path(_python_interpreter Python3::Interpreter CONFIGURE) set(_cmd "${_python_interpreter}" "${NOSETESTS}" "--version") execute_process( COMMAND ${_cmd} RESULT_VARIABLE _res OUTPUT_VARIABLE _output OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _res EQUAL 0) string(REPLACE ";" " " _cmd_str "${_cmd}") message(FATAL_ERROR "Failed to invoke nosetest: '${_cmd_str}' returned error code ${_res}") endif() string(REPLACE " version " ";" _output_list "${_output}") list(LENGTH _output_list _length) if(NOT _length EQUAL 2) message(FATAL_ERROR "Failed to extract nosetest version from '${_output}'") endif() list(GET _output_list 1 NOSETESTS_VERSION) message(STATUS "Using Python nosetests: ${NOSETESTS} (${NOSETESTS_VERSION})") else() message(WARNING "'nosetests' not found, Python nose tests can not be run (e.g. on " "Ubuntu/Debian install the package 'python3-nose')") endif() endif() endmacro() include("${ament_cmake_nose_DIR}/ament_add_nose_test.cmake") include("${ament_cmake_nose_DIR}/ament_find_nosetests.cmake") ament_cmake-1.3.0/ament_cmake_nose/cmake/000077500000000000000000000000001420356112300203245ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_nose/cmake/ament_add_nose_test.cmake000066400000000000000000000116771420356112300253410ustar00rootroot00000000000000# 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. # # Add a nose test. # # :param testname: the name of the test # :type testname: string # :param path: the path to a file or folder where ``nosetests`` # should be invoked on # :type path: string # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param PYTHON_EXECUTABLE: Python executable used to run the test. # It defaults to the CMake executable target Python3::Interpreter. # :type PYTHON_EXECUTABLE: string # :param RUNNER: the path to the test runner script (default: see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # command in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # macro(ament_add_nose_test testname path) _ament_cmake_nose_find_nosetests() if(NOSETESTS) _ament_add_nose_test("${testname}" "${path}" ${ARGN}) endif() endmacro() function(_ament_add_nose_test testname path) cmake_parse_arguments(ARG "SKIP_TEST" "PYTHON_EXECUTABLE;RUNNER;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_nose_test() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT IS_ABSOLUTE "${path}") set(path "${CMAKE_CURRENT_SOURCE_DIR}/${path}") endif() # only check existence of path if it doesn't contain generator expressions string(FIND "${path}" "$<" index) if(index EQUAL -1 AND NOT EXISTS "${path}") message(FATAL_ERROR "ament_add_nose_test() the path '${path}' does not exist") endif() if(NOT ARG_PYTHON_EXECUTABLE) set(ARG_PYTHON_EXECUTABLE Python3::Interpreter) endif() get_executable_path(python_interpreter "${ARG_PYTHON_EXECUTABLE}" BUILD) set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${testname}.xunit.xml") # Invoke ${NOSETESTS} explicitly with the ${PYTHON_EXECUTABLE} because on # some systems, like OS X, the ${NOSETESTS} binary may have a #! which points # to the Python2 on the system, rather than the Python3 which is what we want # most of the time. # This "misalignment" can occur when you do `pip install -U nose` after doing # `pip3 install -U nose` because both install the `nose` binary. # Basically the last Python system to install nose will determine what the # ${NOSETESTS} executable references. # See: https://github.com/ament/ament_cmake/pull/70 set(cmd "${python_interpreter}" "-u" # unbuffered stdout and stderr "${NOSETESTS}" "${path}" "--nocapture" # stdout will be printed immediately "--with-xunit" "--xunit-file=${result_file}") if(NOT "${NOSETESTS_VERSION}" VERSION_LESS "1.3.5") list(APPEND cmd "--xunit-testsuite-name=${PROJECT_NAME}.nosetests") if(NOT "${NOSETESTS_VERSION}" VERSION_LESS "1.3.8") list(APPEND cmd "--xunit-prefix-with-testsuite-name") endif() endif() if(ARG_ENV) set(ARG_ENV "ENV" ${ARG_ENV}) endif() if(ARG_APPEND_ENV) set(ARG_APPEND_ENV "APPEND_ENV" ${ARG_APPEND_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS}) endif() if(ARG_RUNNER) set(ARG_RUNNER "RUNNER" ${ARG_RUNNER}) endif() if(ARG_TIMEOUT) set(ARG_TIMEOUT "TIMEOUT" "${ARG_TIMEOUT}") endif() if(ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "WORKING_DIRECTORY" "${ARG_WORKING_DIRECTORY}") endif() if(ARG_SKIP_TEST) set(ARG_SKIP_TEST "SKIP_TEST") endif() ament_add_test( "${testname}" COMMAND ${cmd} OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_nose/${testname}.txt" RESULT_FILE "${result_file}" ${ARG_RUNNER} ${ARG_SKIP_TEST} ${ARG_ENV} ${ARG_APPEND_ENV} ${ARG_APPEND_LIBRARY_DIRS} ${ARG_TIMEOUT} ${ARG_WORKING_DIRECTORY} ) set_tests_properties( "${testname}" PROPERTIES LABELS "nose" ) endfunction() ament_cmake-1.3.0/ament_cmake_nose/cmake/ament_find_nosetests.cmake000066400000000000000000000016401420356112300255420ustar00rootroot00000000000000# 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. # # Find nosetests. # # Set the variable ``NOSETESTS`` to the absolute path of the # executable if found. # # @public # macro(ament_find_nose) set(_ARGN "${ARGN}") if(_ARGN) message(FATAL_ERROR "ament_find_nose() called with unused arguments: ${_ARGN}") endif() _ament_cmake_nose_find_nosetests() endmacro() ament_cmake-1.3.0/ament_cmake_nose/package.xml000066400000000000000000000015761420356112300213720ustar00rootroot00000000000000 ament_cmake_nose 1.3.0 The ability to add nose-based tests in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_test python3-nose ament_cmake ament_cmake-1.3.0/ament_cmake_pytest/000077500000000000000000000000001420356112300176305ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_pytest/CHANGELOG.rst000066400000000000000000000107311420356112300216530ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_pytest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Fix misleading comment (`#361 `_) * Contributors: Audrow Nash, Tim Clephas 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Support commands with executable targets (`#352 `_) * Mention other platforms in 'pytest/pytest-cov not found' warning (`#337 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Christophe Bedard, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ * Fix ament_get_pytest_cov_version for newer versions of pytest (`#315 `_) * Contributors: Christophe Bedard 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Enable coverage information generation for pytest tests with CMake (`#226 `_) * Enable coverage information generation for pytest tests with CMake * Add comment about pytest-cov version requirement for --cov-branch * Add --pytest-with-coverage to run_test.py and mention the env var * Rename to AMENT_CMAKE_TEST_PYTEST_WITH_COVERAGE * Fix missing quote * Exclude gtests from pytest coverage explicitly They were excluded before, but only because gtests didn't use --env or --append-end. * Append pytest-cov flags in ament_add_pytest_test() directly * Fix ament_has_pytest_cov() * Change default logic to avoid overriding CLI params * Remove --cov-append pytest_cov option * Simplify indentation * Remove QUIET arg from ament_has_pytest_cov() * Change ament_has_pytest_cov() to ament_get_pytest_cov_version() * Do not return() if pytest_cov is not found in ament_add_pytest_test() * Fix missing empty argument * Simplify pytest_cov version regex match * Write pytest_cov results to test-specific directory * Make sure to create test-specific pytest_cov directory * Contributors: Christophe Bedard 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * Add runner option to ament_add_test (`#174 `_) * ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID * ament_cmake move run_test.py to a python module - This should let us see the history * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package * Add WERROR option to ament_add_pytest_test (`#168 `_) This has the benefit of making deprecation warnings visible, which are not by default. Default value for the option is OFF. * Contributors: Jacob Perron, Peter Baughman 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * add ament_cmake_pytest package (`#116 `_) * add ament_cmake_pytest package * doc fixup * wrap comment * Contributors: Dirk Thomas ament_cmake-1.3.0/ament_cmake_pytest/CMakeLists.txt000066400000000000000000000003661420356112300223750ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_pytest NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_pytest-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_pytest/ament_cmake_pytest-extras.cmake000066400000000000000000000016201420356112300260110ustar00rootroot00000000000000# Copyright 2017 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. # copied from ament_cmake_pytest/ament_cmake_pytest-extras.cmake find_package(ament_cmake_test QUIET REQUIRED) include("${ament_cmake_pytest_DIR}/ament_add_pytest_test.cmake") include("${ament_cmake_pytest_DIR}/ament_has_pytest.cmake") include("${ament_cmake_pytest_DIR}/ament_get_pytest_cov_version.cmake") ament_cmake-1.3.0/ament_cmake_pytest/cmake/000077500000000000000000000000001420356112300207105ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake000066400000000000000000000143111420356112300262750ustar00rootroot00000000000000# Copyright 2017 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. # # Add a pytest test. # # :param testname: the name of the test # :type testname: string # :param path: the path to a file or folder where ``pytest`` should be invoked # on # :type path: string # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param PYTHON_EXECUTABLE: Python executable used to run the test. # It defaults to the CMake executable target Python3::Interpreter. # :type PYTHON_EXECUTABLE: string # :param RUNNER: the path to the test runner script (default: see ament_add_test). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, # default defined by ``ament_add_test()`` # :type TIMEOUT: integer # :param WERROR: If ON, then treat warnings as errors. Default: OFF. # :type WERROR: bool # :param WORKING_DIRECTORY: the working directory for invoking the # command in, default defined by ``ament_add_test()`` # :type WORKING_DIRECTORY: string # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # # @public # function(ament_add_pytest_test testname path) cmake_parse_arguments(ARG "SKIP_TEST" "PYTHON_EXECUTABLE;RUNNER;TIMEOUT;WERROR;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;ENV" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_pytest_test() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() # check arguments if(NOT IS_ABSOLUTE "${path}") set(path "${CMAKE_CURRENT_SOURCE_DIR}/${path}") endif() # only check existence of path if it doesn't contain generator expressions string(FIND "${path}" "$<" index) if(index EQUAL -1 AND NOT EXISTS "${path}") message(FATAL_ERROR "ament_add_pytest_test() the path '${path}' does not exist") endif() if(NOT ARG_PYTHON_EXECUTABLE) set(ARG_PYTHON_EXECUTABLE Python3::Interpreter) endif() get_executable_path(python_interpreter "${ARG_PYTHON_EXECUTABLE}" BUILD) # ensure pytest is available ament_has_pytest(has_pytest QUIET PYTHON_EXECUTABLE "${ARG_PYTHON_EXECUTABLE}") if(NOT has_pytest) message(WARNING "The Python module 'pytest' was not found, pytests cannot be run. " "On Linux, install the 'python3-pytest' package. " "On other platforms, install 'pytest' using pip.") return() endif() set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${testname}.xunit.xml") set(cmd "${python_interpreter}" "-u" # unbuffered stdout and stderr "-m" "pytest" "${path}" # store last failed tests "-o" "cache_dir=${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_pytest/${testname}/.cache" # junit arguments "--junit-xml=${result_file}" "--junit-prefix=${PROJECT_NAME}" ) if(ARG_WERROR) # treat warnings as errors list(APPEND cmd "-We") endif() # enable pytest coverage by default if the package test_depends on python3-pytest-cov if("python3-pytest-cov" IN_LIST ${PROJECT_NAME}_TEST_DEPENDS) set(coverage_default ON) else() set(coverage_default OFF) endif() option(AMENT_CMAKE_PYTEST_WITH_COVERAGE "Generate coverage information for Python tests" ${coverage_default}) if(AMENT_CMAKE_PYTEST_WITH_COVERAGE) # get pytest-cov version, if available ament_get_pytest_cov_version(pytest_cov_version PYTHON_EXECUTABLE "${ARG_PYTHON_EXECUTABLE}" ) if(NOT pytest_cov_version) message(WARNING "The Python module 'pytest-cov' was not found, test coverage will not be produced. " "On Linux, install the 'python3-pytest-cov' package. " "On other platforms, install 'pytest-cov' using pip.") else() set(coverage_directory "${CMAKE_CURRENT_BINARY_DIR}/pytest_cov/${testname}") file(MAKE_DIRECTORY "${coverage_directory}") list(APPEND cmd "--cov=${CMAKE_CURRENT_SOURCE_DIR}" "--cov-report=html:${coverage_directory}/coverage.html" "--cov-report=xml:${coverage_directory}/coverage.xml" ) if(pytest_cov_version VERSION_LESS "2.5.0") message(WARNING "Test coverage will be produced, but will not contain branch coverage information, " "because the pytest extension 'cov' does not support it " "(need 2.5.0, found '${pytest_cov_version}').") else() list(APPEND cmd "--cov-branch") endif() list(APPEND ARG_ENV "COVERAGE_FILE=${coverage_directory}/.coverage") endif() endif() if(ARG_ENV) set(ARG_ENV "ENV" ${ARG_ENV}) endif() if(ARG_APPEND_ENV) set(ARG_APPEND_ENV "APPEND_ENV" ${ARG_APPEND_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS}) endif() if(ARG_RUNNER) set(ARG_RUNNER "RUNNER" ${ARG_RUNNER}) endif() if(ARG_TIMEOUT) set(ARG_TIMEOUT "TIMEOUT" "${ARG_TIMEOUT}") endif() if(ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "WORKING_DIRECTORY" "${ARG_WORKING_DIRECTORY}") endif() if(ARG_SKIP_TEST) set(ARG_SKIP_TEST "SKIP_TEST") endif() ament_add_test( "${testname}" COMMAND ${cmd} OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_pytest/${testname}.txt" RESULT_FILE "${result_file}" ${ARG_RUNNER} ${ARG_SKIP_TEST} ${ARG_ENV} ${ARG_APPEND_ENV} ${ARG_APPEND_LIBRARY_DIRS} ${ARG_TIMEOUT} ${ARG_WORKING_DIRECTORY} ) set_tests_properties( "${testname}" PROPERTIES LABELS "pytest" ) endfunction() ament_cmake-1.3.0/ament_cmake_pytest/cmake/ament_get_pytest_cov_version.cmake000066400000000000000000000040711420356112300277030ustar00rootroot00000000000000# Copyright 2020 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. # # Check if the Python module `pytest-cov` was found and get its version if it is. # # :param var: the output variable name # :type var: string # :param PYTHON_EXECUTABLE: Python executable used to check the version # It defaults to the CMake executable target Python3::Interpreter. # :type PYTHON_EXECUTABLE: string # # @public # function(ament_get_pytest_cov_version var) cmake_parse_arguments(ARG "" "PYTHON_EXECUTABLE" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_get_pytest_cov_version() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_PYTHON_EXECUTABLE) set(ARG_PYTHON_EXECUTABLE Python3::Interpreter) endif() get_executable_path(python_interpreter "${ARG_PYTHON_EXECUTABLE}" CONFIGURE) # Newer versions of pytest require providing '--version' twice to include plugin versions set(cmd "${python_interpreter}" "-m" "pytest" "--version" "--version") execute_process( COMMAND ${cmd} RESULT_VARIABLE res OUTPUT_VARIABLE output ERROR_VARIABLE error) if(res EQUAL 0) # check if pytest-cov is in the list of plugins # (actual output of the command is in ${error} and not ${output}) string(REGEX MATCH "pytest-cov-([0-9]+\.[0-9]+\.[0-9]+)" pytest_cov_full_version "${error}") if(pytest_cov_full_version) set(${var} ${CMAKE_MATCH_1} PARENT_SCOPE) else() set(${var} FALSE PARENT_SCOPE) endif() else() set(${var} FALSE PARENT_SCOPE) endif() endfunction() ament_cmake-1.3.0/ament_cmake_pytest/cmake/ament_has_pytest.cmake000066400000000000000000000036771420356112300252760ustar00rootroot00000000000000# Copyright 2017 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. # # Check if the Python module `pytest` was found. # # :param var: the output variable name # :type var: string # :param QUIET: suppress the CMake warning if pytest is not found, if not set # and pytest was not found a CMake warning is printed # :type QUIET: option # :param PYTHON_EXECUTABLE: Python executable used to check for pytest # It defaults to the CMake executable target Python3::Interpreter. # :type PYTHON_EXECUTABLE: string # # @public # function(ament_has_pytest var) cmake_parse_arguments(ARG "QUIET" "PYTHON_EXECUTABLE" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_has_pytest() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_PYTHON_EXECUTABLE) set(ARG_PYTHON_EXECUTABLE Python3::Interpreter) endif() get_executable_path(python_interpreter "${ARG_PYTHON_EXECUTABLE}" CONFIGURE) set(cmd "${python_interpreter}" "-m" "pytest" "--version") execute_process( COMMAND ${cmd} RESULT_VARIABLE res OUTPUT_VARIABLE output ERROR_VARIABLE error) if(res EQUAL 0) set(${var} TRUE PARENT_SCOPE) else() if(NOT ARG_QUIET) string(REPLACE ";" " " cmd_str "${cmd}") message(WARNING "Failed to find Python module `pytest`: " "'${cmd_str}' returned error code ${res}") endif() set(${var} FALSE PARENT_SCOPE) endif() endfunction() ament_cmake-1.3.0/ament_cmake_pytest/package.xml000066400000000000000000000016131420356112300217460ustar00rootroot00000000000000 ament_cmake_pytest 1.3.0 The ability to run Python tests using pytest in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_test python3-pytest ament_cmake ament_cmake-1.3.0/ament_cmake_python/000077500000000000000000000000001420356112300176215ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_python/.gitignore000066400000000000000000000000771420356112300216150ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] ament_cmake-1.3.0/ament_cmake_python/CHANGELOG.rst000066400000000000000000000146521420356112300216520ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_python ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Make ament_cmake_python symlink for symlink installs only (`#357 `_) * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Make ament_python_install_package() match setuptools' egg names. (`#338 `_) * Drop ament_cmake_python outdated tests. (`#340 `_) * Update maintainers (`#336 `_) * Make ament_python_install_package() install console_scripts (`#328 `_) * Contributors: Chris Lalancette, Michel Hidalgo, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ * Symlink setup.cfg and sources before building Python egg-info (`#327 `_) * Simplify ament_python_install_package() macro. (`#326 `_) Do not delegate to setuptools, install egg-info manually. * Contributors: Michel Hidalgo 1.1.2 (2021-02-26 22:59) ------------------------ * Escape $ENV{DESTDIR} everywhere in ament_python_install_package() (`#324 `_) Follow up after f80071e2216e766f7bf1b0792493a5f6523e9226 * Contributors: Michel Hidalgo 1.1.1 (2021-02-26 19:12) ------------------------ * Use DESTDIR on ament_python_install_package() (`#323 `_) * Use DESTDIR on ament_python_install_package() * Contributors: Michel Hidalgo 1.1.0 (2021-02-24) ------------------ * Make ament_python_install_package() install a flat Python egg (`#316 `_) * Contributors: Michel Hidalgo 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ * [ament_cmake_python] ament_cmake_python_get_python_install_dir public (`#300 `_) * [ament_cmake_python] make the ament_cmake_python_get_python_install_dir a public interface. * Contributors: Naveau 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * ensure that PYTHON_INSTALL_DIR is initialized for generated .dsv file (`#190 `_) * ensure that PYTHON_INSTALL_DIR is initialized for generated .dsv file * use native path of PYTHON_INSTALL_DIR * Contributors: Dirk Thomas 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * install file and not absolute path (`#110 `_) * 0.0.3 * Merge pull request `#103 `_ from ament/resolve_some_todos Resolve some todos * compile installed Python modules and packages by default, add option to skip compilation * 0.0.2 * Merge pull request `#84 `_ from ament/use_in_list use IN_LIST * use IN_LIST * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * require CMake 3.5 * Merge pull request `#58 `_ from ament/destination_suffix change DESTINATION argument name of ament_python_install_module() * change DESTINATION argument name of ament_python_install_module() * Merge pull request `#57 `_ from ament/only-install-python Added DESTINATION argument * Added DESTINATION argument * Merge pull request `#40 `_ from ament/consistent_path_sep use consistent path separator * use platform specific path separators * add explicit build type * label todo with author * disable debug output * add missing copyright / license information, update format of existing license information * Merge pull request `#3 `_ from ament/windows Windows Support * addressing review comments * [windows] convert \ in paths to / for CMake Otherwise CMake will interpret them as escape sequences or as line continuations. * exclude .pyc files and __pycache_\_ folders from installation * update cmake code style only * fix Python install dir * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * refactor to use templates provided by ament_package * refactored PYTHON_INSTALL_DIR computation * update cmake code style * minor fixes * add ament_cmake_environment_hooks * minor * add ament_cmake_python * Contributors: Dirk Thomas, Esteve Fernandez, Mikael Arguedas, William Woodall ament_cmake-1.3.0/ament_cmake_python/CMakeLists.txt000066400000000000000000000003661420356112300223660ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_python NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_python-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_python/ament_cmake_python-extras.cmake000066400000000000000000000055421420356112300260020ustar00rootroot00000000000000# 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. # copied from ament_cmake_python/ament_cmake_python-extras.cmake # register environment hook for PYTHONPATH once macro(_ament_cmake_python_register_environment_hook) if(NOT DEFINED _AMENT_CMAKE_PYTHON_ENVIRONMENT_HOOK_REGISTERED) set(_AMENT_CMAKE_PYTHON_ENVIRONMENT_HOOK_REGISTERED TRUE) _ament_cmake_python_get_python_install_dir() find_package(ament_cmake_core QUIET REQUIRED) # backup variable set(_PYTHON_INSTALL_DIR "${PYTHON_INSTALL_DIR}") # use native separators in environment hook to match what pure Python packages do file(TO_NATIVE_PATH "${PYTHON_INSTALL_DIR}" PYTHON_INSTALL_DIR) # register information for .dsv generation set( AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_pythonpath "prepend-non-duplicate;PYTHONPATH;${PYTHON_INSTALL_DIR}") ament_environment_hooks( "${ament_cmake_package_templates_ENVIRONMENT_HOOK_PYTHONPATH}") # restore variable set(PYTHON_INSTALL_DIR "${_PYTHON_INSTALL_DIR}") endif() endmacro() macro(_ament_cmake_python_get_python_install_dir) if(NOT DEFINED PYTHON_INSTALL_DIR) # avoid storing backslash in cached variable since CMake will interpret it as escape character set(_python_code "from distutils.sysconfig import get_python_lib" "import os" "print(os.path.relpath(get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'), start='${CMAKE_INSTALL_PREFIX}').replace(os.sep, '/'))" ) get_executable_path(_python_interpreter Python3::Interpreter CONFIGURE) execute_process( COMMAND "${_python_interpreter}" "-c" "${_python_code}" OUTPUT_VARIABLE _output RESULT_VARIABLE _result OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT _result EQUAL 0) message(FATAL_ERROR "execute_process(${_python_interpreter} -c '${_python_code}') returned " "error code ${_result}") endif() set(PYTHON_INSTALL_DIR "${_output}" CACHE INTERNAL "The directory for Python library installation. This needs to be in PYTHONPATH when 'setup.py install' is called.") endif() endmacro() include("${ament_cmake_python_DIR}/ament_python_install_module.cmake") include("${ament_cmake_python_DIR}/ament_python_install_package.cmake") include("${ament_cmake_python_DIR}/ament_get_python_install_dir.cmake") ament_cmake-1.3.0/ament_cmake_python/cmake/000077500000000000000000000000001420356112300207015ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_python/cmake/ament_get_python_install_dir.cmake000066400000000000000000000021701420356112300276330ustar00rootroot00000000000000# Copyright 2014-2020 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. # # Get the Python installation directory. # # :param python_install_dir_out: this var will be populated with the path to the # Python installation directory. # :type package_name: string # function(ament_get_python_install_dir python_install_dir_out) _ament_cmake_python_get_python_install_dir() if(NOT PYTHON_INSTALL_DIR) message(FATAL_ERROR "ament_get_python_install_dir() variable " "'PYTHON_INSTALL_DIR' must not be empty") endif() set(${python_install_dir_out} ${PYTHON_INSTALL_DIR} PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_python/cmake/ament_python_install_module.cmake000066400000000000000000000055121420356112300275060ustar00rootroot00000000000000# 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. # # Install a Python module. # # :param module_file: the Python module file # :type MODULE_FILE: string # :param DESTINATION_SUFFIX: the base package to install the module to # (default: empty, install as a top level module) # :type DESTINATION_SUFFIX: string # :param SKIP_COMPILE: if set do not compile the installed module # :type SKIP_COMPILE: option # macro(ament_python_install_module) _ament_cmake_python_register_environment_hook() _ament_cmake_python_install_module(${ARGN}) endmacro() function(_ament_cmake_python_install_module module_file) cmake_parse_arguments(ARG "SKIP_COMPILE" "DESTINATION_SUFFIX" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_python_install_module() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT IS_ABSOLUTE "${module_file}") set(module_file "${CMAKE_CURRENT_LIST_DIR}/${module_file}") endif() if(NOT EXISTS "${module_file}") message(FATAL_ERROR "ament_python_install_module() the Python module file " "'${module_file}' doesn't exist") endif() if(NOT PYTHON_INSTALL_DIR) message(FATAL_ERROR "ament_python_install_module() variable " "'PYTHON_INSTALL_DIR' must not be empty") endif() set(destination "${PYTHON_INSTALL_DIR}") if(ARG_DESTINATION_SUFFIX) set(destination "${destination}/${ARG_DESTINATION_SUFFIX}") endif() install( FILES "${module_file}" DESTINATION "${destination}" ) get_filename_component(module_file "${module_file}" NAME) if(NOT ARG_SKIP_COMPILE) get_executable_path(python_interpreter Python3::Interpreter CONFIGURE) # compile Python files install(CODE "execute_process( COMMAND \"${python_interpreter}\" \"-m\" \"compileall\" \"${CMAKE_INSTALL_PREFIX}/${destination}/${module_file}\" )" ) endif() if(destination IN_LIST AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES) message(FATAL_ERROR "ament_python_install_module() a Python module file " "or package with the same name '${destination}' has been installed before") endif() list(APPEND AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES "${destination}") set(AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES "${AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_python/cmake/ament_python_install_package.cmake000066400000000000000000000156621420356112300276230ustar00rootroot00000000000000# 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. # # Install a Python package (and its recursive subpackages) # # :param package_name: the Python package name # :type package_name: string # :param PACKAGE_DIR: the path to the Python package directory (default: # folder relative to the CMAKE_CURRENT_LIST_DIR) # :type PACKAGE_DIR: string # :param VERSION: the Python package version (default: package.xml version) # :param VERSION: string # :param SETUP_CFG: the path to a setup.cfg file (default: # setup.cfg file at CMAKE_CURRENT_LIST_DIR root, if any) # :param SETUP_CFG: string # :param DESTINATION: the path to the Python package installation # directory (default: PYTHON_INSTALL_DIR) # :type DESTINATION: string # :param SCRIPTS_DESTINATION: the path to the Python package scripts' # installation directory, scripts (if any) will be ignored if not set # :type SCRIPTS_DESTINATION: string # :param SKIP_COMPILE: if set do not byte-compile the installed package # :type SKIP_COMPILE: option # macro(ament_python_install_package) _ament_cmake_python_register_environment_hook() _ament_cmake_python_install_package(${ARGN}) endmacro() function(_ament_cmake_python_install_package package_name) cmake_parse_arguments( ARG "SKIP_COMPILE" "PACKAGE_DIR;VERSION;SETUP_CFG;DESTINATION;SCRIPTS_DESTINATION" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_python_install_package() called with unused " "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_PACKAGE_DIR) set(ARG_PACKAGE_DIR "${CMAKE_CURRENT_LIST_DIR}/${package_name}") endif() if(NOT IS_ABSOLUTE "${ARG_PACKAGE_DIR}") set(ARG_PACKAGE_DIR "${CMAKE_CURRENT_LIST_DIR}/${ARG_PACKAGE_DIR}") endif() if(NOT ARG_VERSION) # Use package.xml version if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() set(ARG_VERSION "${${PROJECT_NAME}_VERSION}") endif() if(NOT EXISTS "${ARG_PACKAGE_DIR}/__init__.py") message(FATAL_ERROR "ament_python_install_package() the Python package " "folder '${ARG_PACKAGE_DIR}' doesn't contain an '__init__.py' file") endif() if(NOT ARG_SETUP_CFG) if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/setup.cfg") set(ARG_SETUP_CFG "${CMAKE_CURRENT_LIST_DIR}/setup.cfg") endif() elseif(NOT IS_ABSOLUTE "${ARG_SETUP_CFG}") set(ARG_SETUP_CFG "${CMAKE_CURRENT_LIST_DIR}/${ARG_SETUP_CFG}") endif() if(NOT ARG_DESTINATION) if(NOT PYTHON_INSTALL_DIR) message(FATAL_ERROR "ament_python_install_package() variable " "'PYTHON_INSTALL_DIR' must not be empty") endif() set(ARG_DESTINATION ${PYTHON_INSTALL_DIR}) endif() set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_python/${package_name}") string(CONFIGURE "\ from setuptools import find_packages from setuptools import setup setup( name='${package_name}', version='${ARG_VERSION}', packages=find_packages( include=('${package_name}', '${package_name}.*')), ) " setup_py_content) file(GENERATE OUTPUT "${build_dir}/setup.py" CONTENT "${setup_py_content}" ) if(AMENT_CMAKE_SYMLINK_INSTALL) add_custom_target( ament_cmake_python_symlink_${package_name} COMMAND ${CMAKE_COMMAND} -E create_symlink "${ARG_PACKAGE_DIR}" "${build_dir}/${package_name}" ) set(egg_dependencies ament_cmake_python_symlink_${package_name}) if(ARG_SETUP_CFG) add_custom_target( ament_cmake_python_symlink_${package_name}_setup COMMAND ${CMAKE_COMMAND} -E create_symlink "${ARG_SETUP_CFG}" "${build_dir}/setup.cfg" ) list(APPEND egg_dependencies ament_cmake_python_symlink_${package_name}_setup) endif() else() add_custom_target( ament_cmake_python_copy_${package_name} COMMAND ${CMAKE_COMMAND} -E copy_directory "${ARG_PACKAGE_DIR}" "${build_dir}/${package_name}" ) set(egg_dependencies ament_cmake_python_copy_${package_name}) if(ARG_SETUP_CFG) add_custom_target( ament_cmake_python_copy_${package_name}_setup COMMAND ${CMAKE_COMMAND} -E copy "${ARG_SETUP_CFG}" "${build_dir}/setup.cfg" ) list(APPEND egg_dependencies ament_cmake_python_copy_${package_name}_setup) endif() endif() get_executable_path(python_interpreter Python3::Interpreter BUILD) add_custom_target( ament_cmake_python_build_${package_name}_egg ALL COMMAND ${python_interpreter} setup.py egg_info WORKING_DIRECTORY "${build_dir}" DEPENDS ${egg_dependencies} ) set(python_version "py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") set(egg_name "${package_name}") set(egg_install_name "${egg_name}-${ARG_VERSION}") set(egg_install_name "${egg_install_name}-${python_version}") install( DIRECTORY "${build_dir}/${egg_name}.egg-info/" DESTINATION "${ARG_DESTINATION}/${egg_install_name}.egg-info" ) if(ARG_SCRIPTS_DESTINATION) file(MAKE_DIRECTORY "${build_dir}/scripts") # setup.py may or may not create it add_custom_target( ament_cmake_python_build_${package_name}_scripts ALL COMMAND ${python_interpreter} setup.py install_scripts -d scripts WORKING_DIRECTORY "${build_dir}" DEPENDS ${egg_dependencies} ) if(NOT AMENT_CMAKE_SYMLINK_INSTALL) # Not needed for nor supported by symlink installs set(_extra_install_args USE_SOURCE_PERMISSIONS) endif() install( DIRECTORY "${build_dir}/scripts/" DESTINATION "${ARG_SCRIPTS_DESTINATION}/" ${_extra_install_args} ) endif() install( DIRECTORY "${ARG_PACKAGE_DIR}/" DESTINATION "${ARG_DESTINATION}/${package_name}" PATTERN "*.pyc" EXCLUDE PATTERN "__pycache__" EXCLUDE ) if(NOT ARG_SKIP_COMPILE) get_executable_path(python_interpreter_config Python3::Interpreter CONFIGURE) # compile Python files install(CODE "execute_process( COMMAND \"${python_interpreter_config}\" \"-m\" \"compileall\" \"${CMAKE_INSTALL_PREFIX}/${ARG_DESTINATION}/${package_name}\" )" ) endif() if(package_name IN_LIST AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES) message(FATAL_ERROR "ament_python_install_package() a Python module file or package with " "the same name '${package_name}' has been installed before") endif() list(APPEND AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES "${package_name}") set(AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES "${AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES}" PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_python/package.xml000066400000000000000000000013561420356112300217430ustar00rootroot00000000000000 ament_cmake_python 1.3.0 The ability to use Python in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_target_dependencies/000077500000000000000000000000001420356112300222745ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_target_dependencies/CHANGELOG.rst000066400000000000000000000142121420356112300243150ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_target_dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Fix bug packages with multiple configurations (`#318 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Force SYSTEM keyword in ament_target_dependencies() at the start. (`#303 `_) * Add SYSTEM keyword option to ament_target_dependencies (`#297 `_) * Add SYSTEM keyword option to ament_target_dependencies * Add documentation of SYSTEM keyword for ament_target_dependencies * Update package maintainers. (`#286 `_) * Contributors: Andre Nguyen, Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ * ordered interface include dirs and use privately to ensure workspace order (`#260 `_) * Contributors: Dirk Thomas 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ * add ament_get_recursive_properties (`#259 `_) * add ament_get_recursive_properties * fix spelling in docblock * Contributors: Dirk Thomas 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ * redo use _TARGETS over deprecated _INTERFACES over classic CMake variables (`#251 `_) * redo use _TARGETS over deprecated _INTERFACES over classic CMake variables * update ament_export_dependencies accordingly * also add IMPORTED_LOCATION to the libraries * simplify conditions * consider IMPORTED_IMPLIB for Windows * Contributors: Dirk Thomas 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Revert "use _TARGETS over deprecated _INTERFACES over classic CMake variables (`#249 `_)" (`#250 `_) This reverts commit 1abe330837cf98632225e4af23ac610af863fb3e. * use _TARGETS over deprecated _INTERFACES over classic CMake variables (`#249 `_) * use _TARGETS over deprecated _INTERFACES over classic CMake variables * fix spelling of variable * interface targets don't support compile definitions and LINK_FLAGS (`#247 `_) * Handle non-library tokens in _LIBRARIES. (`#248 `_) * Handle non-library tokens in _LIBRARIES. * Drop spaces on clauses. * Use _LIBRARY_DIRS in ament_target_dependencies() (`#245 `_) * add INTERFACE option to ament_target_dependencies() (`#246 `_) * use modern interface targets if available, otherwise classic variables (`#235 `_) * use modern interface targets if available, otherwise classic variables, support interface keyword * remove INTERFACE keyword for now * consider exported interfaces in ament_target_dependencies (`#232 `_) * Contributors: Dirk Thomas, Michel Hidalgo 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * Quote variable to avoid odd cmake if behavior (`#180 `_) * Contributors: Shane Loretz 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ * Added PUBLIC option to ament_target_dependencies (`#161 `_) * Added PUBLIC option to ament_target_dependencies * Corrected with PR comments. * simplify patch * Contributors: ivanpauno 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * 0.0.3 * 0.0.2 * Merge pull request `#71 `_ from ament/export_link_flags add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * add ament_cmake_export_link_flags package and use link flags in ament_target_dependencies * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * require CMake 3.5 * add explicit build type * disable debug output * add missing copyright / license information, update format of existing license information * Merge pull request `#3 `_ from ament/windows Windows Support * [windows] fixed installation of dll's * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * add ament_cmake_include_directories * add ament_cmake_libraries * add ament_cmake_target_dependencies * Contributors: Dirk Thomas, William Woodall ament_cmake-1.3.0/ament_cmake_target_dependencies/CMakeLists.txt000066400000000000000000000004201420356112300250300ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_target_dependencies NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_target_dependencies-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_target_dependencies/ament_cmake_target_dependencies-extras.cmake000066400000000000000000000020061420356112300331200ustar00rootroot00000000000000# 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. # copied from # ament_cmake_target_dependencies/ament_cmake_target_dependencies-extras.cmake find_package(ament_cmake_core QUIET REQUIRED) find_package(ament_cmake_include_directories QUIET REQUIRED) find_package(ament_cmake_libraries QUIET REQUIRED) include( "${ament_cmake_target_dependencies_DIR}/ament_get_recursive_properties.cmake") include( "${ament_cmake_target_dependencies_DIR}/ament_target_dependencies.cmake") ament_cmake-1.3.0/ament_cmake_target_dependencies/cmake/000077500000000000000000000000001420356112300233545ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_target_dependencies/cmake/ament_get_recursive_properties.cmake000066400000000000000000000054731420356112300326750ustar00rootroot00000000000000# Copyright 2020 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. # # Get the recursive include directories and libraries from interface targets. # # :param var_include_dirs: the output variable name # :type var_include_dirs: string # :param var_libraries: the output variable name # :type var_libraries: string # :param ARGN: a list of interface targets # :type ARGN: list of strings # # @public # function(ament_get_recursive_properties var_include_dirs var_libraries) set(all_include_dirs "") set(all_libraries "") if(${ARGC} GREATER 0) foreach(target ${ARGN}) # only use actual targets if(NOT TARGET "${target}") continue() endif() get_target_property(include_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES) if(include_dirs) list_append_unique(all_include_dirs "${include_dirs}") endif() get_target_property(link_libraries ${target} INTERFACE_LINK_LIBRARIES) if(link_libraries) foreach(link_library ${link_libraries}) if(TARGET "${link_library}") ament_get_recursive_properties(include_dirs libraries "${link_library}") list_append_unique(all_include_dirs "${include_dirs}") list_append_unique(all_libraries "${libraries}") else() list(APPEND all_libraries ${link_library}) endif() endforeach() endif() get_target_property(imported_configurations ${target} IMPORTED_CONFIGURATIONS) if(imported_configurations) foreach(imported_config ${imported_configurations}) get_target_property(imported_implib ${target} IMPORTED_IMPLIB_${imported_config}) if(imported_implib) list(APPEND all_libraries "${imported_implib}") else() get_target_property(imported_location ${target} IMPORTED_LOCATION_${imported_config}) if(imported_location) list(APPEND all_libraries "${imported_location}") endif() endif() endforeach() endif() endforeach() ament_include_directories_order(ordered_include_dirs ${all_include_dirs}) ament_libraries_deduplicate(unique_libraries ${all_libraries}) endif() set(${var_include_dirs} ${ordered_include_dirs} PARENT_SCOPE) set(${var_libraries} ${unique_libraries} PARENT_SCOPE) endfunction() ament_cmake-1.3.0/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake000066400000000000000000000152371420356112300315460ustar00rootroot00000000000000# Copyright 2014-2020 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. # # Add the interface targets or definitions, include directories and libraries # of packages to a target. # # Each package name must have been find_package()-ed before. # Additionally the exported variables must have a prefix with the same case # and the suffixes must be either _INTERFACES or _DEFINITIONS, _INCLUDE_DIRS, # _LIBRARIES, _LIBRARY_DIRS, and _LINK_FLAGS. # If _INTERFACES is not empty it will be used exclusively, otherwise the other # variables are being used. # If _LIBRARY_DIRS is not empty, _LIBRARIES which are not absolute paths already # will be searched in those directories and their absolute paths will be used instead. # # :param target: the target name # :type target: string # :param ARGN: a list of package names, which can optionally start # with a SYSTEM keyword, followed by an INTERFACE or PUBLIC keyword. # If it starts with a SYSTEM keyword, it will be used in # target_include_directories() calls. # If it starts (or follows) with an INTERFACE or PUBLIC keyword, # this keyword will be used in the target_*() calls. # :type ARGN: list of strings # # @public # function(ament_target_dependencies target) if(NOT TARGET ${target}) message(FATAL_ERROR "ament_target_dependencies() the first argument must be a valid target name") endif() if(${ARGC} GREATER 0) cmake_parse_arguments(ARG "INTERFACE;PUBLIC;SYSTEM" "" "" ${ARGN}) set(ARGVIND 1) set(system_keyword "") set(optional_keyword "") set(required_keyword "PUBLIC") if(ARG_SYSTEM) if(NOT "${ARGV${ARGVIND}}" STREQUAL "SYSTEM") message(FATAL_ERROR "ament_target_dependencies() SYSTEM keyword is only allowed before the package names and other keywords") endif() set(system_keyword SYSTEM) math(EXPR ARGVIND "${ARGVIND} + 1") endif() if(ARG_INTERFACE) if(NOT "${ARGV${ARGVIND}}" STREQUAL "INTERFACE") message(FATAL_ERROR "ament_target_dependencies() INTERFACE keyword is only allowed before the package names") endif() set(optional_keyword INTERFACE) set(required_keyword INTERFACE) endif() if(ARG_PUBLIC) if(NOT "${ARGV${ARGVIND}}" STREQUAL "PUBLIC") message(FATAL_ERROR "ament_target_dependencies() PUBLIC keyword is only allowed before the package names") endif() set(optional_keyword PUBLIC) endif() set(definitions "") set(include_dirs "") set(interfaces "") set(libraries "") set(link_flags "") foreach(package_name ${ARG_UNPARSED_ARGUMENTS}) if(NOT "${${package_name}_FOUND}") message(FATAL_ERROR "ament_target_dependencies() the passed package name '${package_name}' was not found before") endif() # if a package provides modern CMake interface targets use them # exclusively assuming the classic CMake variables only exist for # backward compatibility set(use_modern_cmake FALSE) if(NOT "${${package_name}_TARGETS}" STREQUAL "") foreach(_target ${${package_name}_TARGETS}) # only use actual targets # in case a package uses this variable for other content if(TARGET "${_target}") list_append_unique(interfaces ${_target}) set(use_modern_cmake TRUE) endif() endforeach() endif() if(NOT use_modern_cmake AND NOT "${${package_name}_INTERFACES}" STREQUAL "") foreach(_interface ${${package_name}_INTERFACES}) # only use actual targets # in case a package uses this variable for other content if(TARGET "${_interface}") list_append_unique(interfaces ${_interface}) set(use_modern_cmake TRUE) endif() endforeach() if(use_modern_cmake) message(DEPRECATION "Package ${package_name} is exporting the variable " "${package_name}_INTERFACES which is deprecated, it should export ${package_name}_TARGETS instead") endif() endif() if(NOT use_modern_cmake) # otherwise use the classic CMake variables list_append_unique(definitions ${${package_name}_DEFINITIONS}) list_append_unique(include_dirs ${${package_name}_INCLUDE_DIRS}) foreach(library ${${package_name}_LIBRARIES}) if(NOT "${${package_name}_LIBRARY_DIRS}" STREQUAL "") if(NOT IS_ABSOLUTE ${library} OR NOT EXISTS ${library}) find_library(lib NAMES ${library} PATHS ${${package_name}_LIBRARY_DIRS} NO_DEFAULT_PATH) if(lib) set(library ${lib}) endif() endif() endif() list(APPEND libraries ${library}) endforeach() list_append_unique(link_flags ${${package_name}_LINK_FLAGS}) endif() endforeach() if(NOT ARG_INTERFACE) target_compile_definitions(${target} ${required_keyword} ${definitions}) # the interface include dirs must be ordered set(interface_include_dirs) foreach(interface ${interfaces}) get_target_property(_include_dirs ${interface} INTERFACE_INCLUDE_DIRECTORIES) if(_include_dirs) list_append_unique(interface_include_dirs ${_include_dirs}) endif() endforeach() ament_include_directories_order(ordered_interface_include_dirs ${interface_include_dirs}) # the interface include dirs are used privately to ensure proper order # and the interfaces cover the public case target_include_directories(${target} ${system_keyword} PRIVATE ${ordered_interface_include_dirs}) endif() ament_include_directories_order(ordered_include_dirs ${include_dirs}) target_link_libraries(${target} ${optional_keyword} ${interfaces}) target_include_directories(${target} ${system_keyword} ${required_keyword} ${ordered_include_dirs}) if(NOT ARG_INTERFACE) ament_libraries_deduplicate(unique_libraries ${libraries}) target_link_libraries(${target} ${optional_keyword} ${unique_libraries}) foreach(link_flag IN LISTS link_flags) set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${link_flag} ") endforeach() endif() endif() endfunction() ament_cmake-1.3.0/ament_cmake_target_dependencies/package.xml000066400000000000000000000017341420356112300244160ustar00rootroot00000000000000 ament_cmake_target_dependencies 1.3.0 The ability to add definitions, include directories and libraries of a package to a target in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake_include_directories ament_cmake_libraries ament_cmake ament_cmake-1.3.0/ament_cmake_test/000077500000000000000000000000001420356112300172575ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_test/CHANGELOG.rst000066400000000000000000000335031420356112300213040ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_test ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Resolve various ament_lint linter violations (`#360 `_) We can't add ament_lint linters in ament_cmake in the traditional way without creating a circular dependency between the repositories. Even though we can't automatically enforce linting, it's still a good idea to try to keep conformance where possible. * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash, Scott K Logan 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ * Fix skipped test reporting in CTest (`#279 `_) This is a follow-up to c67cdf2. When the SKIP_RETURN_CODE gets set to 0, the value is interpreted as 'false', and the test property is never actually added. * limit test time to three decimals (`#271 `_) * Add actual test time to xUnit result files (`#270 `_) * Add actual test time to xUnit result files Fixes `#269 `_ * Report test_time even with skipped test * Set time attribute for testcase element * Contributors: Dirk Thomas, Ruffin, Scott K Logan 1.0.0 (2020-07-22) ------------------ * Add SKIP_RETURN_CODE argument to ament_add_test (`#264 `_) This makes the `run_test.py` wrapper aware of the `SKIP_RETURN_CODE` property on CTest tests. In the existing implementation, the wrapper detects that no result file was generated and overrides the special return code coming from the test, making the the CTest feature fail completely. This change makes the wrapper script aware of the special return code, and when detected, will write a 'skipped' result file instead of a 'failed' result file, and pass along the special return code as-is. Now the gtest result and the ctest results both show the test as 'skipped' when the special return flag is used. Note that none of this behavior is enabled by default, which is important because we wouldn't want a test to fail and return a code which we've decided is the special 'skip' return code. Only tests which are aware of this feature should use it. * Contributors: Scott K Logan 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ * Merge pull request `#253 `_ from ament/use_errors_tag2 Use errors attribute for problems when testing code (take II) * Error message needs to be inside its own XML tag according to XSD * Use DEPRECATION instead of WARNING for package deprecation messages This makes it possible to treat the warnings differently in downstream packages. Refer to the CMake documentation for more info: https://cmake.org/cmake/help/v3.0/command/message.html * Contributors: Jose Luis Rivero 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ * Fix parallel testing (`#254 `_) * Fix parallel testing We ran ctest . -j 10, and sometimes it happened that we got failing CI builds because the command in line 116 was executed in parallel. ``` [2020-04-28T19:13:39.193Z] 1: Traceback (most recent call last): [2020-04-28T19:13:39.193Z] 1: File "/opt/ros/eloquent/share/ament_cmake_test/cmake/run_test.py", line 23, in [2020-04-28T19:13:39.193Z] 1: sys.exit(ament_cmake_test.main()) [2020-04-28T19:13:39.193Z] 1: File "/opt/ros/eloquent/lib/python3.6/site-packages/ament_cmake_test/__init_\_.py", line 116, in main [2020-04-28T19:13:39.193Z] 1: os.makedirs(output_path) [2020-04-28T19:13:39.193Z] 1: File "/usr/lib/python3.6/os.py", line 220, in makedirs [2020-04-28T19:13:39.193Z] 1: mkdir(name, mode) [2020-04-28T19:13:39.193Z] 1: FileExistsError: [Errno 17] File exists: 'some_dir/build/x86_debug/ros2/build_docker/functions/ament_cmake_gtest' ``` * remove condition * Contributors: Florian Berchtold 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Report skipped tests in CTest output (`#243 `_) When adding a test using `ament_add_test`, the `SKIP_TEST` argument results in the `--skip-test` argument being passed to the test wrapper script `run_test.py`. The wrapper script then writes a JUnit output describing that the test was skipped, and returns 0. As far as CTest knows, the test succeeded and shows `Passed` on the console. However, since we know that the test will be skipped by the wrapper, and we expect the wrapper to return 0 after it writes the JUnit file, we can set a test property that will mark the test as `Skipped` when the wrapper returns 0. This way, the JUnit output file is still written, but CTest displays the test as skipped as well. * Drop duplicated element in result file (`#242 `_) The `` element was actually added as part of the `skipped_message` several lines earlier. While multiple `` elements doesn't violate the JUnit schema, there is no reason to have more than one. * add CMake function ament_add_test_label() (`#240 `_) * Merge pull request `#225 `_ from ament/junit10_xsd Generate xunit files valid for the junit10.xsd * Generate xunit files valid for the junit10.xsd * Declare AMENT_TEST_RESULTS_DIR as a PATH (`#221 `_) * remove status attribute from result XML, add skipped tag instead (`#218 `_) * Run tests in current binary directory, not global source directory (`#206 `_) Switch to CMAKE_CURRENT_BINARY_DIR for consistency with CTest * Contributors: Dan Rose, Dirk Thomas, Jose Luis Rivero, Scott K Logan 0.8.1 (2019-10-23) ------------------ 0.8.0 (2019-10-04) ------------------ * use deterministic order for updated env vars (`#196 `_) * improve handling of encoding (`#181 `_) * Add runner option to ament_add_test (`#174 `_) * ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID * ament_cmake move run_test.py to a python module - This should let us see the history * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package * Contributors: Dirk Thomas, Peter Baughman 0.7.3 (2019-05-29) ------------------ * close output_handle explicitly (`#171 `_) * Contributors: Dirk Thomas 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ * Fix typo (`#163 `_) * use enable_testing() insted of CTest module (`#153 `_) use enable_testing() instead of CTest module * Contributors: Dirk Thomas, Esteve Fernandez 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ * Merge pull request `#117 `_ from ament/gtest_classname inject classname for gtest result files * inject classname for gtest result files * 0.0.3 * Merge pull request `#107 `_ from ament/flake8_plugins update style to satisfy new flake8 plugins * update style to satisfy new flake8 plugins * Merge pull request `#101 `_ from ament/pass_env_with_list_value merge env values which were split on semicolons * print set env message all at once (`#102 `_) * print set env message all at once * address comments * merge env values which were split on semicolons * 0.0.2 * Merge pull request `#86 `_ from ament/remove_include remove unnecessary include * remove unnecessary include * Merge pull request `#85 `_ from ament/split_gtest_function Split ament_add_gtest function * add doc for SKIP_TEST * remove __future_\_ imports * Skipped tests (`#80 `_) * support skipping tests * add SKIP_TEST to ament_add_nose_test * use keyword args not positional * discard positional args after first * update schema url * add schema to manifest files * Merge pull request `#72 `_ from ament/cmake35 require CMake 3.5 * require CMake 3.5 * Merge pull request `#68 `_ from ament/ctest_build_testing use CTest BUILD_TESTING * use CTest BUILD_TESTING * generate all ament index markers into /ament_index_preinstall * use compliant layout for index resources in build space and allow using those * fix optional arguments of ament_index_register_package * allow to skip the AMENT_PREFIX_PATH and / or the folder in the binary dir * fix error handling error * allow overriding default prefix path for ament index CMake API * undo any ; -> \; substitution done to pass PATH lists on Windows * only replace : with ; when no on Windows * Merge pull request `#53 `_ from ament/library_path_env_var change CMake logic to determine env var name for library path * Merge pull request `#54 `_ from ament/test_working_dir support WORKING_DIRECTORY in ament_add_nose_test * fix WORKING_DIRECTORY for ament_add_gtest/gmock * change CMake logic to determine env var name for library path * follow fixes from `#52 `_ * Merge pull request `#52 `_ from ament/add_test_append_env_option add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * add APPEND_ENV and APPEND_LIBRARY_DIRS options to ament_add\_*test macros * Merge pull request `#50 `_ from ament/pass_extra_env_to_tests add option to pass extra env to ament_add\_*test * minor style change, changing split logic * addressing comments * Merge pull request `#48 `_ from ament/verify_tidy_all_result_files verify and tidy all result files * add option to pass extra env to ament_add\_*test * verify and tidy all result files * Merge pull request `#32 `_ from ament/change_missing_result_file move '.missing_result' suffix from testsuite name to testcase name * move '.missing_result' suffix from testsuite name to testcase name * Merge pull request `#28 `_ from ament/gtest_location fix location of gtest / gmock executables on Windows * add type as extension to test result files * never truncate ctest dashboard summary * Merge pull request `#24 `_ from ament/test_repeated_publisher_subscriber change reading from proc, add invoked command as well as return code / exception to output file * change reading from proc, also write all printed messages to output file * Merge pull request `#19 `_ from ament/improve_test_runner improve test runner * improve test runner * add explicit build type * improve reporting of failing tests and tests missing a result file * disable debug output * Merge pull request `#10 `_ from ament/always_print_test_output always print test output to console * always print test output to console * add missing copyright / license information, update format of existing license information * Merge pull request `#7 `_ from ament/test_runner_windows change test runner to work on windows * change test runner to work on windows * use project(.. NONE) * refactor several low-level packages into ament_cmake_core (environment, environment_hooks, index, package_templates, symlink_install) * invert dependency between ament_cmake_environment and ament_cmake_environment_hooks, add dependency on ament_cmake_environment * deal with CMake double expansion * update cmake code style * minor fixes * add ament_cmake_environment_hooks * add ament_cmake_test, ament_cmake_gtest, ament_cmake_nose * Contributors: Dirk Thomas, Mikael Arguedas, William Woodall ament_cmake-1.3.0/ament_cmake_test/CMakeLists.txt000066400000000000000000000005131420356112300220160ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_test NONE) find_package(ament_cmake_core REQUIRED) find_package(ament_cmake_python REQUIRED) ament_python_install_package(${PROJECT_NAME}) ament_package( CONFIG_EXTRAS "ament_cmake_test-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_test/ament_cmake_test-extras.cmake000066400000000000000000000027571420356112300251030ustar00rootroot00000000000000# 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. # copied from ament_cmake_test/ament_cmake_test-extras.cmake enable_testing() # same option as in the CTest module option(BUILD_TESTING "Build the testing tree." ON) # option() set( AMENT_TEST_RESULTS_DIR "${CMAKE_BINARY_DIR}/test_results" CACHE PATH "The path where test results are generated" ) if(BUILD_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() find_package(ament_cmake_core QUIET REQUIRED) include("${ament_cmake_test_DIR}/ament_add_test.cmake") include("${ament_cmake_test_DIR}/ament_add_test_label.cmake") ament_cmake-1.3.0/ament_cmake_test/ament_cmake_test/000077500000000000000000000000001420356112300225625ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_test/ament_cmake_test/__init__.py000066400000000000000000000353721420356112300247050ustar00rootroot00000000000000# 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. import argparse import codecs import errno import locale import os import re import subprocess import sys import time from xml.etree.ElementTree import ElementTree from xml.etree.ElementTree import ParseError from xml.sax.saxutils import quoteattr def separate_env_vars(env_str, env_argument_name, parser): try: index = env_str.index('=') except ValueError: parser.error("--%s argument '%s' contains no equal sign" % (env_argument_name, env_str)) key = env_str[0:index] value = env_str[index + 1:] return key, value def return_code(value): value = int(value) if value < 0 or value > 255: raise argparse.ArgumentTypeError( 'Return code must be less than 256 and greater or equal to 0') return value def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser( description='Run the test command passed as an argument and ensures' 'that the expected result file is generated.') parser.add_argument( 'result_file', help='The path to the xunit result file') parser.add_argument( '--package-name', help="The package name to be used as a prefix for the 'classname' " 'attributes in gtest result files') parser.add_argument( '--command', nargs='+', help='The test command to execute. ' 'It must be passed after other arguments since it collects all ' 'following options.') parser.add_argument( '--env', nargs='+', help='Extra environment variables to set when running, e.g. FOO=foo BAR=bar') parser.add_argument( '--append-env', nargs='+', help='Extra environment variables to append, or set, when running, e.g. FOO=foo BAR=bar') parser.add_argument( '--output-file', help='The path to the output log file') parser.add_argument( '--generate-result-on-success', action='store_true', default=False, help='Generate a result file if the command returns with code zero') parser.add_argument( '--skip-test', action='store_true', default=False, help='Skip the test') parser.add_argument( '--skip-return-code', type=return_code, help="If the test returns this value and doesn't generate a result file, " 'create one stating that the test was skipped.') if '--command' in argv: index = argv.index('--command') argv, command = argv[0:index + 1] + ['dummy'], argv[index + 1:] args = parser.parse_args(argv) args.command = command # if result file exists remove it before test execution if os.path.exists(args.result_file): os.remove(args.result_file) # create folder if necessary if not os.path.exists(os.path.dirname(args.result_file)): try: os.makedirs(os.path.dirname(args.result_file)) except OSError as e: # catch case where folder has been created in the mean time if e.errno != errno.EEXIST: raise if args.skip_test: # generate a skipped test result file skipped_result_file = _generate_result(args.result_file, skip=True) with open(args.result_file, 'w') as h: h.write(skipped_result_file) return 0 # generate result file with one failed test # in case the command segfaults or timeouts and does not generate one failure_result_file = _generate_result( args.result_file, error_message='The test did not generate a result file.') with open(args.result_file, 'w') as h: h.write(failure_result_file) # collect output / exception to generate more detailed result file # if the command fails to generate it output_handle = None if args.output_file: output_path = os.path.dirname(args.output_file) os.makedirs(output_path, exist_ok=True) output_handle = open(args.output_file, 'wb') try: return _run_test(parser, args, failure_result_file, output_handle) finally: if output_handle: output_handle.close() def _run_test(parser, args, failure_result_file, output_handle): output = '' def log(msg, **kwargs): print(msg, **kwargs) if output_handle: output_handle.write((msg + '\n').encode()) output_handle.flush() env = None if args.env or args.append_env: env = dict(os.environ) if args.env: log('-- run_test.py: extra environment variables:') previous_key = None updated_env_keys = set() for env_str in args.env: # if CMake has split a single value containing semicolons # into multiple arguments they are put back together here if previous_key and '=' not in env_str: key = previous_key value = env[key] + ';' + env_str else: key, value = separate_env_vars(env_str, 'env', parser) env[key] = value updated_env_keys.add(key) previous_key = key for key in sorted(updated_env_keys): log(' - {0}={1}'.format(key, env[key])) if args.append_env: log('-- run_test.py: extra environment variables to append:') previous_key = None for env_str in args.append_env: # if CMake has split a single value containing semicolons # into multiple arguments they are put back together here if previous_key and '=' not in env_str: key = previous_key value = env[key] + ';' + env_str log(' - {0}+={1}'.format(key, env_str)) else: key, value = separate_env_vars(env_str, 'append-env', parser) log(' - {0}+={1}'.format(key, value)) if key not in env: env[key] = '' if not env[key].endswith(os.pathsep): env[key] += os.pathsep env[key] += value previous_key = key log("-- run_test.py: invoking following command in '%s':\n - %s" % (os.getcwd(), ' '.join(args.command))) if output_handle: output_handle.write('\n'.encode()) output_handle.flush() encodings = ['utf-8'] if locale.getpreferredencoding(False) not in encodings: encodings.append(locale.getpreferredencoding(False)) start_time = time.monotonic() try: proc = subprocess.Popen( args.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) while True: line = proc.stdout.readline() if not line: break for i, encoding in enumerate(encodings): try: decoded_line = line.decode(encoding) except UnicodeDecodeError: if i == len(encodings) - 1: raise else: break print(decoded_line, end='') output += decoded_line if output_handle: output_handle.write(decoded_line.encode()) output_handle.flush() proc.wait() rc = proc.returncode if output_handle: # separate progress of this script from subprocess output output_handle.write('\n\n'.encode()) log('-- run_test.py: return code ' + str(rc), file=sys.stderr if rc else sys.stdout) except Exception as e: if output_handle: # separate subprocess output from progress of this script output_handle.write('\n\n'.encode()) log('-- run_test.py: invocation failed: ' + str(e), file=sys.stderr) output += str(e) rc = 1 test_time = time.monotonic() - start_time if not rc and args.generate_result_on_success: # generate result file with one passed test # if it was expected that no result file was generated # and the command returned with code zero log("-- run_test.py: generate result file '%s' with successful test" % args.result_file) success_result_file = _generate_result(args.result_file, test_time=test_time) with open(args.result_file, 'w') as h: h.write(success_result_file) elif os.path.exists(args.result_file): # check if content of result file has actually changed with open(args.result_file, 'r', encoding='utf-8') as h: content = h.read() if content == failure_result_file: if args.skip_return_code is not None and args.skip_return_code == rc: log( '-- run_test.py: generate result file ' "'%s' with skipped test" % args.result_file) # regenerate result file to indicate that the test was skipped result_file = _generate_result(args.result_file, skip=True, test_time=test_time) else: log( '-- run_test.py: generate result file ' "'%s' with failed test" % args.result_file, file=sys.stderr) # regenerate result file to include output / exception of the invoked command result_file = _generate_result( args.result_file, error_message='The test did not generate a result file:\n\n' + output, test_time=test_time) with open(args.result_file, 'w') as h: h.write(result_file) else: # prefix classname attributes if args.result_file.endswith('.gtest.xml') and args.package_name: prefix = ' classname="' pattern = '%s(?!%s)' % (prefix, args.package_name) new_content = re.sub( pattern, prefix + args.package_name + '.', content) if new_content != content: log( '-- run_test.py: inject classname prefix into gtest ' "result file '%s'" % args.result_file) with open(args.result_file, 'w') as h: h.write(new_content) log("-- run_test.py: verify result file '%s'" % args.result_file) # if result file exists ensure that it contains valid xml # unit test suites are not good about screening out # illegal unicode characters tree = None try: tree = ElementTree(None, args.result_file) except ParseError as e: modified = _tidy_xml(args.result_file) if not modified: log("Invalid XML in result file '%s': %s" % (args.result_file, str(e)), file=sys.stderr) else: try: tree = ElementTree(None, args.result_file) except ParseError as e: log("Invalid XML in result file '%s' (even after trying to tidy it): %s" % (args.result_file, str(e)), file=sys.stderr) if not tree: # set error code when result file is not parsable rc = 1 else: # set error code when result file contains errors or failures root = tree.getroot() num_errors = int(root.attrib.get('errors', 0)) num_failures = int(root.attrib.get('failures', 0)) if num_errors or num_failures: rc = 1 # ensure that a result file exists at the end if not rc and not os.path.exists(args.result_file): log('-- run_test.py: override return code since no result file was ' 'generated', file=sys.stderr) rc = 1 return rc def _generate_result(result_file, *, failure_message=None, skip=False, error_message=None, test_time=0): # the generated result file must be readable # by any of the Jenkins test result report publishers pkgname = os.path.basename(os.path.dirname(result_file)) testname = os.path.splitext(os.path.basename(result_file))[0] error_message = '' % quoteattr(error_message) \ if error_message else '' failure_message = '' % quoteattr(failure_message) \ if failure_message else '' skipped_message = \ '![CDATA[Test Skipped by developer]]' \ if skip else '' return """ %s%s%s \n""" % \ ( pkgname, 1 if failure_message else 0, test_time, 1 if error_message else 0, 1 if skip else 0, pkgname, testname, test_time, failure_message, skipped_message, error_message ) def _tidy_xml(filename): assert os.path.isfile(filename) # try reading utf-8 first then iso # this is ugly but the files in question do not declare a unicode type data = None for encoding in ['utf-8', 'iso8859-1']: f = None try: f = codecs.open(filename, 'r', encoding) data = f.read() break except ValueError: continue finally: if f: f.close() if data is None: return False 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) for match in safe_xml_regex.finditer(data): data = data[:match.start()] + '?' + data[match.end():] with open(filename, 'w', encoding='utf-8') as h: h.write(data) return True ament_cmake-1.3.0/ament_cmake_test/cmake/000077500000000000000000000000001420356112300203375ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_test/cmake/ament_add_test.cmake000066400000000000000000000117051420356112300243200ustar00rootroot00000000000000# 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. # # Add a test. # # A test is expected to generate a JUnit result file # ${AMENT_TEST_RESULTS_DIR}/$PROJECT_NAME}/${testname}.xml. # Failing to do so is considered a failed test. # # :param testname: the name of the test # :type testname: string # :param COMMAND: the command including its arguments to invoke # :type COMMAND: list of strings # :param OUTPUT_FILE: the path of the file to pipe the output to # :type OUTPUT_FILE: string # :param RUNNER: the path to the test runner script (default: run_test.py). # :type RUNNER: string # :param TIMEOUT: the test timeout in seconds, default: 60 # :type TIMEOUT: integer # :param WORKING_DIRECTORY: the working directory for invoking the # command in, default: CMAKE_CURRENT_BINARY_DIR # :type WORKING_DIRECTORY: string # :param GENERATE_RESULT_FOR_RETURN_CODE_ZERO: generate a test result # file when the command invocation returns with code zero # command in, default: FALSE # :type GENERATE_RESULT_FOR_RETURN_CODE_ZERO: option # :param SKIP_TEST: if set mark the test as being skipped # :type SKIP_TEST: option # :param ENV: list of env vars to set; listed as ``VAR=value`` # :type ENV: list of strings # :param APPEND_ENV: list of env vars to append if already set, otherwise set; # listed as ``VAR=value`` # :type APPEND_ENV: list of strings # :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate # OS specific env var, a la LD_LIBRARY_PATH # :type APPEND_LIBRARY_DIRS: list of strings # :param SKIP_RETURN_CODE: return code signifying that the test has been # skipped and did not fail OR succeed # :type SKIP_RETURN_CODE: integer # # @public # function(ament_add_test testname) cmake_parse_arguments(ARG "GENERATE_RESULT_FOR_RETURN_CODE_ZERO;SKIP_TEST" "OUTPUT_FILE;RESULT_FILE;RUNNER;SKIP_RETURN_CODE;TIMEOUT;WORKING_DIRECTORY" "APPEND_ENV;APPEND_LIBRARY_DIRS;COMMAND;ENV" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "ament_add_test() called with unused arguments: " "${ARG_UNPARSED_ARGUMENTS}") endif() if(NOT ARG_COMMAND) message(FATAL_ERROR "ament_add_test() must be invoked with the COMMAND argument") endif() if(NOT ARG_RESULT_FILE) set(ARG_RESULT_FILE "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${testname}.xml") endif() if(NOT ARG_RUNNER) set(ARG_RUNNER "${ament_cmake_test_DIR}/run_test.py") endif() if(NOT ARG_TIMEOUT) set(ARG_TIMEOUT 60) endif() if(NOT ARG_TIMEOUT GREATER 0) message(FATAL_ERROR "ament_add_test() the TIMEOUT argument must be a " "valid number and greater than zero") endif() if(NOT ARG_WORKING_DIRECTORY) set(ARG_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endif() get_executable_path(python_interpreter Python3::Interpreter BUILD) # wrap command with run_test script to ensure test result generation set(cmd_wrapper "${python_interpreter}" "-u" "${ARG_RUNNER}" "${ARG_RESULT_FILE}" "--package-name" "${PROJECT_NAME}") if(ARG_SKIP_TEST) list(APPEND cmd_wrapper "--skip-test") set(ARG_SKIP_RETURN_CODE 0) elseif(ARG_SKIP_RETURN_CODE) list(APPEND cmd_wrapper "--skip-return-code" "${ARG_SKIP_RETURN_CODE}") endif() if(ARG_GENERATE_RESULT_FOR_RETURN_CODE_ZERO) list(APPEND cmd_wrapper "--generate-result-on-success") endif() if(ARG_OUTPUT_FILE) list(APPEND cmd_wrapper "--output-file" "${ARG_OUTPUT_FILE}") endif() if(ARG_ENV) list(APPEND cmd_wrapper "--env" ${ARG_ENV}) endif() if(ARG_APPEND_LIBRARY_DIRS) if(WIN32) set(_library_dirs_env_var "PATH") elseif(APPLE) set(_library_dirs_env_var "DYLD_LIBRARY_PATH") elseif(UNIX) set(_library_dirs_env_var "LD_LIBRARY_PATH") else() message(FATAL_ERROR "Unknown platform for environment variable to find libraries") endif() foreach(_dir ${ARG_APPEND_LIBRARY_DIRS}) list(APPEND ARG_APPEND_ENV "${_library_dirs_env_var}=${_dir}") endforeach() endif() if(ARG_APPEND_ENV) list(APPEND cmd_wrapper "--append-env" ${ARG_APPEND_ENV}) endif() list(APPEND cmd_wrapper "--command" ${ARG_COMMAND}) add_test( NAME "${testname}" COMMAND ${cmd_wrapper} WORKING_DIRECTORY "${ARG_WORKING_DIRECTORY}" ) set_tests_properties( "${testname}" PROPERTIES TIMEOUT ${ARG_TIMEOUT} ) if(DEFINED ARG_SKIP_RETURN_CODE) set_tests_properties( "${testname}" PROPERTIES SKIP_RETURN_CODE ${ARG_SKIP_RETURN_CODE} ) endif() endfunction() ament_cmake-1.3.0/ament_cmake_test/cmake/ament_add_test_label.cmake000066400000000000000000000017441420356112300254610ustar00rootroot00000000000000# Copyright 2020 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. # # Add text labels to the LABELS property of a test. # # :param testname: the name of the test # :type testname: string # :param ARGN: a list of labels # :type ARGN: list of strings # # @public # function(ament_add_test_label testname) get_test_property(${testname} LABELS labels) list(APPEND labels ${ARGN}) set_tests_properties(${testname} PROPERTIES LABELS "${labels}") endfunction() ament_cmake-1.3.0/ament_cmake_test/cmake/run_test.py000066400000000000000000000013361420356112300225570ustar00rootroot00000000000000#!/usr/bin/env python3 # 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. import sys import ament_cmake_test if __name__ == '__main__': sys.exit(ament_cmake_test.main()) ament_cmake-1.3.0/ament_cmake_test/package.xml000066400000000000000000000014451420356112300214000ustar00rootroot00000000000000 ament_cmake_test 1.3.0 The ability to add tests in the ament buildsystem in CMake. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_python ament_cmake_core ament_cmake ament_cmake-1.3.0/ament_cmake_version/000077500000000000000000000000001420356112300177655ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_version/CHANGELOG.rst000066400000000000000000000063231420356112300220120ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package ament_cmake_version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.3.0 (2022-02-17) ------------------ * Update forthcoming version in changelog * Contributors: Audrow Nash 1.2.1 (2022-01-14) ------------------ * Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 `_) * Contributors: Audrow Nash 1.2.0 (2021-10-29) ------------------ * Use FindPython3 instead of FindPythonInterp (`#355 `_) * Update maintainers (`#336 `_) * Contributors: Chris Lalancette, Shane Loretz 1.1.4 (2021-05-06) ------------------ 1.1.3 (2021-03-09) ------------------ 1.1.2 (2021-02-26 22:59) ------------------------ 1.1.1 (2021-02-26 19:12) ------------------------ 1.1.0 (2021-02-24) ------------------ 1.0.4 (2021-01-25) ------------------ 1.0.3 (2020-12-10) ------------------ 1.0.2 (2020-12-07) ------------------ * Update package maintainers. (`#286 `_) * Contributors: Michel Hidalgo 1.0.1 (2020-09-10) ------------------ 1.0.0 (2020-07-22) ------------------ 0.9.6 (2020-06-23) ------------------ 0.9.5 (2020-06-02) ------------------ 0.9.4 (2020-05-26) ------------------ 0.9.3 (2020-05-19) ------------------ 0.9.2 (2020-05-07) ------------------ 0.9.1 (2020-04-24 15:45) ------------------------ 0.9.0 (2020-04-24 12:25) ------------------------ * Fix handling of macro argument (`#220 `_) Macro invocations handle arguments differently than functions https://cmake.org/cmake/help/latest/command/macro.html#macro-vs-function This can cause a false positive like: ``` -- Found rcutils: 0.8.4 (/opt/ros/master/install/share/rcutils/cmake) CMake Error at install/share/ament_cmake_version/cmake/ament_export_development_version_if_higher_than_manifest.cmake:36 (message): ament_export_development_version_if_higher_than_manifest() called with unused arguments: Call Stack (most recent call first): src/ros2/rmw/rmw/CMakeLists.txt:66 (ament_export_development_version_if_higher_than_manifest) ``` * Contributors: Dan Rose 0.8.1 (2019-10-23) ------------------ * add CMake macro ament_bump_development_version_if_necessary (`#204 `_) * add CMake macro ament_bump_development_version_if_necessary * Update ament_cmake_version/cmake/ament_bump_development_version_if_necessary.cmake Co-Authored-By: William Woodall * Update ament_cmake_version/cmake/ament_bump_development_version_if_necessary.cmake Co-Authored-By: William Woodall * quote versions in message * spelling: no-op * update macro name, add doc line about multiple invocations * Contributors: Dirk Thomas 0.8.0 (2019-10-04) ------------------ 0.7.3 (2019-05-29) ------------------ 0.7.2 (2019-05-20) ------------------ 0.7.1 (2019-05-07) ------------------ 0.7.0 (2019-04-08) ------------------ 0.6.0 (2018-11-13) ------------------ 0.5.1 (2018-07-17) ------------------ 0.5.0 (2018-06-13) ------------------ 0.4.0 (2017-12-08) ------------------ ament_cmake-1.3.0/ament_cmake_version/CMakeLists.txt000066400000000000000000000003701420356112300225250ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12) project(ament_cmake_version NONE) find_package(ament_cmake_core REQUIRED) ament_package( CONFIG_EXTRAS "ament_cmake_version-extras.cmake" ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) ament_cmake-1.3.0/ament_cmake_version/ament_cmake_version-extras.cmake000066400000000000000000000014671420356112300263140ustar00rootroot00000000000000# Copyright 2019 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. # copied from # ament_cmake_version/ament_cmake_version-extras.cmake find_package(ament_cmake_core QUIET REQUIRED) include( "${ament_cmake_version_DIR}/ament_export_development_version_if_higher_than_manifest.cmake") ament_cmake-1.3.0/ament_cmake_version/cmake/000077500000000000000000000000001420356112300210455ustar00rootroot00000000000000ament_export_development_version_if_higher_than_manifest.cmake000066400000000000000000000040221420356112300355460ustar00rootroot00000000000000ament_cmake-1.3.0/ament_cmake_version/cmake# Copyright 2019 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 the exported package version to the passed value if the package # version in the manifest is lower. # # It is recommended to append the suffix ``-dev`` to the passed upcoming # version number. # If the package version in the manifest is equal or newer than the passed # development version this function call becomes a no-op. # If the function is called multiple times only the higher version number will # be used. # # .. note:: It is indirectly calling``ament_package_xml()`` if that hasn't # happened already. # # :param target: development_version # :type target: string # # @public # macro(ament_export_development_version_if_higher_than_manifest development_version) if(${ARGN}) message(FATAL_ERROR "ament_export_development_version_if_higher_than_manifest() called with unused arguments: ${ARGN}") endif() if(DEFINED _${PROJECT_NAME}_AMENT_PACKAGE) message(FATAL_ERROR "ament_export_development_version_if_higher_than_manifest() must be called before " "ament_package()") endif() # call ament_package_xml() if it has not been called before if(NOT _AMENT_PACKAGE_NAME) ament_package_xml() endif() if("${${PROJECT_NAME}_VERSION}" VERSION_LESS "${development_version}") message(STATUS "Overriding exported package version '${${PROJECT_NAME}_VERSION}' with " "development version '${development_version}'") set(${PROJECT_NAME}_VERSION "${development_version}") endif() endmacro() ament_cmake-1.3.0/ament_cmake_version/package.xml000066400000000000000000000014011420356112300220760ustar00rootroot00000000000000 ament_cmake_version 1.3.0 The ability to override the exported package version in the ament buildsystem. Michael Jeronimo Michel Hidalgo Apache License 2.0 Dirk Thomas ament_cmake_core ament_cmake_core ament_cmake