-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.rs
31 lines (28 loc) · 938 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-FileCopyrightText: © 2020 EteSync Authors
// SPDX-License-Identifier: LGPL-2.1-only
extern crate cbindgen;
use std::env;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
if cfg!(unix) && !cfg!(macos) {
// Set soname for platforms other than Windows
const VERSION_MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");
println!(
"cargo:rustc-cdylib-link-arg=-Wl,-soname,libetebase.so.{}",
VERSION_MAJOR
);
}
match cbindgen::generate(crate_dir) {
Ok(gen) => gen,
Err(e) => match e {
// Ignore syntax errors because those will be handled later on by cargo build.
cbindgen::Error::ParseSyntaxError {
crate_name: _,
src_path: _,
error: _,
} => return,
_ => panic!("{:?}", e),
},
}
.write_to_file("target/etebase.h");
}