Skip to content

Commit

Permalink
copy install path folder architecture in build path
Browse files Browse the repository at this point in the history
This way, generated header are included using the same way <pkg_name/param_file.hpp> in local compiled libs, header only libs and in other pkg's libs and executables
  • Loading branch information
AugusteBourgois committed Aug 6, 2024
1 parent d54655e commit 980f85c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

#include <rclcpp/rclcpp.hpp>
#include <rclcpp_components/register_node_macro.hpp>

#include <admittance_controller_parameters.hpp>
#include <generate_parameter_library_example/admittance_controller_parameters.hpp>

namespace admittance_controller {

Expand Down
2 changes: 1 addition & 1 deletion example/src/minimal_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <rclcpp/rclcpp.hpp>

#include <admittance_controller_parameters.hpp>
#include <generate_parameter_library_example/admittance_controller_parameters.hpp>

using namespace std::chrono_literals;

Expand Down
2 changes: 1 addition & 1 deletion example/test/descriptor_test_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion example/test/example_test_gmock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion example/test/example_test_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
$<BUILD_INTERFACE:${LIB_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}/${LIB_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_target_properties(${LIB_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${LIB_NAME} INTERFACE
Expand All @@ -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()


Expand All @@ -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)
Expand All @@ -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
$<BUILD_INTERFACE:${LIB_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}/${LIB_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)

endfunction()
Expand Down

0 comments on commit 980f85c

Please sign in to comment.