Skip to content

Commit 710271f

Browse files
author
bors-servo
authored
Auto merge of #22844 - paulrouget:capi-header, r=SimonSapin
Generate simpleservo.h Fix #22834 Waiting on mozilla/cbindgen#271 <!-- 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/22844) <!-- Reviewable:end -->
2 parents 7f2b8e6 + 792ed8a commit 710271f

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

Cargo.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ports/libsimpleservo/capi/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ simpleservo = { path = "../api" }
1717
log = "0.4"
1818
env_logger = "0.6"
1919

20+
[build-dependencies]
21+
cbindgen = "0.8"
22+
2023
[features]
2124
default = ["unstable", "default-except-unstable"]
2225
default-except-unstable = ["webdriver", "max_log_level"]

ports/libsimpleservo/capi/build.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4+
5+
use std::env;
6+
7+
fn main() {
8+
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
9+
let target_dir = env::var("CARGO_TARGET_DIR").unwrap();
10+
let profile_dir = env::var("PROFILE").unwrap();
11+
let dest = format!("{}/{}/{}", target_dir, profile_dir, "simpleservo.h");
12+
cbindgen::Builder::new()
13+
.with_crate(crate_dir)
14+
.with_language(cbindgen::Language::C)
15+
.generate()
16+
.expect("Unable to generate bindings")
17+
.write_to_file(dest);
18+
}

0 commit comments

Comments
 (0)