tjammer / raylib-ocaml

OCaml bindings for raylib and raygui
https://tjammer.github.io/raylib-ocaml/
MIT License
173 stars 14 forks source link

Compile program with resources? #32

Closed hummy123 closed 1 year ago

hummy123 commented 1 year ago

Hi there.

Thanks for these cool bindings. I'm finding them useful and am having fun using them.

I have a question about the copying over of assets when running dune build example in your repository. When I try building the examples in your repository, the resources folder get copied into the _build directory with the compiled programs.

I tried making something with these bindings and wanted my application to use some assets (fonts) but the resources didn't get copied over when I tried compiling my application, and Google didn't give much help either so I was wondering if you could offer advice.

Thanks in advance.

tjammer commented 1 year ago

The copying is done by dune on build. As far as I know, it copies everything in the dune-project by default. How does your project tree look like, are the resources inside the dune project?

If all else fails or if your project layout is really different, you can also explicitly tell dune to copy files using https://dune.readthedocs.io/en/stable/dune-files.html#copy-files. However I don't think it should be needed for the case you describe.

What version of dune are you using? raylib-ocaml is still on dune 2. I don't think the behaviour changed with 3.0, but who knows...

hummy123 commented 1 year ago

Thanks for the advice @tjammer . I did manage to get pretty much the behaviour I wanted with the Dune docs you linked to, although the different copying behaviour (explicit copy instructions in my case and the no-config behaviour with this library) is still a mystery.

Appreciate the help.