Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genmsg-extras: Added a BASE_DIR argument to add_service_files to be able... #51

Closed
wants to merge 2 commits into from

Conversation

dreuter
Copy link

@dreuter dreuter commented Aug 4, 2014

... to compile autogenerated messages.

@dirk-thomas
Copy link
Member

Please describe your use case for this patch. It also looks like that the argument is very similar to the existing argument DIRECTORY.

@dreuter
Copy link
Author

dreuter commented Aug 4, 2014

Okay, I'm sorry that I didn't provide them before.

It is quite similar to DIRECTORY but it does not take a relative path, but an absolute. For add_message_files both arguments exist.

A typical usecase would be autogenerated service files. I am currently writing a database API, which uses ROS services. Since I don't want to generate a service for each message used in our system, I wanted to create an autogenerator.

This could be used like this:

autogenerate_srvs(autogen_srvs a b c d)

add_service_files(
  FILES ${autogen_srvs}
  BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}
)

where autogenerate_srvs would write some services (for each argument) in ${CMAKE_CURRENT_BINARY_DIR}

There are some (hacky) ways around this, but I think it is a good idea to integrate it, especially because add_message_files has such an argument.

@dirk-thomas
Copy link
Member

The BASE_DIR argument for add_message_files solely exists for backward compatibility with actions.

I don't think we should mimic the same (actually pretty weird) arguments to add_service_files. Instead the DIRECTORY argument could be modified that it accepts an absolute path. Can you please update your pull request that way?

@dreuter
Copy link
Author

dreuter commented Aug 4, 2014

I actually tried DIRECTORY first and I thought it would handle the path as absolute, if I prepend a slash. So I will give it a try :)

Is BASE_DIR used somewhere? I'm just asking because I am wondering, if I should remove it then.

@dreuter
Copy link
Author

dreuter commented Aug 6, 2014

I pushed the new changes. DIRECTORY now handles absolute and relative paths.

I also added a commit, which removes the BASE_DIR argument, so you can omit it, if necessary.

@dreuter
Copy link
Author

dreuter commented Aug 6, 2014

I forgot to mention, that deleting BASE_DIR will break action files at the moment. I will try to fix this.

I also created a repository, which tests the different calling methods: https://github.com/dreuter/test_genmsg

@dreuter
Copy link
Author

dreuter commented Aug 7, 2014

My pull request in common_msgs should fix the problem mentioned above.

See: ros/common_msgs#43

@@ -74,7 +74,7 @@ macro(_prepend_path ARG_PATH ARG_FILES ARG_OUTPUT_VAR)
endmacro()

macro(add_message_files)
cmake_parse_arguments(ARG "NOINSTALL" "DIRECTORY;BASE_DIR" "FILES" ${ARGN})
cmake_parse_arguments(ARG "NOINSTALL" "DIRECTORY" "FILES" ${ARGN})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing public API from an already release distro is not feasible.

@dreuter
Copy link
Author

dreuter commented Aug 18, 2014

I fixed this. The public API now remains unchanged... Could you please merge it?

@dirk-thomas
Copy link
Member

Thank you for the patch - I committed a modified version which is a bit more concise: 80c0d2a

@dreuter dreuter deleted the base_dir_services branch September 3, 2014 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants