2 releases
0.1.1 | Jun 23, 2023 |
---|---|
0.1.0 | Jun 14, 2023 |
#414 in Build Utils
60 downloads per month
26KB
547 lines
T H O U N D
Overview
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.
Getting started
Add thound
to your Cargo.toml
:
[dependencies]
thound = "0.1"
Usage
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",
},
),
},
)
Implementation notes
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.
Note
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
Alternatives
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.
License
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.
Contribution
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.