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

Split cxx crate into runtime and build.rs components #144

Closed
maurer opened this issue Apr 23, 2020 · 4 comments · Fixed by #167
Closed

Split cxx crate into runtime and build.rs components #144

maurer opened this issue Apr 23, 2020 · 4 comments · Fixed by #167
Labels
integration How cxx fits into the big picture of an organization's codebase and builds

Comments

@maurer
Copy link

maurer commented Apr 23, 2020

Right now, the cxx crate contains both runtime components (e.g. cxx::unique_ptr) and build time components (e.g. cxx::gen, cxx::Build).

This is negative because:

  • For cross compilation builds, this requires that what should be build-only dependencies be supported on the target.
  • This builds more functionality into the target binary than needed. If cxx is linked statically, there's a good chance most of this will be removed, but it will bloat in cases where it's linked dynamically.
  • For homogenous build systems (bazel, buck, etc.) this requires them to pull in the cc and link_cplusplus crates to their source tree, which will never actually be used.

The two ways I see forwards here are:

  • Split it using features. Users of homogenous build system, or who cared about binary size, etc. would be expected to disable a default feature to get a support-code-only version of the crate.
  • Split it into separate crates, e.g. cxx-support and cxx-build, possibly keeping the main cxx crate as a wrapper that re-exports both.

Opinions?

@dtolnay
Copy link
Owner

dtolnay commented Apr 23, 2020

We should split the crate. I'll try to move the build-only stuff to a cxx-codegen crate and keep only the runtime components in cxx.

@maurer
Copy link
Author

maurer commented Apr 23, 2020

Do you want to handle that yourself, or should I send up a PR? I had it temporarily split with a feature to get it working in my context.

@dtolnay
Copy link
Owner

dtolnay commented Apr 24, 2020

I will take care of this one since I'll probably be picky about the directory layout. It sounds like you have a workaround for now? If so, I'll aim to get this done and published early next week.

@dtolnay
Copy link
Owner

dtolnay commented Apr 30, 2020

Fixed in 0.3.0.

@dtolnay dtolnay added the integration How cxx fits into the big picture of an organization's codebase and builds label Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration How cxx fits into the big picture of an organization's codebase and builds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants