#build-system #native #running #fork #instructions #ninja #meson

build meson-next

A build dependency crate for running Meson to build a native library

10 stable releases

Uses old Rust 2015

1.2.3 Jun 11, 2024
1.2.2 Dec 26, 2022
1.0.1 Nov 27, 2022

#183 in Build Utils

Download history 47/week @ 2024-08-20 57/week @ 2024-08-27 67/week @ 2024-09-03 102/week @ 2024-09-10 40/week @ 2024-09-17 24/week @ 2024-09-24 18/week @ 2024-10-01 10/week @ 2024-10-08 3/week @ 2024-10-15 5/week @ 2024-10-22 13/week @ 2024-10-29 38/week @ 2024-11-05 62/week @ 2024-11-12 22/week @ 2024-11-19 1/week @ 2024-11-26 17/week @ 2024-12-03

105 downloads per month
Used in 2 crates (via libvmaf-sys)

MIT license

7KB
86 lines

Rust meson-next crate

A build dependency crate for running Meson to build a native library.

This crate is a simple wrapper that invokes the system's meson binary.

Ensure you have both meson and ninja installed. Refer to Meson's manual for specific install instructions for your OS.

This crate is a fork of meson 1.0 by dovee, which is abandoned.

Build Example

.
├── build.rs
├── Cargo.toml
├── clib
│   ├── meson.build
│   ├── squid.h
│   └── squid.c
└── src
    └── lib.rs

build.rs:

extern crate meson_next as meson;
use std::env;
use std::path::PathBuf;

fn main() {
    let build_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    build_path.join("build");
    let build_path = build_path.to_str().unwrap();

    let mut options = HashMap::new();
    options.insert("key", "value");

    let config = meson::Config::new().options(options);

    println!("cargo:rustc-link-lib=squid");
    println!("cargo:rustc-link-search=native={}", build_path);
    meson::build("clib", build_path, config);
}

Cargo.toml:

# ...

[build-dependencies]
meson-next = "1"

meson.build:

project('squid', 'c')
shared_library('squid', 'squid.c')

No runtime deps