Skip to content

Commit 727f271

Browse files
committed
Fix mrpt_common basic module
1 parent 5d2e29d commit 727f271

12 files changed

+162
-214
lines changed
File renamed without changes.

CMakeSettings.json

Lines changed: 0 additions & 49 deletions
This file was deleted.
File renamed without changes.

modules/mrpt_common/CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2-
Changelog for package mola_common
2+
Changelog for package mrpt_common
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

55
0.4.0 (2024-08-20)

modules/mrpt_common/CMakeLists.txt

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ------------------------------------------------------------------------------
22
# A Modular Optimization framework for Localization and mApping
3-
# (MOLA)
3+
# (MRPT)
44
#
55
# Copyright (C) 2018-2025, Jose Luis Blanco-Claraco, contributors (AUTHORS.md)
66
# All rights reserved.
@@ -19,23 +19,40 @@ elseif("$ENV{ROS_VERSION}" STREQUAL "1")
1919
set(CMAKE_CXX_STANDARD 14)
2020
endif()
2121

22-
project(mola_common)
22+
project(mrpt_common)
2323

2424
include(GNUInstallDirs) # for install dirs in multilib
2525
include(CMakePackageConfigHelpers)
2626

2727
# Instrumental lib:
2828
add_library(${PROJECT_NAME} INTERFACE)
2929

30-
# Project version:
31-
include(mola-version.cmake)
30+
#----
31+
# Extract version from package.xml
32+
# Example line:" <version>0.3.2</version>"
33+
file(READ package.xml contentPackageXML)
34+
string(REGEX MATCH "<version>([0-9\.]*)</version>" _ ${contentPackageXML})
35+
set(MRPT_VERSION ${CMAKE_MATCH_1})
36+
message(STATUS "MRPT version: ${MRPT_VERSION} (detected in package.xml)")
37+
unset(contentPackageXML)
38+
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ ${MRPT_VERSION})
39+
set(MRPT_MAJOR_VERSION ${CMAKE_MATCH_1})
40+
set(MRPT_MINOR_VERSION ${CMAKE_MATCH_2})
41+
set(MRPT_PATCH_VERSION ${CMAKE_MATCH_3})
42+
configure_file(
43+
${CMAKE_CURRENT_SOURCE_DIR}/mrpt_common-version.cmake.in
44+
${CMAKE_CURRENT_BINARY_DIR}/mrpt_common-version.cmake
45+
@ONLY
46+
)
47+
#----
48+
3249

3350
# Allow build-time finding of this package:
34-
set(mola_common_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to mola_common")
51+
set(mrpt_common_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to mrpt_common")
3552

3653
# not ament-based builds (standalone, w/o ROS):
3754
if ((NOT DETECTED_ROS2) AND (NOT DETECTED_ROS1))
38-
# Generate: mola_common-version.cmake
55+
# Generate: mrpt_common-version.cmake
3956
include(CMakePackageConfigHelpers)
4057

4158
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.14.0")
@@ -44,18 +61,18 @@ if ((NOT DETECTED_ROS2) AND (NOT DETECTED_ROS1))
4461

4562
write_basic_package_version_file(
4663
# generate to the topmost root binary dir:
47-
${CMAKE_BINARY_DIR}/mola_common-config-version.cmake
48-
VERSION ${MOLA_VERSION_NUMBER_MAJOR}.${MOLA_VERSION_NUMBER_MINOR}.${MOLA_VERSION_NUMBER_PATCH}
64+
${CMAKE_BINARY_DIR}/mrpt_common-config-version.cmake
65+
VERSION ${MRPT_MAJOR_VERSION}.${MRPT_MINOR_VERSION}.${MRPT_PATCH_VERSION}
4966
COMPATIBILITY AnyNewerVersion
5067
${ARCH_INDEP_FLAG}
5168
)
5269

53-
# Generate: mola_common.cmake
70+
# Generate: mrpt_common.cmake
5471
configure_file(
5572
# Input:
56-
mola_common-config.cmake.in
73+
mrpt_common-config.cmake.in
5774
# Output: generate to the topmost root binary dir:
58-
${CMAKE_BINARY_DIR}/mola_common-config.cmake
75+
${CMAKE_BINARY_DIR}/mrpt_common-config.cmake
5976
# Parse: "@var_names@" only
6077
@ONLY
6178
)
@@ -65,7 +82,7 @@ if ((NOT DETECTED_ROS2) AND (NOT DETECTED_ROS1))
6582
FILES
6683
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.cmake
6784
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
68-
${CMAKE_SOURCE_DIR}/mola-version.cmake
85+
${CMAKE_BINARY_DIR}/mrpt_common-version.cmake
6986
DESTINATION
7087
share/${PROJECT_NAME}/cmake
7188
)
@@ -90,8 +107,8 @@ set(CUSTOM_CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
90107
# Install files common to both, ROS and non-ROS builds:
91108
install(
92109
FILES
93-
${CUSTOM_CMAKE_DIR}/mola_cmake_functions.cmake
94-
${CUSTOM_CMAKE_DIR}/mola-xxx-config.cmake.in
110+
${CUSTOM_CMAKE_DIR}/mrpt_cmake_functions.cmake
111+
${CUSTOM_CMAKE_DIR}/mrpt-xxx-config.cmake.in
95112
DESTINATION
96113
share/${PROJECT_NAME}/cmake
97114
)
@@ -106,7 +123,7 @@ if (DETECTED_ROS1)
106123

107124
# Declare this project as a catkin package
108125
catkin_package(
109-
CFG_EXTRAS mola_cmake_functions.cmake
126+
CFG_EXTRAS mrpt_cmake_functions.cmake
110127
)
111128
endif()
112129

@@ -121,10 +138,10 @@ if (DETECTED_ROS2)
121138
# rclcpp...
122139
#)
123140

124-
# Add custom mola cmake macros, as in our non-ament (ROS2) config.cmake file:
125-
# See: mola_common-config.cmake.in
141+
# Add custom mrpt cmake macros, as in our non-ament (ROS2) config.cmake file:
142+
# See: mrpt_common-config.cmake.in
126143

127144
ament_package(
128-
CONFIG_EXTRAS cmake/mola_cmake_functions.cmake
145+
CONFIG_EXTRAS cmake/mrpt_cmake_functions.cmake
129146
)
130147
endif()

modules/mrpt_common/cmake/mola-xxx-config.cmake.in renamed to modules/mrpt_common/cmake/mrpt-xxx-config.cmake.in

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
include(CMakeFindDependencyMacro)
22

33
# Hints to help CMake finding my dependencies (and theirs own), as well as
4-
# other future calls to search for other mola modules from our parent scope:
5-
# 1: MOLA_DIR cmake var:
6-
if (NOT "${MOLA_DIR}" STREQUAL "")
7-
list(APPEND CMAKE_PREFIX_PATH "${MOLA_DIR}")
8-
# If the user defines MOLA_DIR, that path overrides whatever CMake on its own
4+
# other future calls to search for other mrpt modules from our parent scope:
5+
# 1: MRPT_DIR cmake var:
6+
if (NOT "${MRPT_DIR}" STREQUAL "")
7+
list(APPEND CMAKE_PREFIX_PATH "${MRPT_DIR}")
8+
# If the user defines MRPT_DIR, that path overrides whatever CMake on its own
99
# found (this file):
1010
get_filename_component(this_dir "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
11-
get_filename_component(user_mola_dir "${MOLA_DIR}" ABSOLUTE)
12-
if ((EXISTS "${MOLA_DIR}/@MOLA_MODULE_NAME@-config.cmake") AND (NOT "${this_dir}" STREQUAL "${user_mola_dir}"))
13-
message("@MOLA_MODULE_NAME@_DIR was: ${@MOLA_MODULE_NAME@_DIR}")
14-
set(@MOLA_MODULE_NAME@_DIR "${MOLA_DIR}" CACHE PATH "Path to @MOLA_MODULE_NAME@" FORCE)
15-
include(${MOLA_DIR}/@MOLA_MODULE_NAME@-config.cmake)
11+
get_filename_component(user_mrpt_dir "${MRPT_DIR}" ABSOLUTE)
12+
if ((EXISTS "${MRPT_DIR}/@MRPT_MODULE_NAME@-config.cmake") AND (NOT "${this_dir}" STREQUAL "${user_mrpt_dir}"))
13+
message("@MRPT_MODULE_NAME@_DIR was: ${@MRPT_MODULE_NAME@_DIR}")
14+
set(@MRPT_MODULE_NAME@_DIR "${MRPT_DIR}" CACHE PATH "Path to @MRPT_MODULE_NAME@" FORCE)
15+
include(${MRPT_DIR}/@MRPT_MODULE_NAME@-config.cmake)
1616
return()
1717
endif()
1818
endif()
@@ -32,4 +32,4 @@ endforeach()
3232
@EXTRA_CONFIG_CMDS@
3333

3434
# Include targets for this library:
35-
include(${CMAKE_CURRENT_LIST_DIR}/@MOLA_MODULE_NAME@-targets.cmake)
35+
include(${CMAKE_CURRENT_LIST_DIR}/@MRPT_MODULE_NAME@-targets.cmake)

0 commit comments

Comments
 (0)