Skip to content

Commit fe30255

Browse files
committed
Initial bindgen
0 parents  commit fe30255

File tree

12 files changed

+146
-0
lines changed

12 files changed

+146
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
*~
3+
Cargo.lock

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "native/openfx"]
2+
path = native/openfx
3+
url = https://github.com/NatronGitHub/openfx

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
3+
members = [
4+
"ofx-sys",
5+
"ofx",
6+
]

native/openfx

Submodule openfx added at 4fc7b53

ofx-sys/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ofx-sys</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

ofx-sys/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "ofx_sys"
3+
version = "0.0.1"
4+
authors = ["Nicola Orru <[email protected]>"]
5+
keywords = ["ofx", "openfx", "effects", "natron", "nuke"]
6+
#edition = "2018"
7+
description = "Bindings for OpenFX 1.4"
8+
repository = "https://github.com/itadinanta/ofx-rs"
9+
license = "Apache-2.0"
10+
# publish = false # insurance against accidents
11+
12+
build = "build/main.rs"
13+
14+
[lib]
15+
name="ofx_sys"
16+
crate-type = ["lib"]
17+
path="src/lib.rs"
18+
19+
[dependencies]
20+
libc = "0.2"
21+
22+
[build-dependencies]
23+
bindgen = "0.42.2"
24+
25+
[dev-dependencies]
26+
cgmath = "0.16"

ofx-sys/build/main.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
extern crate bindgen;
2+
3+
use std::env;
4+
use std::path::PathBuf;
5+
6+
fn main() {
7+
// Tell cargo to tell rustc to link a library.
8+
// println!("cargo:rustc-link-lib=openfx");
9+
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
10+
let bindings_path = out_path.join("bindings.rs");
11+
//println!("Bindings generated at {:?}", bindings_path);
12+
let bindings = bindgen::Builder::default()
13+
.clang_arg("-I../native/openfx/include")
14+
.header("build/wrapper.h")
15+
.generate()
16+
.expect("Unable to generate bindings");
17+
18+
// Write the bindings to the $OUT_DIR/bindings.rs file.
19+
bindings
20+
.write_to_file(bindings_path)
21+
.expect("Couldn't write bindings!");
22+
}

ofx-sys/build/wrapper.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
#ifndef __cplusplus
3+
#include <stdbool.h>
4+
#endif
5+
6+
#include "ofxCore.h"
7+
#include "ofxImageEffect.h"
8+
#include "ofxDialog.h"
9+
#include "ofxInteract.h"
10+
#include "ofxKeySyms.h"
11+
#include "ofxMemory.h"
12+
#include "ofxMessage.h"
13+
#include "ofxMultiThread.h"
14+
#include "ofxNatron.h"
15+
#include "ofxOld.h"
16+
#include "ofxOpenGLRender.h"
17+
#include "ofxParametricParam.h"
18+
#include "ofxParam.h"
19+
#include "ofxPixels.h"
20+
#include "ofxProgress.h"
21+
#include "ofxProperty.h"
22+
#include "ofxSonyVegas.h"
23+
#include "ofxTimeLine.h"

ofx-sys/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![allow(non_upper_case_globals)]
2+
#![allow(non_camel_case_types)]
3+
#![allow(non_snake_case)]
4+
5+
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
6+
7+
#[cfg(test)]
8+
mod tests {
9+
#[test]
10+
fn it_works() {
11+
assert_eq!(2 + 2, 4);
12+
}
13+
}
14+

ofx/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ofx</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

ofx/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "ofx"
3+
version = "0.0.1"
4+
authors = ["Nicola Orru <[email protected]>"]
5+
keywords = ["ofx", "openfx", "effects", "natron", "nuke"]
6+
#edition = "2018"
7+
description = "Bindings for OpenFX 1.4"
8+
repository = "https://github.com/itadinanta/ofx-rs"
9+
license = "Apache-2.0"
10+
# publish = false # insurance against accidents
11+
12+
[lib]
13+
name="ofx"
14+
crate-type = ["lib"]
15+
path="src/lib.rs"
16+
17+
[dependencies]
18+
libc = "0.2"
19+
ofx_sys = { path = "../ofx-sys" }

ofx/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn it_works() {
5+
assert_eq!(2 + 2, 4);
6+
}
7+
}

0 commit comments

Comments
 (0)