Skip to content

Commit 92a16c1

Browse files
committed
WIP: each module now has its own config.h
1 parent 1c38726 commit 92a16c1

File tree

81 files changed

+356
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+356
-229
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ else()
518518
set(EIGEN_MAX_STATIC_ALIGN_BYTES 16)
519519
endif()
520520

521-
include(${MRPT_SOURCE_DIR}/cmakemodules/script_create_config_h.cmake REQUIRED) # Build config.h
522521
include(${MRPT_SOURCE_DIR}/cmakemodules/script_create_version_h.cmake REQUIRED) # Build version.h
523522

524523
add_custom_target(all_mrpt_libs ALL) # all_mrpt_libs: target to build all mrpt-* modules

cmakemodules/DeclareMRPTLib.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function(mrpt_lib_target_requires_cpp17 _TARGET)
1818

1919
# Modern, clean way to do this:
2020
target_compile_features(${_TARGET} ${INTERF_TYPE} cxx_std_17)
21-
2221
endfunction()
2322

2423
# Minimize the time and memory required to build and load debug info:
@@ -450,6 +449,21 @@ macro(internal_define_mrpt_lib name headers_only )
450449
install(TARGETS ${name} EXPORT mrpt-${name}-targets)
451450
endif ()
452451

452+
# Create module/config.h file
453+
# ------------------------------------
454+
if (EXISTS ${MRPT_SOURCE_DIR}/libs/${name}/config.h.in)
455+
set(MODULES_BASE_CONFIG_INCLUDES_DIR ${CMAKE_BINARY_DIR}/include/mrpt-configuration/)
456+
set(MODULE_CONFIG_FILE_INCLUDE_DIR ${MODULES_BASE_CONFIG_INCLUDES_DIR}/mrpt/${name})
457+
file(MAKE_DIRECTORY ${MODULE_CONFIG_FILE_INCLUDE_DIR})
458+
459+
configure_file(${MRPT_SOURCE_DIR}/libs/${name}/config.h.in ${MODULE_CONFIG_FILE_INCLUDE_DIR}/config.h)
460+
461+
target_include_directories(${name} ${iftype}
462+
$<BUILD_INTERFACE:${MODULES_BASE_CONFIG_INCLUDES_DIR}>
463+
)
464+
install()
465+
endif()
466+
453467
# Create module CMake config file:
454468
# For local usage from the BUILD directory (without "install"):
455469
# 1/3: autogenerated target file:

cmakemodules/script_create_config_h.cmake

Lines changed: 0 additions & 16 deletions
This file was deleted.

libs/apps-cli/src/apps-cli-precomp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
+------------------------------------------------------------------------+ */
99
#pragma once
1010

11-
#include <mrpt/config.h>
11+
#include <mrpt/core/config.h>
1212
#if MRPT_ENABLE_PRECOMPILED_HDRS
1313

1414
#include <mrpt/maps/CMetricMap.h>

libs/apps-gui/src/apps-gui-precomp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
+------------------------------------------------------------------------+ */
99
#pragma once
1010

11-
#include <mrpt/config.h>
11+
#include <mrpt/core/config.h>
1212
#if MRPT_ENABLE_PRECOMPILED_HDRS
1313

1414
#include <mrpt/maps/CMetricMap.h>

libs/comms/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
include(${MRPT_SOURCE_DIR}/cmakemodules/script_ftdi.cmake REQUIRED) # Check for the FTDI headers (Linux only, in win32 we use built-in header & dynamic DLL load):
3+
14
# extra dependencies required by unit tests in this module:
25
set_property(GLOBAL PROPERTY mrpt_comms_UNIT_TEST_EXTRA_DEPS mrpt-poses)
36

libs/comms/config.h.in

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* +---------------------------------------------------------------------------+
2+
| Mobile Robot Programming Toolkit (MRPT) |
3+
| https://www.mrpt.org/ |
4+
| |
5+
| Copyright (c) 2005-2024, Individual contributors, see AUTHORS file |
6+
| See: https://www.mrpt.org/Authors - All rights reserved. |
7+
| Released under BSD License. See details in https://www.mrpt.org/License |
8+
+---------------------------------------------------------------------------+
9+
*/
10+
11+
#pragma once
12+
13+
// clang-format off
14+
15+
/** The file ftdi.h exists (Linux only) */
16+
#define MRPT_HAS_FTDI ${CMAKE_MRPT_HAS_FTDI}
17+
#define MRPT_FTDI_VERSION 0x${LIBFTDI_VERSION_MAJOR}${LIBFTDI_VERSION_MINOR}0
18+
19+
// clang-format on

libs/comms/include/mrpt/comms/CClientTCPSocket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
+------------------------------------------------------------------------+ */
99
#pragma once
1010

11-
#include <mrpt/config.h> // MRPT_WORD_SIZE
11+
#include <mrpt/core/config.h> // MRPT_WORD_SIZE
1212
#include <mrpt/io/CStream.h>
1313
#include <mrpt/system/os.h>
1414

libs/comms/include/mrpt/comms/CInterfaceFTDI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
+------------------------------------------------------------------------+ */
99
#pragma once
1010

11-
#include <mrpt/config.h>
1211
#include <mrpt/containers/circular_buffer.h>
12+
#include <mrpt/core/config.h> // MRPT_OS_LINUX
1313
#include <mrpt/io/CStream.h>
1414

1515
#include <deque>

libs/comms/src/CInterfaceFTDI_LIN.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
| Released under BSD License. See: https://www.mrpt.org/License |
88
+------------------------------------------------------------------------+ */
99

10-
#include <mrpt/config.h>
10+
#include <mrpt/comms/config.h> // MRPT_HAS_FTDI
11+
#include <mrpt/core/config.h> // MRPT_OS_LINUX
1112
#include <mrpt/core/exceptions.h>
1213

1314
#include <cstring>

0 commit comments

Comments
 (0)