From 1034e660d84297a751a7d6574f42d0e4ecf4c857 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Sat, 27 Jul 2024 16:46:46 +0200 Subject: [PATCH] Fix cmake for all build cases --- 3rdparty/CMakeLists.txt | 2 +- CMakeLists.txt | 5 +++++ cmakemodules/script_python_bindings.cmake | 1 - doc/source/doxygen-docs/changelog.md | 4 +++- python/CMakeLists.txt | 8 ++++---- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 7c4e625250..7df4407a51 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -134,7 +134,7 @@ if(CMAKE_MRPT_HAS_ROBOPEAK_LIDAR AND MRPT_BUILD_rplidar_sdk) ) set_target_properties(mrpt_rplidar PROPERTIES FOLDER "3rd party") - if(NOT TARGET mrpt::core) + if((DEFINED BUILD_mrpt-core) AND (NOT BUILD_mrpt-core)) find_package(mrpt-core REQUIRED) endif() target_link_libraries(mrpt_rplidar PRIVATE mrpt::core) # To enforce c++17 diff --git a/CMakeLists.txt b/CMakeLists.txt index 397808a792..e89d0b0141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -635,6 +635,11 @@ add_custom_target(all_mrpt_libs ALL) # all_mrpt_libs: target to build all mrpt-* add_subdirectory(3rdparty) # The third-party libraries add_subdirectory(libs) # The MRPT C++ libraries +# Build pymrpt after defining the libs above +if(CMAKE_MRPT_HAS_PYTHON_BINDINGS) +add_subdirectory(python) +endif() + set(MRPT_BUILD_APPLICATIONS ON CACHE BOOL "If you only want the MRPT libraries, disable this.") if(MRPT_BUILD_APPLICATIONS) add_subdirectory(apps) # The applications: diff --git a/cmakemodules/script_python_bindings.cmake b/cmakemodules/script_python_bindings.cmake index 103355e490..7a775d53a9 100644 --- a/cmakemodules/script_python_bindings.cmake +++ b/cmakemodules/script_python_bindings.cmake @@ -50,7 +50,6 @@ if(UNIX AND NOT MRPT_DISABLE_PYTHON_BINDINGS) if (pybind11_FOUND) # build python bindings if we have all requirements set(CMAKE_MRPT_HAS_PYTHON_BINDINGS 1) - add_subdirectory(python) endif() endif() endif() diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index b9efa3e591..6d6c709547 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -2,7 +2,9 @@ # Version 2.13.5: UNRELEASED - Build system: - - ROS package.xml: Remove libfyaml-dev as required build dependency (will use embedded copy). This enables correct builds on non-Debian distributions. + - This main MRPT repository is no longer directly built as a ROS package. Please, use the wrappers for better modularity: + - https://github.com/MRPT/mrpt_ros + - https://github.com/MRPT/python_mrpt_ros # Version 2.13.4: Released July 24th, 2024 - Fix docs typos. diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ab15112720..39b0daba46 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -46,16 +46,16 @@ else() endif() # enable separate build of pymrpt for ros packages: -if(NOT TARGET mrpt::apps) +if(NOT TARGET mrpt::apps AND NOT TARGET mrpt-apps) find_package(mrpt-apps REQUIRED) endif() -if(NOT TARGET mrpt::nav) +if(NOT TARGET mrpt::nav AND NOT TARGET mrpt-nav) find_package(mrpt-nav REQUIRED) endif() -if(NOT TARGET mrpt::slam) +if(NOT TARGET mrpt::slam AND NOT TARGET mrpt-slam) find_package(mrpt-slam REQUIRED) endif() -if(NOT TARGET mrpt::gui) +if(NOT TARGET mrpt::gui AND NOT TARGET mrpt-gui) find_package(mrpt-gui REQUIRED) endif()