Skip to content

Added x86 toolset fix for Visual Studio 2019 #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,25 @@ impl Config {
} else {
using_nmake_generator = self.generator.as_ref().unwrap() == "NMake Makefiles";
}
if target.contains("x86_64") && !is_ninja && !using_nmake_generator {
cmd.arg("-Thost=x64");
cmd.arg("-DCMAKE_GENERATOR_PLATFORM=x64");
if !is_ninja && !using_nmake_generator {
if target.contains("x86_64") {
cmd.arg("-Thost=x64");
cmd.arg("-Ax64");
} else if target.contains("i686") {
use cc::windows_registry::{find_vs_version, VsVers};
match find_vs_version() {
Ok(VsVers::Vs16) => {
// 32-bit x86 toolset used to be the default for all hosts,
// but Visual Studio 2019 changed the default toolset to match the host,
// so we need to manually override it for x86 targets
cmd.arg("-Thost=x86");
cmd.arg("-AWin32");
}
_ => {}
};
} else {
panic!("unsupported msvc target: {}", target);
}
}
} else if target.contains("redox") {
if !self.defined("CMAKE_SYSTEM_NAME") {
Expand Down