nabijaczleweli / rust-embed-resource

A Cargo build script library to handle compilation and inclusion of Windows resources, in the most resilient fashion imaginable
MIT License
166 stars 29 forks source link

Feature request: preprocessor defines #52

Closed kb-1000 closed 1 year ago

kb-1000 commented 1 year ago

If I have multiple binaries in one project and want to share the rc files between them, I would end up with the same file description (just like in a java distribution). Using the preprocessor, I could tell it which binary it is and have a #if in the rc file. windres appears to be using --define for this, while rc uses /D.

nabijaczleweli commented 1 year ago

Can you try the new master branch (at least 7a383c0de87431b90210532bd8a8ea8a40099a6f)? Just adding your list of macros to the end of the compile[_for]() call should work.

kb-1000 commented 1 year ago

Haven't been able to test this yet, but it's worth noting this would be a breaking change, and adding more parameters this way (like... include directories) would require further breaking changes in the future. What would you think about doing it more builder style like the cc crate?

nabijaczleweli commented 1 year ago

Yes, I have v2.0.0 tagged locally pending reporter confirmation. The last major bump (0.1.1 -> 1.1.0; 1.0.1 and 1.0.0 didn't happen (defined as being massive fuckups, IIRC)) was in January 2017 as part of the original bring-up; I think I can deal with one every six years. If somehow someone finds another part of the configuration space (and, well, that's pretty much all but exhausted), then the last parameter will become a config struct with a From IntoIterator impl for, hopefully, full interface compatibility, but we'll burn that bridge when we come to it, and precedent dictates that'll be in like 2029.

nabijaczleweli commented 1 year ago

Works for me; released despite reporter silence in v2.0.0.