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

Allow building multiple targets at once #115

Open
dcsommer opened this issue Apr 27, 2021 · 6 comments
Open

Allow building multiple targets at once #115

dcsommer opened this issue Apr 27, 2021 · 6 comments

Comments

@dcsommer
Copy link

dcsommer commented Apr 27, 2021

The current API only allows specifying a single build target. However, the cmake CLI allows specifying multiple targets.

       --target <tgt>..., -t <tgt>...
              Build <tgt> instead of the default target.  Multiple targets may
              be given, separated by spaces.

It would be convenient to allow this in cmake-rs. Calling build_target("target1 target2") does not work with the build() API which only returns a single path.

The workaround is to invoke cmake once for each target, but this is slow.

@alexcrichton
Copy link
Member

Perhaps each call to build_target can be collected into a vector?

@dcsommer
Copy link
Author

Perhaps each call to build_target can be collected into a vector?

build_target() mutates self, so I'd need to copy the config for each. But yeah, you can build multiple targets today if you call build_target() and then build() once per target. I didn't quite grok how your idea helps with the usecase of building multiple targets at once though.

@dcsommer dcsommer changed the title Allow specifying multiple build targets Allow building multiple build targets at once Apr 28, 2021
@dcsommer dcsommer changed the title Allow building multiple build targets at once Allow building multiple targets at once Apr 28, 2021
@alexcrichton
Copy link
Member

Er what I mean is that cmake_target internally could become a Vec whereas it's now an Option. We could then pass all those down all at once when calling cmake to avoid having to call cmake multiple times. There could be some sort of alternate API or something or other for building to learn about all the paths if you'd like multiple returned (although I though the return value was just the output directory, not the actual artifacts...)

@dcsommer
Copy link
Author

dcsommer commented Apr 28, 2021 via email

@dcsommer
Copy link
Author

dcsommer commented May 3, 2021

@alexcrichton are you open to PRs for this issue using the vector approach?

@alexcrichton
Copy link
Member

indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants