rust/hg-core/build.rs
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 16 Mar 2020 14:33:35 -0400
changeset 44647 99fa161a883c
parent 44305 d8d4fa9a7f18
child 44713 97c10b157665
permissions -rw-r--r--
phabricator: extract the logic to amend diff properties to a function This will be needed on a separate code path when dealing with folding revisions. And since we know that will involve adding multiple local commmits to the diff properties instead of just one, restructure the logic slightly to allow it. Differential Revision: https://phab.mercurial-scm.org/D8312
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
}