From 980f85c06abf73fbfd627e486f2f7fdb04c39eb4 Mon Sep 17 00:00:00 2001 From: AugusteBourgois Date: Tue, 6 Aug 2024 10:52:17 +0200 Subject: [PATCH] copy install path folder architecture in build path This way, generated header are included using the same way in local compiled libs, header only libs and in other pkg's libs and executables --- .../minimal_publisher.hpp | 3 +-- example/src/minimal_publisher.cpp | 2 +- example/test/descriptor_test_gtest.cpp | 2 +- example/test/example_test_gmock.cpp | 2 +- example/test/example_test_gtest.cpp | 2 +- .../cmake/generate_parameter_library.cmake | 14 +++++++------- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/example/include/generate_parameter_library_example/minimal_publisher.hpp b/example/include/generate_parameter_library_example/minimal_publisher.hpp index cacce19..ad932dd 100644 --- a/example/include/generate_parameter_library_example/minimal_publisher.hpp +++ b/example/include/generate_parameter_library_example/minimal_publisher.hpp @@ -30,8 +30,7 @@ #include #include - -#include +#include namespace admittance_controller { diff --git a/example/src/minimal_publisher.cpp b/example/src/minimal_publisher.cpp index e4021b3..62cdaa4 100644 --- a/example/src/minimal_publisher.cpp +++ b/example/src/minimal_publisher.cpp @@ -30,7 +30,7 @@ #include -#include +#include using namespace std::chrono_literals; diff --git a/example/test/descriptor_test_gtest.cpp b/example/test/descriptor_test_gtest.cpp index 15db315..b973665 100644 --- a/example/test/descriptor_test_gtest.cpp +++ b/example/test/descriptor_test_gtest.cpp @@ -29,7 +29,7 @@ // Author: Chance Cardona // -#include "admittance_controller_parameters.hpp" +#include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gtest/gtest.h" #include "rclcpp/rclcpp.hpp" diff --git a/example/test/example_test_gmock.cpp b/example/test/example_test_gmock.cpp index 15b3735..63486c2 100644 --- a/example/test/example_test_gmock.cpp +++ b/example/test/example_test_gmock.cpp @@ -29,7 +29,7 @@ // Author: Denis Štogl // -#include "admittance_controller_parameters.hpp" +#include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gmock/gmock.h" #include "rclcpp/rclcpp.hpp" diff --git a/example/test/example_test_gtest.cpp b/example/test/example_test_gtest.cpp index b7593ba..40e06e1 100644 --- a/example/test/example_test_gtest.cpp +++ b/example/test/example_test_gtest.cpp @@ -29,7 +29,7 @@ // Author: Denis Štogl // -#include "admittance_controller_parameters.hpp" +#include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gtest/gtest.h" #include "rclcpp/rclcpp.hpp" diff --git a/generate_parameter_library/cmake/generate_parameter_library.cmake b/generate_parameter_library/cmake/generate_parameter_library.cmake index c7cdf37..f729c2f 100644 --- a/generate_parameter_library/cmake/generate_parameter_library.cmake +++ b/generate_parameter_library/cmake/generate_parameter_library.cmake @@ -34,7 +34,7 @@ function(generate_parameter_library LIB_NAME YAML_FILE) endif() # Make the include directory - set(LIB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}/include/) + set(LIB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/) file(MAKE_DIRECTORY ${LIB_INCLUDE_DIR}) # Optional 3rd parameter for the user defined validation header @@ -76,8 +76,8 @@ function(generate_parameter_library LIB_NAME YAML_FILE) # Create the library target add_library(${LIB_NAME} INTERFACE ${PARAM_HEADER_FILE} ${VALIDATE_HEADER}) target_include_directories(${LIB_NAME} INTERFACE - $ - $ + $ + $ ) set_target_properties(${LIB_NAME} PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(${LIB_NAME} INTERFACE @@ -89,7 +89,7 @@ function(generate_parameter_library LIB_NAME YAML_FILE) tcb_span::tcb_span tl_expected::tl_expected ) - install(DIRECTORY ${LIB_INCLUDE_DIR} DESTINATION include/${PROJECT_NAME}/${LIB_NAME}) + install(DIRECTORY ${LIB_INCLUDE_DIR} DESTINATION include/${PROJECT_NAME}) endfunction() @@ -107,7 +107,7 @@ function(generate_parameter_module LIB_NAME YAML_FILE) # Set the yaml file parameter to be relative to the current source dir set(YAML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${YAML_FILE}) - set(LIB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}) + set(LIB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/) file(MAKE_DIRECTORY ${LIB_INCLUDE_DIR}) find_package(ament_cmake_python) @@ -127,8 +127,8 @@ function(generate_parameter_module LIB_NAME YAML_FILE) # Create the library target add_library(${LIB_NAME} INTERFACE ${PARAM_HEADER_FILE} ${VALIDATE_HEADER}) target_include_directories(${LIB_NAME} INTERFACE - $ - $ + $ + $ ) endfunction()