Crates.io | thound |
lib.rs | thound |
version | 0.1.1 |
source | src |
created_at | 2023-06-14 13:55:49.436523 |
updated_at | 2023-06-23 17:32:56.100961 |
description | Finds the folders with VC toolchain and Windows SDK |
homepage | |
repository | https://github.com/den-mentiei/thound |
max_upload_size | |
id | 890159 |
size | 26,852 |
The purpose of this is to find the folders that contain libraries you may need to link against, on Windows, if you are linking with any compiled C or C++ code. This will be necessary for many non-C++ programming language environments that wnat to provide compatibility.
Add thound
to your Cargo.toml
:
[dependencies]
thound = "0.1"
The usage is pretty straight-forward, just call the only available function and use the result with information contained:
fn main() {
let info = thound::find_vc_and_windows_sdk();
println!("{info:#?}");
}
...and it will emit something like the following:
Some(
Info {
sdk: Some(
SdkInfo {
major_version: 10,
root: "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0",
um_lib_path: "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x64",
ucrt_lib_path: "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\ucrt\\x64",
},
),
toolchain: Some(
ToolchainInfo {
exe_path: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\Hostx64\\x64",
lib_path: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\lib\\x64",
},
),
},
)
One of the goals for this implementation was to be as dependency-free
and quick compiling as possible. As a result, this crate has zero
dependencies except std
.
Having no dependencies, means the code contains the minimal Windows
API & COM shenanigans, required to do its job. Those could be replaced
by windows-rs
, but it wasn't done on purpose.
The following is originally written by Jonathan Blow and it mirrors my thoughts and explains the reason for this crate to exist.
// I hate this kind of code. The fact that we have to do this at all
// is stupid, and the actual maneuvers we need to go through
// are just painful. If programming were like this all the time,
// I would quit.
//
// Because this is such an absurd waste of time, I felt it would be
// useful to package the code in an easily-reusable way
Microsoft provides its own solution to this problem, called "vswhere", is a much bigger program (a binary then!) I don't want to deal with in most cases.
This crate is licensed under the MIT license. Implementation is a Rust port of the Original code by Jonathan Blow, which was released under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Thound by you, shall be licensed as MIT, without any additional terms or conditions.