Git Product home page Git Product logo

winres's Introduction

winres

A simple library to facilitate adding metainformation and icons to windows executables and dynamic libraries.

Documentation

Toolkit

Before we begin you need to have the approptiate tools installed.

If you are using Rust with the MSVC ABI you will need the Windows SDK, for the GNU ABI you'll need minGW64.

Windows SDK can be found in the registry, minGW64 has to be in the path.

Using winres

First, you will need to add a build script to your crate (build.rs) by adding it to your crate's Cargo.toml file:

[package]
#...
build = "build.rs"

[build-dependencies]
winres = "0.1"

Next, you have to write a build script. A short example is shown below.

// build.rs

extern crate winres;

fn main() -> io::Result<()> {
  if cfg!(target_os = "windows") {
    let mut res = winres::WindowsResource::new();
    res.set_icon("test.ico");
    res.compile().unwrap();
  }
}

Thats, it. The file test.ico should be located in the same directory as build.rs. Metainformation, like program version and description are taken from Cargo.toml's [package] section.

Additional Options

For added convenience, winres parses, Cargo.toml for a package.metadata.winres section:

[package.metadata.winres]
OriginalFilename = "PROGRAM.EXE"
LeagalCopyright = "Copyright © 2016"
#...

This section may contain arbitrary string key-value pairs, to be included in the version info section of the executable/library file.

Some keys have special meanings, and will be shown in the file properties of the Windows Explorer:

FileDescription, ProductName, ProductVersion, OriginalFilename and LegalCopyright

See MSDN for more details on the version info section of executables/libraries.

About this project

I've written this crate chiefly for my personal projects, and although I've tested it on my personal computers I have no idea if the behaviour is the same everywhere.

To be brief, I'm very much reliant on your bug reports and feature suggestions to make this crate better.

winres's People

Contributors

mxre avatar coder206 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.