Browse Source

Setup bindgen to generate bindings

Including ctest to generate tests for those bindings is blocked by this
issue: https://github.com/alexcrichton/ctest/issues/23

The build.rs script requires to pass the location of the VST-SDK at the
moment. I am pretty sure that neither pkgconfig, nor the equivalents
will find the SDK because it is often extracted somewhere below the
users home directory  and not installed through a package manager.
master
Andreas Linz 2 years ago
parent
commit
52a16378a9
Signed by: alinz GPG Key ID: 9BF39809C9DA580C
4 changed files with 30 additions and 0 deletions
  1. +3
    -0
      Cargo.toml
  2. +20
    -0
      build.rs
  3. +6
    -0
      src/lib.rs
  4. +1
    -0
      wrapper.h

+ 3
- 0
Cargo.toml View File

@ -5,3 +5,6 @@ authors = ["Andreas Linz "]
links = "vst"
[dependencies]
[build-dependencies]
bindgen = "*"

+ 20
- 0
build.rs View File

@ -0,0 +1,20 @@
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
let vst_include_path: String =
env::var("VST_INCLUDE_DIR").expect("VST_INCLUDE_DIR not set");
let bindings = bindgen::Builder::default()
.clang_arg(format!("-I{}", vst_include_path))
.header("wrapper.h")
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Failed to write bindings");
}

+ 6
- 0
src/lib.rs View File

@ -1,3 +1,9 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[cfg(test)]
mod tests {
#[test]

+ 1
- 0
wrapper.h View File

@ -0,0 +1 @@
#include "pluginterfaces/vst2.x/aeffectx.h"

Loading…
Cancel
Save