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

Allow passing include paths to windres/rc #32

Closed roblabla closed 3 years ago

roblabla commented 3 years ago

windres, rc and llvm-rc (through the C preprocessor) all have the ability to pass additional include paths to be used by the preprocessor, e.g. windres -I path or rc /I path. Exposing this to the command line would be useful to allow users to generate header files that they could then use in their resource.rc.

This would allow some more sophisticated resource files to get embedded. Here, for instance, we generate a cargo.h that contains defines for various environment variables cargo gives us, and an RC file that includes it and uses it to generate a VS_VERSION_INFO section with the correct version.

nabijaczleweli commented 3 years ago

Does the current master branch (at least 0e2520188990221e7b95e5f7f76ab40b2230199e) work for you? It just always adds $OUT_DIR to the include path, which I think is preferable for 99% of use-cases, and I'm not too too hot on adding another overload to compile() or parsing an environment variable, until that's actually needed, at least.

roblabla commented 3 years ago

Yeah, that's probably enough for my use-case. Thanks!

nabijaczleweli commented 3 years ago

Cool, released in v1.6.0!

roblabla commented 3 years ago

Can confirm it works!