Skip to content

Commit 8141f0e

Browse files
kyleflemingalexcrichton
authored andcommitted
Support for ASM_FLAGS (#86)
* Add support for ASM_FLAGS * Use c_cfg when determining asm_compiler
1 parent 7fdc5d1 commit 8141f0e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub struct Config {
6060
generator: Option<OsString>,
6161
cflags: OsString,
6262
cxxflags: OsString,
63+
asmflags: OsString,
6364
defines: Vec<(OsString, OsString)>,
6465
deps: Vec<String>,
6566
target: Option<String>,
@@ -106,6 +107,7 @@ impl Config {
106107
generator: None,
107108
cflags: OsString::new(),
108109
cxxflags: OsString::new(),
110+
asmflags: OsString::new(),
109111
defines: Vec::new(),
110112
deps: Vec::new(),
111113
profile: None,
@@ -146,6 +148,14 @@ impl Config {
146148
self
147149
}
148150

151+
/// Adds a custom flag to pass down to the ASM compiler, supplementing those
152+
/// that this library already passes.
153+
pub fn asmflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config {
154+
self.asmflags.push(" ");
155+
self.asmflags.push(flag.as_ref());
156+
self
157+
}
158+
149159
/// Adds a new `-D` flag to pass to cmake during the generation step.
150160
pub fn define<K, V>(&mut self, k: K, v: V) -> &mut Config
151161
where
@@ -337,6 +347,7 @@ impl Config {
337347
}
338348
let c_compiler = c_cfg.get_compiler();
339349
let cxx_compiler = cxx_cfg.get_compiler();
350+
let asm_compiler = c_cfg.get_compiler();
340351

341352
let dst = self
342353
.out_dir
@@ -650,6 +661,7 @@ impl Config {
650661

651662
set_compiler("C", &c_compiler, &self.cflags);
652663
set_compiler("CXX", &cxx_compiler, &self.cxxflags);
664+
set_compiler("ASM", &asm_compiler, &self.asmflags);
653665
}
654666

655667
if !self.defined("CMAKE_BUILD_TYPE") {

0 commit comments

Comments
 (0)