Skip to content

Commit

Permalink
Regenerate bindings with bindgen 0.66.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Jul 17, 2023
1 parent c276413 commit db1e46e
Show file tree
Hide file tree
Showing 5 changed files with 368 additions and 210 deletions.
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

fn main() {
let mut build = cc::Build::new();


println!("cargo:rerun-if-changed=src/stb_image.c");

build
.cpp(true)
.define("STB_IMAGE_IMPLEMENTATION", None)
.file("src/stb_image.c");

build.compile("libstb_image");
Expand Down
3 changes: 1 addition & 2 deletions gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
if test "x$BINDGEN" == "x"; then
BINDGEN=bindgen
fi
$BINDGEN -DSTBI_HEADER_FILE_ONLY -match stb_image -o stb_image.rs stb_image.c

$BINDGEN --no-layout-tests --allowlist-function "stbi_.*" -o src/stb_image.rs src/stb_image.c
12 changes: 6 additions & 6 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use stb_image::bindgen::*;
use stb_image::*;

use libc::{c_int, c_void};
use std::convert::AsRef;
Expand All @@ -25,10 +25,10 @@ pub struct Image<T> {
impl<T> Image<T> {
pub fn new(width: usize, height: usize, depth: usize, data: Vec<T>) -> Image<T> {
Image::<T> {
width: width,
height: height,
depth: depth,
data: data,
width,
height,
depth,
data,
}
}
}
Expand All @@ -54,7 +54,7 @@ fn load_internal<T: Clone>(buf: *mut T, w: c_int, h: c_int, d: c_int) -> Image<T
width: w as usize,
height: h as usize,
depth: d as usize,
data: data,
data,
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![crate_name = "stb_image"]
#![crate_type = "rlib"]

extern crate libc;

pub mod image;

#[allow(non_snake_case, non_camel_case_types)]
pub mod stb_image;
Loading

0 comments on commit db1e46e

Please sign in to comment.