gecko-dev/mozglue/static/rust/build.rs
Sylvestre Ledru cafbe9915b Bug 1617369 - Reformat mozglue/ using rustfmt r=glandium
Depends on D64873

Differential Revision: https://phabricator.services.mozilla.com/D64874

--HG--
extra : moz-landing-system : lando
2020-03-04 06:12:38 +00:00

39 lines
1.2 KiB
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::env;
use std::path::PathBuf;
fn main() {
let dist_path = {
let path = PathBuf::from(env::var_os("MOZ_DIST").unwrap());
if !path.is_absolute() || !path.is_dir() {
panic!(
"MOZ_DIST must be an absolute directory, was: {}",
path.display()
);
}
path
};
let topobjdir = {
let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap());
if !path.is_absolute() || !path.is_dir() {
panic!(
"MOZ_TOPOBJDIR must be an absolute directory, was: {}",
path.display()
);
}
path
};
let mut build = cc::Build::new();
build.cpp(true);
// For js-confdefs.h, see wrappers.cpp.
build.include(topobjdir.join("js").join("src"));
build.include(dist_path.join("include"));
build.define("MOZ_HAS_MOZGLUE", None);
build.file("wrappers.cpp");
build.compile("wrappers");
println!("cargo:rerun-if-changed=wrappers.cpp");
}