Skip to content

Commit 6a2ce3d

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

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/lib.rs

Lines changed: 14 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,23 @@ 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")
444+
.arg(self.visual_studio_generator(&target_triplet));
444445
using_nmake_generator = false;
445446
} else {
446447
using_nmake_generator = self.generator.as_ref().unwrap() == "NMake Makefiles";
447448
}
448449
if !is_ninja && !using_nmake_generator {
449-
if target.contains("x86_64") {
450+
if target_triplet.contains("x86_64") {
450451
cmd.arg("-Thost=x64");
451452
cmd.arg("-Ax64");
452-
} else if target.contains("thumbv7a") {
453+
} else if target_triplet.contains("thumbv7a") {
453454
cmd.arg("-Thost=x64");
454455
cmd.arg("-Aarm");
455-
} else if target.contains("aarch64") {
456+
} else if target_triplet.contains("aarch64") {
456457
cmd.arg("-Thost=x64");
457458
cmd.arg("-AARM64");
458-
} else if target.contains("i686") {
459+
} else if target_triplet.contains("i686") {
459460
use cc::windows_registry::{find_vs_version, VsVers};
460461
match find_vs_version() {
461462
Ok(VsVers::Vs16) => {
@@ -468,14 +469,14 @@ impl Config {
468469
_ => {}
469470
};
470471
} else {
471-
panic!("unsupported msvc target: {}", target);
472+
panic!("unsupported msvc target: {}", target_triplet);
472473
}
473474
}
474-
} else if target.contains("redox") {
475+
} else if target_triplet.contains("redox") {
475476
if !self.defined("CMAKE_SYSTEM_NAME") {
476477
cmd.arg("-DCMAKE_SYSTEM_NAME=Generic");
477478
}
478-
} else if target.contains("solaris") {
479+
} else if target_triplet.contains("solaris") {
479480
if !self.defined("CMAKE_SYSTEM_NAME") {
480481
cmd.arg("-DCMAKE_SYSTEM_NAME=SunOS");
481482
}

0 commit comments

Comments
 (0)