Skip to content

Commit

Permalink
perf: faster ament_libraries_deduplicate implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Richard <[email protected]>
  • Loading branch information
VRichardJP committed May 11, 2023
1 parent 154f198 commit 1aee39a
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);(.+)" "\\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}(.+)" "\\2;\\3" ${VAR} "${_packed}")
endmacro()

This file was deleted.

This file was deleted.

0 comments on commit 1aee39a

Please sign in to comment.