mcgoo/vcpkg-rs

Find libs and crates in a Vcpkg installation

Vcpkg installation from cargo build scripts

vcpkg-rs

Documentation Changelog

This is a helper for finding libraries in a Vcpkg installation from cargo build scripts. It works similarly to pkg-config. It works on Windows (MSVC ABI), Linux and MacOS.

Example

Find the library named foo in a Vcpkg installation and emit cargo metadata to link it:

// build.rs
fn main() {
    vcpkg::find_package("foo").unwrap();
}

See the crate documentation for more information. See cargo-vcpkg for a convenient way of creating a vcpkg installation.

License

See LICENSE-APACHE, and LICENSE-MIT for details.

Issues

Collection of the latest Issues

nico-abram

nico-abram

Comment Icon1

I'm using some dependencies which use this crate to link C/C++ libraries on windows (For example leptonica and tesseract).

I am trying to enable cross-language LTO on a build targeting x86_64-pc-windows-msvc. This requires compiling C/C++ code using an LLVM compiler, which means not using MSVC's cl.exe compiler. I have gotten it to compile using clang-cl instead of MSVC's cl.exe and lld-link.exe instead of link.exe manually building the C/C++ code and instructing my dependencies via env vars to not use this crate and instead use the libs I generated, but I think ideally vcpkg can be made to work with it.

I found this issue https://github.com/microsoft/vcpkg/issues/2087 about clang-cl support in vcpkg, which was closed and vcpkg does not support a triplet for it, not as an official triplet, nor as a community maintained triplet shipped with vcpkg. However, vcpkg has support for "custom triplets" which are even less supported than community and you have to manually add to the vcpkg/triplets folder. And in that issue, someone shared their github repository with custom triplets which includes a x64-windows-llvm triplet that uses clang-cl. I'm opening this issue to check/discuss if somehow (Maybe through an environment variable) custom vcpkg triplet support would be in scope for this crate.

I am essentially thinking of something like:

MrMuetze

MrMuetze

Comment Icon8

Hey everyone 👋 I was looking into vcpkg and how it could work with cargo and Rust and found this crate. I like how easily the integration works with the build.rs file, but since I would like to use the "version" feature of vcpkg. Yet versions are only supported in the manifest mode in which dependencies are read from the manifest file and then being installed in the project directory.

I had a look at the code and noticed that, to support manifest mode, the paths like e.g. status_path, lib_path, bin_path etc. need to be changed. Hardcoding a different root directory seemed to easily allow me to use this crate even in manifest mode.

Now I would like to discuss how to go about this. In manifest mode, a vcpkg.json file exists in the root of the Rust project. Would it make sense to check the existence of such a file and then automatically make the adjustments to the paths? Or should the user set an environment variable to let the crate now that it should look for packages in the project directory first? Or maybe it should always check the project directory first?

I'm hoping that we can make this crate even better! If we find a valid approach I can give it a go to implement it myself and then create a pull request.

Best regards, Björn

Information - Updated May 12, 2022

Stars: 71
Forks: 10
Issues: 6

Repositories & Extras

quest-hook-template

A template for writing mods for Quest il2cpp games in Rust using cargo generate to clone the template:

quest-hook-template

Command line json text parsing and processing utility

parsing json compliant with rust and cargo

Command line json text parsing and processing utility

Clone this repo: git clone

If you don't have Rust and cargo-make installed,

Clone this repo: git clone

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool

Address generator in Rust

If you have Rust: cargo install gemgen

Address generator in Rust

cargo rssc - Rust scripts for crates building

will copy the template_basic into scripts_rssc folder

cargo rssc - Rust scripts for crates building

NES Emulator in Rust-WASM

Requires Rust with cargo, nodejs, and wasm-pack

NES Emulator in Rust-WASM

Terraformer Engine

A 3D game engine but completely in rust/std/cargo

Terraformer Engine

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool

OPM (Oxidized Package Manager) 📦

rust and cargo installed on your machine

OPM (Oxidized Package Manager) 📦

A Neofetch clone written in Rust

  download and install Rust and Cargo using Rustup

A Neofetch clone written in Rust
Facebook Instagram Twitter GitHub Dribbble
Privacy