Skip to content

Commit 479e77e

Browse files
committed
Update documentation.
1 parent fe7e959 commit 479e77e

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

tss-esapi-sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cfg-if = "1.0.0"
2222
semver = "1.0.7"
2323

2424
[target.'cfg(windows)'.build-dependencies]
25-
msbuild = { git = "https://github.com/uglyoldbob/msbuild.git", optional = true }
25+
msbuild = { version = "0.1.0", optional = true }
2626
winreg = {version = "0.52", optional = true }
2727

2828
[features]

tss-esapi-sys/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ available, feel free to raise a Pull Request to add it or to use build-time
4141
generation of bindings. All the committed bindings **MUST** be generated from
4242
the library version found under the `vendor` submodule.
4343

44+
## Bundled feature
45+
46+
There is a feature called bundled which downloads tpm2-tss source from github and compiles it using visual studio. It will usually be paired with the generate-bindings feature.
47+
48+
# Windows
49+
50+
Compiling for windows requires a bit of setup to work with the bundled feature.
51+
52+
* Openssl must be installed to a non-standard location at C:\OpenSSL-v11-Win64
53+
* Visual studio 2017 must be installed with the Clang/C2 experimental component, and windows sdk 10.0.17134.0.
54+
4455
## Cross compiling
4556

4657
Cross-compilation can be done as long as you have on your build system the TSS

tss-esapi-sys/build.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ pub mod tpm2_tss {
7777
}
7878

7979
impl Installation {
80+
/// Return an optional list of clang arguments that are platform specific
81+
#[cfg(feature = "bundled")]
8082
fn platform_args() -> Option<Vec<String>> {
8183
cfg_if::cfg_if! {
8284
if #[cfg(windows)] {
8385
let mut clang_args: Vec<String> = Vec::new();
8486
let hklm = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE);
87+
// Find the windows sdk path from the windows registry
8588
let sdk_entry = hklm.open_subkey("SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0").unwrap();
89+
// add relevant paths to get to the windows 10.0.17134.0 sdk, which tpm2-tss uses on windows.
8690
let installation_path: String = sdk_entry.get_value("InstallationFolder").unwrap();
8791
let ip_pb = PathBuf::from(installation_path).join("Include");
8892
let windows_sdk = ip_pb.join("10.0.17134.0");
93+
// Add paths required for bindgen to find all required headers
8994
clang_args.push(format!("-I{}", windows_sdk.join("ucrt").display()));
9095
clang_args.push(format!("-I{}", windows_sdk.join("um").display()));
9196
clang_args.push(format!("-I{}", windows_sdk.join("shared").display()));
@@ -125,7 +130,7 @@ pub mod tpm2_tss {
125130
repo_path
126131
}
127132

128-
#[cfg(feature = "bundled")]
133+
#[cfg(all(feature = "bundled",not(windows)))]
129134
fn compile_with_autotools(p: PathBuf) -> PathBuf {
130135
let output1 = std::process::Command::new("./bootstrap")
131136
.current_dir(&p)
@@ -332,7 +337,7 @@ pub mod tpm2_tss {
332337
let build_string = match profile.as_str() {
333338
"debug" => "Debug",
334339
"release" => "Release",
335-
_ => panic!("Unknown cargo profile:"),
340+
_ => panic!("Unknown cargo profile: {}", profile),
336341
};
337342
let mut source_path = self
338343
.tss2_esys
@@ -342,7 +347,6 @@ pub mod tpm2_tss {
342347
source_path.pop();
343348
source_path.pop();
344349
source_path.pop();
345-
println!("Source path is {}", source_path.display());
346350
println!(
347351
"cargo:rustc-link-search=dylib={}",
348352
source_path.join("x64").join(build_string).display()

0 commit comments

Comments
 (0)