mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Auto merge of #23830 - servo:jdm-patch-43, r=paulrouget
Generate simpleservo.h in appropriate target directory. This change makes the C API's build script take the the actual build target into account when generating the C header. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23794 - [x] These changes do not require tests because no tests for UWP build. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23830) <!-- Reviewable:end -->
This commit is contained in:
commit
55cea0dd64
1 changed files with 10 additions and 2 deletions
|
@ -3,17 +3,25 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
let target_dir = env::var("CARGO_TARGET_DIR").unwrap();
|
let target_dir = env::var("CARGO_TARGET_DIR").unwrap();
|
||||||
|
let mut path: PathBuf = [crate_dir.clone(), target_dir].iter().collect();
|
||||||
|
let target = env::var("TARGET").unwrap();
|
||||||
|
let host = env::var("HOST").unwrap();
|
||||||
|
if target != host {
|
||||||
|
path.push(target);
|
||||||
|
}
|
||||||
let profile_dir = env::var("PROFILE").unwrap();
|
let profile_dir = env::var("PROFILE").unwrap();
|
||||||
let dest = format!("{}/{}/{}", target_dir, profile_dir, "simpleservo.h");
|
path.push(profile_dir);
|
||||||
|
path.push("simpleservo.h");
|
||||||
cbindgen::Builder::new()
|
cbindgen::Builder::new()
|
||||||
.with_crate(crate_dir)
|
.with_crate(crate_dir)
|
||||||
.with_language(cbindgen::Language::C)
|
.with_language(cbindgen::Language::C)
|
||||||
.exclude_item("OutputDebugStringA")
|
.exclude_item("OutputDebugStringA")
|
||||||
.generate()
|
.generate()
|
||||||
.expect("Unable to generate bindings")
|
.expect("Unable to generate bindings")
|
||||||
.write_to_file(dest);
|
.write_to_file(path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue