-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update CMakeLists.txt and package.xml #404
Update CMakeLists.txt and package.xml #404
Conversation
@matthew-reynolds is there anything else you'd add apart from the outstanding review points? (The PR is still in draft mode) |
Been quite busy the last 2 weeks, my apologies. Other than the outstanding review points, I just want to double check those last couple points in the initial PR message (that we're not missing and |
While finding missing roscpp & rospy deps, I found a couple additional missing package dependencies (some msgs, pluginlib in some tests, etc). Will do another thorough pass to fix all of those. Still need to double check we're not missing any |
Follow-up issues all opened. Ready for final review of this PR. Would you like me to reference #410 in the comment I left in the two _tests CMakeLists.txt? BTW, came across these while working on this PR: #117 and #157 both look like old issues that have long been resolved. I think they should be closed. |
Thanks very much for sticking through this long review. |
Apologies for the abrupt "merge branch..." solution, I dared to resolve the conflict using github's interface, please feel free to squash that with any of your commits. |
- Dependencies needed to compile are <build_depend> - Dependencies used in public headers are <build_export_depend> - Dependencies needed to link or run are <exec_depend>
Thanks @matthew-reynolds for the great for and @gavanderhoorn for the additional review, I am merging this now! |
) | ||
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) | ||
|
||
add_executable(dummy_app EXCLUDE_FROM_ALL src/dummy_app.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did EXCLUDE_FROM_ALL
come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When looking at the targets in all the test packages in https://github.com/ros/ros_comm/tree/melodic-devel/test as an example, I saw they marked targets intended for tests as EXCLUDE_FROM_ALL
. Similarly, targets generated by catkin_add_gtest()
and catkin_add_gmock()
enable the property.
I admit, I don't fully understand why this is required, since the test targets are already wrapped in the if(CATKIN_ENABLE_TESTING)
. I have the impression it was to cover an edge-case with catkin_make
(as opposed to catkin_make_isolated
or catkin_tools
), something to do with the single CMake invocation over the entire workspace, but instead of properly researching and understanding it, I just used those packages as examples and mimicked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to add the targets to tests
manually:
https://github.com/ros/ros_comm/blob/8d9af410949423342150b79e763348f963e19734/test/test_roscpp/test/src/CMakeLists.txt#L226
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use add_rostest_gtest
, which would automate most of the steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to add the targets to
tests
manually
Ah, I think you're right, that makes sense. Since those targets are only depended on by targets in add_rostest
, not add_rostest_gtest
, they aren't directly or transitively depended on by the tests
target, and since I added the EXCLUDE_FROM_ALL
property, they aren't part of the all
target either. Sounds like this may be the cause of the colcon failure you mentioned.
I will re-add the add_dependencies(tests target_name)
for executable targets used in tests. What are your and @bmagyar's thoughts on also adding library targets as dependencies? Back to the ros_comm
test package examples, they seem to only mark executables as deps, and rely on libraries being pulled in transitively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rely on libraries being pulled in transitively.
This is sufficient. Add direct dependencies only.
Various fixes and formatting for
CMakeLists.txt
andpackage.xml
files, including fixes suggested bycatkin_lint
.Apply consistent format to CMakeLists.txt and package.xml files
The format is largely based on the existing files. The most important change is that this PR corrects the order of commands in the
CMakeLists.txt
.I'm not at all attached to the format used in the CMakeLists.txt, happy to gut out the comments or make other stylistic changes as desired. I would mostly just like them to be consistent, as it makes it much easier to identify issues and to maintain.
Beyond stylistic changes, the following changes were made:
combined_robot_hw
:boost
library dependencycombined_robot_hw_tests
:boost
library dependency${catkin_EXPORTED_TARGETS}
dependencycatkin_package()
andinstall()
commandsif(CATKIN_ENABLE_TESTING)
blockpackage.xml
controller_interface
:rosunit
dependency (See note at bottom)controller_manager
:roscpp
dependency${catkin_EXPORTED_TARGETS}
dependencyexec_depends
for python scriptscontroller_manager_msgs
:exec_depends
for python scriptscontroller_manager_tests
:boost
include_dir dependencyhardware_interface
androscpp
dependencies${catkin_EXPORTED_TARGETS}
dependencycatkin_package()
andinstall()
commandsif(CATKIN_ENABLE_TESTING)
blockpackage.xml
hardware_interface
:find_package(Boost REQUIRED)
for header-only library dependencyptr_container
boost
depend in package.xmlrosconsole
dependency (Already included viaroscpp
)rostest
test_dependrosunit
dependency (See note at bottom)joint_limits_interface
:liburdfdom-dev
dependency (See Update CMakeLists.txt and package.xml #404 (comment))rqt_controller_manager
:catkin_install_python()
rather than the default cmakeinstall()
transmission_interface
:find_package(Boost REQUIRED)
for header-only library dependencylexical_cast
boost
depend in package.xmlBoost
dependencies in testsfind_package()
in tests, to not override previousfind_package(catkin [...])
. See make rostest build dependency in CMakeLists.txt optional ros/rosdistro#3010 (comment)Notes:
I was unable to find up-to-date documentation on
rosunit
and the correspondingcatkin_add_gtest
/catkin_add_gmock
. In particular, I don't know if it is necessary tofind_package(rosunit)
or<test_depend>rosunit</test_depend>
. I believe thefind_package
is unecessary. I think thetest_depend
is required, but I'm not sure.For header-only Boost libraries, I used
find_package(Boost REQUIRED)
andinclude_directories(${Boost_INCLUDE_DIRS})
. I was not able to find any other examples of this use in large ROS packages, so I just wanted to highlight it here in case there's a better approach.TODO:
Couple things I just want to look through before changing this from a draft to a normal PR:
Make sureDone in fa93166add_dependencies(${catkin_EXPORTED_TARGETS})
is used everywhere it's requiredMake sureDone in 79b504croscpp
is depended upon directly everywhere that it's requiredInvestigate theDone in 7ca25aburdf
/liburdf-dev
situation, and see if things can be simplified