google / shaderc-rs

Rust bindings for the shaderc library.
https://docs.rs/shaderc
Apache License 2.0
261 stars 64 forks source link

Can we install the binaries just once to the .cargo/bin/, instead of per project? #34

Closed Lokathor closed 5 years ago

Lokathor commented 5 years ago

Would it be possible to change the project's general setup so that the C++ binaries go into the .cargo/bin/ directory, instead of having them be built per project and per project profile?

antiagainst commented 5 years ago

Hey @Lokathor, I intentionally disabled building binary targets from the dependent C++ projects because

But I'm not exactly sure about your use case. If you can call the C++ binaries instead, then you don't need the Rust library wrapper, which is for integrating with other Rust modules? :)

Lokathor commented 5 years ago

Maybe I don't understand how the crate works? When I built it on my machine I end up with binaries deep inside my target directory

d:\dev\learn-gfx-hal\target\debug\build\shaderc-0b3a14f59f26d605\out\bin>dir
 Volume in drive D is Data
 Volume Serial Number is B265-51AB

 Directory of d:\dev\learn-gfx-hal\target\debug\build\shaderc-0b3a14f59f26d605\out\bin

2019-01-25  09:07 PM    <DIR>          .
2019-01-25  09:07 PM    <DIR>          ..
2019-01-25  09:06 PM         3,981,312 glslangValidator.exe
2019-01-25  09:06 PM         4,111,360 glslc.exe
2019-01-25  09:07 PM         4,038,144 shaderc_shared.dll
2019-01-15  09:01 AM               866 spirv-lesspipe.sh
2019-01-25  09:07 PM           218,624 spirv-remap.exe
2019-01-25  09:06 PM         1,156,608 SPIRV-Tools-shared.dll

Are those not important to the actual use of the crate? If they're not, why are they there. If they are, do I need to ship them with my program if I want my program to be able to compile GLSL->SPIRV?

Because of their existence, I assumed that the crate is just calling out to them to do the work, but I guess I could be totally wrong.

antiagainst commented 5 years ago

Hey @Lokathor, sorry for the late reply. The binaries compiled from C++ projects are not needed. (I turned off binary compilation switches in the build script but it seems some are not controlled by those switches, and they are still being compiled.) For those C++ projects, only libshaderc_combined.a is needed, which is linked into libshaderc.rlib for the Rust crate.

Lokathor commented 5 years ago

Ah ha! This explains a lot!

Well, I guess instead you've got a bug where some binaries are being built in error.

antiagainst commented 5 years ago

Thanks @Lokathor, it would be nice if you can open another issue for the bug of "some binaries are being built in error."

I'll close this one for now. :)