Skip to content

Commit c9df4fa

Browse files
committed
Rename target variable to target_triplet
1 parent 8141f0e commit c9df4fa

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl Config {
305305
/// This will run both the build system generator command as well as the
306306
/// command to build the library.
307307
pub fn build(&mut self) -> PathBuf {
308-
let target = match self.target.clone() {
308+
let target_triplet = match self.target.clone() {
309309
Some(t) => t,
310310
None => {
311311
let mut t = getenv_unwrap("TARGET");
@@ -316,7 +316,7 @@ impl Config {
316316
}
317317
};
318318
let host = self.host.clone().unwrap_or_else(|| getenv_unwrap("HOST"));
319-
let msvc = target.contains("msvc");
319+
let msvc = target_triplet.contains("msvc");
320320
let ndk = self.uses_android_ndk();
321321
let mut c_cfg = cc::Build::new();
322322
c_cfg
@@ -327,7 +327,7 @@ impl Config {
327327
.host(&host)
328328
.no_default_flags(ndk);
329329
if !ndk {
330-
c_cfg.target(&target);
330+
c_cfg.target(&target_triplet);
331331
}
332332
let mut cxx_cfg = cc::Build::new();
333333
cxx_cfg
@@ -339,7 +339,7 @@ impl Config {
339339
.host(&host)
340340
.no_default_flags(ndk);
341341
if !ndk {
342-
cxx_cfg.target(&target);
342+
cxx_cfg.target(&target_triplet);
343343
}
344344
if let Some(static_crt) = self.static_crt {
345345
c_cfg.static_crt(static_crt);
@@ -383,7 +383,7 @@ impl Config {
383383
if let Some(ref generator) = self.generator {
384384
is_ninja = generator.to_string_lossy().contains("Ninja");
385385
}
386-
if target.contains("windows-gnu") {
386+
if target_triplet.contains("windows-gnu") {
387387
if host.contains("windows") {
388388
// On MinGW we need to coerce cmake to not generate a visual
389389
// studio build system but instead use makefiles that MinGW can
@@ -440,22 +440,22 @@ impl Config {
440440
// This also guarantees that NMake generator isn't chosen implicitly.
441441
let using_nmake_generator;
442442
if self.generator.is_none() {
443-
cmd.arg("-G").arg(self.visual_studio_generator(&target));
443+
cmd.arg("-G").arg(self.visual_studio_generator(&target_triplet));
444444
using_nmake_generator = false;
445445
} else {
446446
using_nmake_generator = self.generator.as_ref().unwrap() == "NMake Makefiles";
447447
}
448448
if !is_ninja && !using_nmake_generator {
449-
if target.contains("x86_64") {
449+
if target_triplet.contains("x86_64") {
450450
cmd.arg("-Thost=x64");
451451
cmd.arg("-Ax64");
452-
} else if target.contains("thumbv7a") {
452+
} else if target_triplet.contains("thumbv7a") {
453453
cmd.arg("-Thost=x64");
454454
cmd.arg("-Aarm");
455-
} else if target.contains("aarch64") {
455+
} else if target_triplet.contains("aarch64") {
456456
cmd.arg("-Thost=x64");
457457
cmd.arg("-AARM64");
458-
} else if target.contains("i686") {
458+
} else if target_triplet.contains("i686") {
459459
use cc::windows_registry::{find_vs_version, VsVers};
460460
match find_vs_version() {
461461
Ok(VsVers::Vs16) => {
@@ -468,14 +468,14 @@ impl Config {
468468
_ => {}
469469
};
470470
} else {
471-
panic!("unsupported msvc target: {}", target);
471+
panic!("unsupported msvc target: {}", target_triplet);
472472
}
473473
}
474-
} else if target.contains("redox") {
474+
} else if target_triplet.contains("redox") {
475475
if !self.defined("CMAKE_SYSTEM_NAME") {
476476
cmd.arg("-DCMAKE_SYSTEM_NAME=Generic");
477477
}
478-
} else if target.contains("solaris") {
478+
} else if target_triplet.contains("solaris") {
479479
if !self.defined("CMAKE_SYSTEM_NAME") {
480480
cmd.arg("-DCMAKE_SYSTEM_NAME=SunOS");
481481
}

0 commit comments

Comments
 (0)