rust/hg-core/build.rs
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 28 Feb 2020 00:17:26 +0100
changeset 44407 f6798c1a80fa
parent 44305 d8d4fa9a7f18
child 44713 97c10b157665
permissions -rw-r--r--
transaction: clarify the logic around pre-finalize/post-finalize I am taking a bit more verbose route, but I find it easier to follow for people who (re)discover the code. (This is a gratuitous cleanup I did while looking at something else.) Differential Revision: https://phab.mercurial-scm.org/D8176

// build.rs
//
// Copyright 2020 Raphaël Gomès <rgomes@octobus.net>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.

#[cfg(feature = "with-re2")]
use cc;

#[cfg(feature = "with-re2")]
fn compile_re2() {
    cc::Build::new()
        .cpp(true)
        .flag("-std=c++11")
        .file("src/re2/rust_re2.cpp")
        .compile("librustre.a");

    println!("cargo:rustc-link-lib=re2");
}

fn main() {
    #[cfg(feature = "with-re2")]
    compile_re2();
}