bazelbuild / rules_cc

C++ Rules for Bazel
https://bazel.build
Apache License 2.0
189 stars 94 forks source link

Support cc_embed_data #41

Open silvasean opened 5 years ago

silvasean commented 5 years ago

Description of the problem / feature request:

Bazel doesn't support cc_embed_data

Feature requests: what underlying problem are you trying to solve with this feature?

I would like to embed data into C++ code.

We ended up having to hand-roll our own: https://github.com/google/iree/commit/4be1097dd2722ed0119e9b4b7784077e4970f3c3

Feel free to take code from there. I don't think we have time to upstream this properly.

stellaraccident commented 5 years ago

Here is the implementation (hand written): https://github.com/google/iree/tree/master/build_tools/embed_data

chandlerc commented 4 years ago

FWIW, LLVM needs this as well, and it is challenging to use this implementation. (Abseil and other dependencies that we shouldn't need to pull down and put in the host build just for this...)

Is there any chance of progress here, or should we too roll our own?

stellaraccident commented 4 years ago

It shouldn't be hard to remove the abseil dep, and in hindsight I shouldn't have taken it. I don't have any plans to evolve this further unless if a need emerges for us. Feel free to grab anything we have to bootstrap rolling a new one, and if you get a dep-cleaner version, we can grab that back when it is ready.

chandlerc commented 4 years ago

For now, trying to avoid the need, but will do if it ends up necessary.

schoppmp commented 3 years ago

I'd also +1 this, as I'd like to use cc_embed_data in https://github.com/google/distributed_point_functions/.

jiawen commented 2 years ago

Xoogler here. I'm happy to take on this task of upstreaming this into Bazel as my first contribution.

@chandlerc @stellaraccident It's hard for me to unwind the threads but it seems your implementation doesn't actually have a dependency on abseil?

stellaraccident commented 2 years ago

Yeah, it should be dependency clean. Looks like its grown a couple of define checks in the generated code but should be easily removed. Feel free to take it if it is helpful.