From 928f4728be7c34c60e58fd86d3bbe9a3674149f5 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 26 Feb 2024 16:16:03 -0700 Subject: [PATCH 1/5] Export the right library names --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 361a0a6..ed11254 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ endif() # Export old-style CMake variables ament_export_include_directories("include/${PROJECT_NAME}") -ament_export_libraries(${PROJECT_NAME}) +ament_export_libraries(${interface_targets} ${plugin_targets}) # Export modern CMake targets ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) From 85d21e11573756cce9fc1d8e49cc91ca5a80280b Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Tue, 27 Feb 2024 00:54:32 -0700 Subject: [PATCH 2/5] Remove ament_export_libraries entirely * And add usage guidelines Signed-off-by: Ryan Friedman --- CMakeLists.txt | 3 +-- README.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index ed11254..9ca7bdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,9 +204,8 @@ endif() # Install ############################################################################## -# Export old-style CMake variables +# Export old-style CMake variables for includes ament_export_include_directories("include/${PROJECT_NAME}") -ament_export_libraries(${interface_targets} ${plugin_targets}) # Export modern CMake targets ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1b366b --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Filters + +## Usage with ament_cmake + +Here is recommended approach on how to link `filters` to your project, using the `filter_base` target. + +```cmake +find_package(filters CONFIG REQUIRED) + +add_library(my_library) +# Other library stuff here + +target_link_libraries(my_library PUBLIC filters::filter_base) +``` + +Do NOT use the `filters_LIBRARIES` anymore. + +For more information, +see the [ament_cmake](https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html) +tutorial. From ca329516685a89e9af7cc67a7a69edb05e3c6812 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Thu, 29 Feb 2024 09:47:31 -0700 Subject: [PATCH 3/5] Remove not on not using filters_LIBRARIES * It is still supported, but just left out because it's not recommended to use anymore Signed-off-by: Ryan Friedman --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b1b366b..09dfe34 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ add_library(my_library) target_link_libraries(my_library PUBLIC filters::filter_base) ``` -Do NOT use the `filters_LIBRARIES` anymore. - For more information, see the [ament_cmake](https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html) tutorial. From 362ee4c5dc9963c185a1349b9cf5e2e540ae234b Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 1 Mar 2024 15:54:24 -0700 Subject: [PATCH 4/5] Document details on an INTERFACE library usage for filter_base Signed-off-by: Ryan Friedman --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ca7bdc..e105ca8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,11 @@ target_link_libraries(realtime_circular_buffer Boost::boost ) +# filter_base is an INTERFACE library because it only has header files. +# It is not compiled, but sets up the following properties for consumers +# to link to a target. +# For more info, see the CMake Wiki on INTERFACE targets. +# https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries add_library(filter_base INTERFACE include/filters/filter_base.h From f0d96cb3858904f379b6ad8b947a872f9df358c2 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 1 Mar 2024 15:59:36 -0700 Subject: [PATCH 5/5] Document different libraries exposed * And the purpose of filter_base Signed-off-by: Ryan Friedman --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 09dfe34..4adee82 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Usage with ament_cmake -Here is recommended approach on how to link `filters` to your project, using the `filter_base` target. +Here is recommended approach on how to link `filters` to your project, using the `filters::realtime_circular_buffer` target. ```cmake find_package(filters CONFIG REQUIRED) @@ -10,9 +10,21 @@ find_package(filters CONFIG REQUIRED) add_library(my_library) # Other library stuff here -target_link_libraries(my_library PUBLIC filters::filter_base) +target_link_libraries(my_library PUBLIC filters::realtime_circular_buffer) ``` -For more information, +For more information on using ament_cmake, see the [ament_cmake](https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html) tutorial. + +Filters creates all of the following CMake targets, including: +* filters::realtime_circular_buffer +* filters::filter_chain +* filters::mean +* filters::params +* filters::increment +* filters::median +* filters::transfer_function + +It is recommended to only link to the libraries needed. +Linking to `filters::filter_base` pulls in all necessary libraries and include directories for targets with classes that extend `FilterBase`. This is useful if you are writing your own filter.