From 47f53cbb869fd4a0153995f60650a30258717537 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Tue, 30 Jul 2024 23:32:16 -0600 Subject: [PATCH 1/3] Reproduce #382 Signed-off-by: Ryan Friedman --- issue382/CMakeLists.txt | 13 +++++++++++++ issue382/main1.cpp | 11 +++++++++++ issue382/main2.cpp | 12 ++++++++++++ issue382/package.xml | 24 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 issue382/CMakeLists.txt create mode 100644 issue382/main1.cpp create mode 100644 issue382/main2.cpp create mode 100644 issue382/package.xml diff --git a/issue382/CMakeLists.txt b/issue382/CMakeLists.txt new file mode 100644 index 00000000..1221e668 --- /dev/null +++ b/issue382/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) +project(issue382) + +find_package(grid_map_core REQUIRED) +find_package(Eigen3 CONFIG REQUIRED) + + +add_executable(main1 main1.cpp) +target_link_libraries(main1 PRIVATE grid_map_core::grid_map_core) + + +add_executable(main2 main2.cpp) +target_link_libraries(main2 PRIVATE Eigen3::Eigen) \ No newline at end of file diff --git a/issue382/main1.cpp b/issue382/main1.cpp new file mode 100644 index 00000000..8b62176f --- /dev/null +++ b/issue382/main1.cpp @@ -0,0 +1,11 @@ +#include + +int main() { + + Eigen::VectorXd v(10); + v[0] = 0.1; + v[1] = 0.2; + v(0) = 0.3; + v(1) = 0.4; + return 0; +} \ No newline at end of file diff --git a/issue382/main2.cpp b/issue382/main2.cpp new file mode 100644 index 00000000..26561340 --- /dev/null +++ b/issue382/main2.cpp @@ -0,0 +1,12 @@ +#include + + +int main() { + + Eigen::VectorXd v(10); + v[0] = 0.1; + v[1] = 0.2; + v(0) = 0.3; + v(1) = 0.4; + return 0; +} \ No newline at end of file diff --git a/issue382/package.xml b/issue382/package.xml new file mode 100644 index 00000000..22d8afbd --- /dev/null +++ b/issue382/package.xml @@ -0,0 +1,24 @@ + + + + issue382 + 2.0.0 + foo. + ryan f + Yoshua Nava + Ryan Friedman + BSD + + ament_cmake + + grid_map_core + eigen + + ament_cmake_gtest + ament_lint_common + ament_lint_auto + + + ament_cmake + + From 61f72862685abdd56789f1ed9215ba72b0a68ca0 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Tue, 30 Jul 2024 23:45:09 -0600 Subject: [PATCH 2/3] Attempt patch by making properties only apply to the target Signed-off-by: Ryan Friedman --- grid_map_core/CMakeLists.txt | 6 ++++-- grid_map_core/cmake/grid_map_core-extras.cmake | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/grid_map_core/CMakeLists.txt b/grid_map_core/CMakeLists.txt index cbf8ff5d..62efbe88 100644 --- a/grid_map_core/CMakeLists.txt +++ b/grid_map_core/CMakeLists.txt @@ -5,8 +5,7 @@ project(grid_map_core) find_package(ament_cmake REQUIRED) find_package(grid_map_cmake_helpers REQUIRED) -## Define Eigen addons. -include(cmake/${PROJECT_NAME}-extras.cmake) + ## System dependencies are found with CMake's conventions find_package(Eigen3 REQUIRED) @@ -35,6 +34,9 @@ add_library(${PROJECT_NAME} src/iterators/SlidingWindowIterator.cpp ) +## Define Eigen addons. +include(cmake/${PROJECT_NAME}-extras.cmake) + ## Specify additional locations of header files target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/grid_map_core/cmake/grid_map_core-extras.cmake b/grid_map_core/cmake/grid_map_core-extras.cmake index dd4089d4..6f0c0c42 100644 --- a/grid_map_core/cmake/grid_map_core-extras.cmake +++ b/grid_map_core/cmake/grid_map_core-extras.cmake @@ -4,7 +4,7 @@ if(EIGEN_FUNCTORS_PLUGIN) message(FATAL_ERROR "EIGEN_FUNCTORS_PLUGIN already defined") endif() else() - add_definitions(-DEIGEN_FUNCTORS_PLUGIN=\"${EIGEN_FUNCTORS_PLUGIN_PATH}\") + target_compile_definitions(grid_map_core PUBLIC EIGEN_FUNCTORS_PLUGIN=\"${EIGEN_FUNCTORS_PLUGIN_PATH}\") endif() set(EIGEN_DENSEBASE_PLUGIN_PATH "grid_map_core/eigen_plugins/DenseBasePlugin.hpp") @@ -13,5 +13,5 @@ if(EIGEN_DENSEBASE_PLUGIN) message(FATAL_ERROR "EIGEN_DENSEBASE_PLUGIN already defined!") endif() else() - add_definitions(-DEIGEN_DENSEBASE_PLUGIN=\"${EIGEN_DENSEBASE_PLUGIN_PATH}\") + target_compile_definitions(grid_map_core PUBLIC EIGEN_DENSEBASE_PLUGIN=\"${EIGEN_DENSEBASE_PLUGIN_PATH}\") endif() \ No newline at end of file From 5d500ebee4f0e7711d699773c71c289ecf9ac34d Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Tue, 30 Jul 2024 23:51:45 -0600 Subject: [PATCH 3/3] Fix export by not adding it to config extras Signed-off-by: Ryan Friedman --- grid_map_core/CMakeLists.txt | 7 ++++--- issue382/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/grid_map_core/CMakeLists.txt b/grid_map_core/CMakeLists.txt index 62efbe88..c34d1e54 100644 --- a/grid_map_core/CMakeLists.txt +++ b/grid_map_core/CMakeLists.txt @@ -129,6 +129,7 @@ endif() ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) ament_export_dependencies(Eigen3) -ament_package(CONFIG_EXTRAS - cmake/${PROJECT_NAME}-extras.cmake -) +ament_package() +#ament_package(CONFIG_EXTRAS +# cmake/${PROJECT_NAME}-extras.cmake +#) diff --git a/issue382/CMakeLists.txt b/issue382/CMakeLists.txt index 1221e668..b67df731 100644 --- a/issue382/CMakeLists.txt +++ b/issue382/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(issue382) -find_package(grid_map_core REQUIRED) +find_package(grid_map_core CONFIG REQUIRED) find_package(Eigen3 CONFIG REQUIRED)