Skip to content

Commit

Permalink
Add the host architecture Windows 10 SDK bin directory to the PATH, n…
Browse files Browse the repository at this point in the history
…ot the target.

Fixes failures during cross-compilation when the host cannot execute the target architecture
Windows 10 SDK tools.
  • Loading branch information
arlosi committed Jul 2, 2020
1 parent da806ad commit 71a9f5e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
rust: stable
target: aarch64-apple-ios
no_run: --no-run
- build: windows-aarch64
os: windows-latest
rust: stable
target: aarch64-pc-windows-msvc
no_run: --no-run
- build: win32
os: windows-2016
rust: stable-i686-msvc
Expand Down
5 changes: 5 additions & 0 deletions cc-test/src/aarch64.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
asm PROC
MOV W0, 7
RET
asm ENDP
END
13 changes: 10 additions & 3 deletions src/windows_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,15 @@ mod impl_ {
let sub = lib_subdir(target)?;
let (ucrt, ucrt_version) = get_ucrt_dir()?;

let host = match host_arch() {
X86 => "x86",
X86_64 => "x64",
AARCH64 => "arm64",
_ => return None,
};

tool.path
.push(ucrt.join("bin").join(&ucrt_version).join(sub));
.push(ucrt.join("bin").join(&ucrt_version).join(host));

let ucrt_include = ucrt.join("include").join(&ucrt_version);
tool.include.push(ucrt_include.join("ucrt"));
Expand All @@ -434,7 +441,7 @@ mod impl_ {
tool.libs.push(ucrt_lib.join("ucrt").join(sub));

if let Some((sdk, version)) = get_sdk10_dir() {
tool.path.push(sdk.join("bin").join(sub));
tool.path.push(sdk.join("bin").join(host));
let sdk_lib = sdk.join("lib").join(&version);
tool.libs.push(sdk_lib.join("um").join(sub));
let sdk_include = sdk.join("include").join(&version);
Expand All @@ -443,7 +450,7 @@ mod impl_ {
tool.include.push(sdk_include.join("winrt"));
tool.include.push(sdk_include.join("shared"));
} else if let Some(sdk) = get_sdk81_dir() {
tool.path.push(sdk.join("bin").join(sub));
tool.path.push(sdk.join("bin").join(host));
let sdk_lib = sdk.join("lib").join("winv6.3");
tool.libs.push(sdk_lib.join("um").join(sub));
let sdk_include = sdk.join("include");
Expand Down

0 comments on commit 71a9f5e

Please sign in to comment.