Ask Your Question
1

Proper runtime executable install location

asked 2020-12-16 12:12:12 -0500

jdlangs gravatar image

I thought I'd ask for official clarification here because I've seen conflicting information from different sources. Until recently, I understood that we should be placing node executables under lib/${PROJECT_NAME} via the RUNTIME category of the CMake install command. This seems like the only place ros2 run and ros2 launch find them.

However, after doing some Windows development, I discovered shared libraries (.dlls) have to go under bin/ in the install space, and they also fall under the RUNTIME category. This is also recommended by the current ament_cmake documentation.

So what is the proper thing to do here? Is everything shifting to being installed under bin/ and the ros2 commands need to be updated to see those files? Or is the expectation now that executable and library targets should always be installed with separate install() commands into the two different places?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-12-18 13:34:46 -0500

William gravatar image

The recommended best practice is still to have your executables in lib/${PROJECT_NAME}, so as to not pollute the PATH and to reduce the chances of file collisions from different packages.

Your second guess it what I think you need to do, have separate install() commands for libraries and executables. I don't think we have any good examples of packages that have both executables and libraries in them, but we have examples of packages that install executables and others that install libraries, e.g.:

Also, when using the install statement that the ament documentation suggests (the one you linked to) it will handle installing .dll files to bin for you, placing the .lib files in lib instead. So you shouldn't need to do anything else for Windows.

edit flag offensive delete link more

Comments

Thanks for explaining the rationale. I'll probably switch to a style of a separate install command per target now, since I always sort-of felt that would be cleaner way of organizing the CMake code anyways.

jdlangs gravatar image jdlangs  ( 2020-12-18 19:34:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-12-16 12:12:12 -0500

Seen: 75 times

Last updated: Dec 18 '20