Skip to content

Commit

Permalink
perf: faster ament_libraries_deduplicate implementation (#448)
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Richard <vincent.francois.richard@gmail.com>
Signed-off-by: Scott K Logan <logans@cottsay.net>
Co-authored-by: Scott K Logan <logans@cottsay.net>
  • Loading branch information
VRichardJP and cottsay authored Mar 29, 2024
1 parent 5c9805a commit 833d2b3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 89 deletions.
2 changes: 0 additions & 2 deletions ament_cmake_libraries/ament_cmake_libraries-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@
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")
14 changes: 5 additions & 9 deletions ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
# @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})
string(REGEX REPLACE "(^|;)(debug|optimized|general);([^;]+)" "\\1\\2${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}\\3" _packed "${ARGN}")
list(REVERSE _packed)
list(REMOVE_DUPLICATES _packed)
list(REVERSE _packed)
string(REGEX REPLACE "(^|;)(debug|optimized|general)${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}([^;]+)" "\\1\\2;\\3" ${VAR} "${_packed}")
endmacro()

This file was deleted.

This file was deleted.

0 comments on commit 833d2b3

Please sign in to comment.