Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

feat: fork ament_cmake_auto package for ament/ament_cmake#385 #76

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions ament_cmake_auto/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package ament_cmake_auto
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.3.2 (2022-05-17)
------------------

1.3.1 (2022-03-28)
------------------

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 <https://github.com/ament/ament_cmake/issues/363>`_)
* Update maintainers to Michael Jeronimo and Michel Hidalgo (`#362 <https://github.com/ament/ament_cmake/issues/362>`_)
* Contributors: Audrow Nash, Daisuke Nishimatsu

1.2.0 (2021-10-29)
------------------
* Add ament_auto_add_gtest (`#344 <https://github.com/ament/ament_cmake/issues/344>`_)
* Use FindPython3 instead of FindPythonInterp (`#355 <https://github.com/ament/ament_cmake/issues/355>`_)
* Update maintainers (`#336 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/86>`_ from ament/remove_include
remove unnecessary include
* remove unnecessary include
* Merge pull request `#84 <https://github.com/ament/ament_cmake/issues/84>`_ from ament/use_in_list
use IN_LIST
* use IN_LIST
* update schema url
* add schema to manifest files
* Merge pull request `#72 <https://github.com/ament/ament_cmake/issues/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 <https://github.com/ament/ament_cmake/issues/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
15 changes: 15 additions & 0 deletions ament_cmake_auto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_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}
)
25 changes: 25 additions & 0 deletions ament_cmake_auto/ament_cmake_auto-extras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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")
87 changes: 87 additions & 0 deletions ament_cmake_auto/cmake/ament_auto_add_executable.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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)
foreach(lib ${${PROJECT_NAME}_LIBRARIES})
get_target_property(lib_include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories("${target}" SYSTEM PRIVATE ${lib_include_dirs})
target_link_libraries("${target}" ${lib})
endforeach(lib)
endif()

# add exported information from found build dependencies
ament_target_dependencies(${target} SYSTEM ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS})

list(APPEND ${PROJECT_NAME}_EXECUTABLES "${target}")
endmacro()
112 changes: 112 additions & 0 deletions ament_cmake_auto/cmake/ament_auto_add_gtest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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()
Loading