4bb4 / implot-rs

Rust bindings to https://github.com/epezent/implot
Apache License 2.0
54 stars 22 forks source link

How to run examples? cimplot cannot be accessed #31

Open wlwatkins opened 1 year ago

wlwatkins commented 1 year ago

Hi,

I tried running the examples but cannot compile. rustc 1.66.0 (69f9c33d7 2022-12-12) I cloned your repo, cd in implot-examples, and at first clance, line_plot is not present. error: no example target named "line_plots". so I guess the readme might be up little outdated, ls the dir and i see

d-----        18/02/2023     13:09                examples-shared
d-----        18/02/2023     13:13                implot-glium-demo
d-----        18/02/2023     13:08                implot-wgpu-demo
-a----        18/02/2023     13:08            762 README.md

So i try cargo run --example implot-glium-demo, but again error: no example target named "implot-glium-demo".

might be me not knowing how to use the --example flag. So I cd in implot-glium-demo and run cargo run.

It compiles until

error: failed to run custom build command for `implot-sys v0.6.0  [REDACTED]\implot-rs\implot-sys)`

Caused by:
  process didn't exit successfully: ` [REDACTED]\implot-rs\implot-examples\implot-glium-demo\target\debug\build\implot-sys-669e58a21423fafe\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'Can't access third-party/cimplot/cimplot.cpp. Did you forget to fetch git submodules?', [REDACTED]\implot-rs\implot-sys\build.rs:21:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

what am i missing?

wlwatkins commented 1 year ago

hum... implot-sys\third-party\cimplot is empty, maybe i just need to install this

I've cloned all the third parties, now everything complies fine, but i have no idea how to run the examples as it always says no example no matter where I run the --example command...

wlwatkins commented 1 year ago

Ok I got it to work, You need to clone cimplot and imgui (ithin cimplot) with the correct commit. maybe it should be mentionned in the readme. I'll give the library a try to see if it fits my need, in which case i'll try and do a PR. Maybe there's a git command to follow links and clone related repos, i'm not sure

miguelggcc commented 1 year ago

Ok I got it to work, You need to clone cimplot and imgui (ithin cimplot) with the correct commit. maybe it should be mentionned in the readme. I'll give the library a try to see if it fits my need, in which case i'll try and do a PR. Maybe there's a git command to follow links and clone related repos, i'm not sure

Hey, Will. Do you mind giving more details on how you managed to make it work? I'm struggling in here

wlwatkins commented 1 year ago

Basically, in GitHub, when you go to the dir for cimplot and within it for imgui you see a link to the exact commit that was used. So clone implot the on your local machine go to the cimplot directory and clone cimplot (make sur NOT to have cimplot/cimplot) you have to checkout to the exact commit using the hash (look online for that) you repeat the same thing for the nested implot folder

jorpic commented 1 year ago

This repo uses Git submodules. I.e. it references another repository at the specific commit. You can run git submodule update --init --recursive after cloning the repo and it will automatically clone required version at the correct location.

$ git submodule update --init --recursive
Submodule 'implot-sys/third-party/cimplot' (https://github.com/cimgui/cimplot) registered for path 'implot-sys/third-party/cimplot'
Submodule path 'implot-sys/third-party/cimplot': checked out '374317a84121a01868aa5274dbcf1c5a5df96e8c'
Submodule path 'implot-sys/third-party/cimplot/implot': checked out 'a9d334791563cdaf9bd0bf7f9899a67bcd03179b'

Or like this, step-by-step:

$ git submodule status
-374317a84121a01868aa5274dbcf1c5a5df96e8c implot-sys/third-party/cimplot

$ git submodule init
Submodule 'implot-sys/third-party/cimplot' (https://github.com/cimgui/cimplot) registered for path 'implot-sys/third-party/cimplot'

$ git submodule update --recursive
Cloning into '/home/user/t/implot-rs/implot-sys/third-party/cimplot'...
Submodule path 'implot-sys/third-party/cimplot': checked out '374317a84121a01868aa5274dbcf1c5a5df96e8c'
Cloning into '/home/user/t/implot-rs/implot-sys/third-party/cimplot/implot'...
Submodule path 'implot-sys/third-party/cimplot/implot': checked out 'a9d334791563cdaf9bd0bf7f9899a67bcd03179b'

$ git submodule status
 374317a84121a01868aa5274dbcf1c5a5df96e8c implot-sys/third-party/cimplot