BenjaminRi / winresource

Create and set windows icons and metadata for executables with a rust build script
MIT License
49 stars 10 forks source link

Improve usage document in README.md #14

Closed rhysd closed 1 year ago

rhysd commented 1 year ago

This PR improves usage document in README.md.

BenjaminRi commented 1 year ago

Unfortunately, this doesn't work. The crate can be used in cross-compile scenarios, so what matters is the target operating system. However, even #[cfg(windows)] or #[cfg(target_os = "windows")] is not the proper condition attribute, as a build for Windows, compiled on Linux, will compile build.rs with target operating system Linux, hence not compiling the Windows part. This is also explained in the Readme. The examples in the Readme and the implementation of this detail are actually very carefully chosen to work around all these annoying corner cases. I know it's not perfect, and it sometimes compiles too much, but it's the best that can be done to work in a broad set of circumstances. Unfortunately, in cross-compilation scenarios, there is no way to use conditional compilation for the actual target we are compiling the library for when building build.rs, that is the root cause of the issue.

Indeed, the extern crate statement seems superfluous now. That change makes sense and I would merge that.

rhysd commented 1 year ago

Thank you for the point. Honestly I didn't consider cross-compilation at all. I'll update this branch tomorrow.

rhysd commented 1 year ago

I removed extern crate from document at c5e3473.

And I also fixed some typos which I found in API documents and sources at dd11dc1.

BenjaminRi commented 1 year ago

Please note, I haven't forgotten about your PR. I will look into it as soon as I have time.

rhysd commented 1 year ago

Yes, please take your pace. This PR isn't urgent.

BenjaminRi commented 1 year ago

Nice catch on the typos. Seems like this repository was plagued with typos, which can also be seen in the commit history. It's good to get rid of those.

Merged. Thank you for your contribution.