Skip to content

Commit 02182c8

Browse files
Talha-deepxbjsowaahcordechristophfroehlichAArnouxDeepX
authored
Bugfix/access scrtipts (#3)
* Use a temporary build directory for Python module output (PickNikRobotics#303) * Added missing gmock/gtest dependency (PickNikRobotics#304) --------- Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Christoph Froehlich <[email protected]> * make scripts accessible to find_program cmake function. --------- Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Błażej Sowa <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> Co-authored-by: Christoph Froehlich <[email protected]> Co-authored-by: Alexandre Arnoux <[email protected]> Co-authored-by: alexandre-arnoux-dx <[email protected]>
1 parent ade8c48 commit 02182c8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

example/package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<depend>rclcpp</depend>
1717
<depend>rclcpp_components</depend>
1818

19+
<test_depend>ament_cmake_gmock</test_depend>
20+
<test_depend>ament_cmake_gtest</test_depend>
21+
1922
<buildtool_depend>ament_cmake</buildtool_depend>
2023

2124
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>

generate_parameter_library/cmake/generate_parameter_library.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,17 @@ function(generate_parameter_module LIB_NAME YAML_FILE)
117117
# Set the yaml file parameter to be relative to the current source dir
118118
set(YAML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${YAML_FILE})
119119

120-
set(LIB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME})
121-
file(MAKE_DIRECTORY ${LIB_INCLUDE_DIR})
120+
# Create a build-local output directory for the generated Python module
121+
set(PY_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/generate_parameter_module_temp)
122+
file(MAKE_DIRECTORY ${PY_BUILD_DIR})
122123

123124
find_package(ament_cmake_python)
124125
ament_get_python_install_dir(python_install_dir)
125-
set(PARAM_HEADER_FILE ${CMAKE_INSTALL_PREFIX}/${python_install_dir}/${PROJECT_NAME}/${LIB_NAME}.py)
126126

127-
# Generate the module for the python
127+
# Generate into the build tree, not into CMAKE_INSTALL_PREFIX
128+
set(PARAM_HEADER_FILE ${PY_BUILD_DIR}/${LIB_NAME}.py)
129+
130+
# Generate the module for Python
128131
add_custom_command(
129132
OUTPUT ${PARAM_HEADER_FILE}
130133
COMMAND ${generate_parameter_library_python_BIN} ${PARAM_HEADER_FILE} ${YAML_FILE} ${VALIDATE_HEADER_FILENAME}
@@ -141,6 +144,8 @@ function(generate_parameter_module LIB_NAME YAML_FILE)
141144
$<INSTALL_INTERFACE:include>
142145
)
143146

147+
# Install the generated module into the Python site-packages dir
148+
install(FILES ${PARAM_HEADER_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/${python_install_dir}/${PROJECT_NAME})
144149
endfunction()
145150

146151
# create custom test function to pass yaml file into test main

generate_parameter_library_py/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ install(PROGRAMS
2121
scripts/generate_parameter_library_cpp
2222
scripts/generate_parameter_library_python
2323
scripts/generate_parameter_library_markdown
24-
DESTINATION lib/${PROJECT_NAME}
24+
DESTINATION bin
2525
)
2626

2727
# Standard ROS package installs

0 commit comments

Comments
 (0)