Skip to content

Commit 5e049c8

Browse files
authored
Merge pull request #53 from gnzlbg/verbose
Very verbose option
2 parents 82dc592 + 9c60cbd commit 5e049c8

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/lib.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ pub struct Config {
7373
uses_cxx11: bool,
7474
always_configure: bool,
7575
no_build_target: bool,
76+
verbose_cmake: bool,
77+
verbose_make: bool,
7678
}
7779

7880
/// Builds the native library rooted at `path` with the default cmake options.
@@ -117,6 +119,8 @@ impl Config {
117119
uses_cxx11: false,
118120
always_configure: true,
119121
no_build_target: false,
122+
verbose_cmake: false,
123+
verbose_make: false,
120124
}
121125
}
122126

@@ -253,6 +257,13 @@ impl Config {
253257
self
254258
}
255259

260+
/// Sets very verbose output.
261+
pub fn very_verbose(&mut self, value: bool) -> &mut Config {
262+
self.verbose_cmake = value;
263+
self.verbose_make = value;
264+
self
265+
}
266+
256267
/// Run this configuration, compiling the library with all the configured
257268
/// options.
258269
///
@@ -319,6 +330,12 @@ impl Config {
319330
// Build up the first cmake command to build the build system.
320331
let executable = env::var("CMAKE").unwrap_or("cmake".to_owned());
321332
let mut cmd = Command::new(executable);
333+
334+
if self.verbose_cmake {
335+
cmd.arg("-Wdev");
336+
cmd.arg("--debug-output");
337+
}
338+
322339
cmd.arg(&self.path)
323340
.current_dir(&build);
324341
if target.contains("windows-gnu") {
@@ -506,6 +523,10 @@ impl Config {
506523
cmd.arg(&format!("-DCMAKE_BUILD_TYPE={}", profile));
507524
}
508525

526+
if self.verbose_make {
527+
cmd.arg("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON");
528+
}
529+
509530
if !self.defined("CMAKE_TOOLCHAIN_FILE") {
510531
if let Ok(s) = env::var("CMAKE_TOOLCHAIN_FILE") {
511532
cmd.arg(&format!("-DCMAKE_TOOLCHAIN_FILE={}", s));
@@ -572,11 +593,12 @@ impl Config {
572593
if !self.no_build_target {
573594
cmd.arg("--target").arg(target);
574595
}
596+
cmd.arg("--config").arg(&profile)
597+
.arg("--").args(&self.build_args)
598+
.args(&parallel_args)
599+
.current_dir(&build);
575600

576-
run(cmd.arg("--config").arg(&profile)
577-
.arg("--").args(&self.build_args)
578-
.args(&parallel_args)
579-
.current_dir(&build), "cmake");
601+
run(&mut cmd, "cmake");
580602

581603
println!("cargo:root={}", dst.display());
582604
return dst

0 commit comments

Comments
 (0)