Initial work on move to implot 0.7 compatibility. See notes.

- This updates the bindings generator, the low-level bindings as
  well as the higher-level bindings and the examples to work
  with a newer master of cimplot that links to implot 0.7.
- Several things are not done properly yet:
  - Contexts can be created and as long as they are not dropped
    things work out (shown in the examples). However, this should
    be done more imgui-rs like, where operations that require a context
    make that explicit by requiring a context reference to be passed.
  - The README has not been updated yet to all the new features that
    were added.
This commit is contained in:
4bb4 2020-10-04 14:43:18 +02:00
parent e0ad0e892e
commit f85c50657b
8 changed files with 988 additions and 244 deletions

View file

@ -5,12 +5,15 @@
// for now, but expected to diverge from that over time.
use std::{env, fs, io, path::Path};
const CPP_FILES: [&str; 3] = [
const CPP_FILES: &[&str] = &[
"third-party/cimplot/cimplot.cpp",
"third-party/cimplot/implot/implot.cpp",
"third-party/cimplot/implot/implot_items.cpp",
"third-party/cimplot/implot/implot_demo.cpp", // Could remove this if demo not used
];
const IMPLOT_INCLUDE_DIRECTORIES: &[&str] = &["third-party/cimplot/implot/"];
fn assert_file_exists(path: &str) -> io::Result<()> {
match fs::metadata(path) {
Ok(_) => Ok(()),
@ -46,10 +49,13 @@ fn main() -> io::Result<()> {
let imgui_include_path = Path::new(&cimgui_include_path).join("imgui");
build.include(&cimgui_include_path);
build.include(&imgui_include_path);
for path in IMPLOT_INCLUDE_DIRECTORIES {
build.include(path);
}
// Taken from the imgui-sys build as well
build.flag_if_supported("-Wno-return-type-c-linkage");
for path in &CPP_FILES {
for path in CPP_FILES {
assert_file_exists(path)?;
build.file(path);
}