author | Raphaël Gomès <rgomes@octobus.net> |
Fri, 13 Mar 2020 00:41:22 +0100 | |
changeset 44562 | ece43c79333e |
parent 44305 | d8d4fa9a7f18 |
child 44713 | 97c10b157665 |
permissions | -rw-r--r-- |
44305
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
1 |
// build.rs |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
2 |
// |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
3 |
// Copyright 2020 Raphaël Gomès <rgomes@octobus.net> |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
4 |
// |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
5 |
// This software may be used and distributed according to the terms of the |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
6 |
// GNU General Public License version 2 or any later version. |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
7 |
|
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
8 |
#[cfg(feature = "with-re2")] |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
9 |
use cc; |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
10 |
|
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
11 |
#[cfg(feature = "with-re2")] |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
12 |
fn compile_re2() { |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
13 |
cc::Build::new() |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
14 |
.cpp(true) |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
15 |
.flag("-std=c++11") |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
16 |
.file("src/re2/rust_re2.cpp") |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
17 |
.compile("librustre.a"); |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
18 |
|
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
19 |
println!("cargo:rustc-link-lib=re2"); |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
20 |
} |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
21 |
|
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
22 |
fn main() { |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
23 |
#[cfg(feature = "with-re2")] |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
24 |
compile_re2(); |
d8d4fa9a7f18
rust-re2: add wrapper for calling Re2 from Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
25 |
} |