Suppose I want to use dune to build a project that has a flat directory structure:
my_project/
├── dune
├── basics.ml
├── basics.mli
├── utils.ml
├── utils.mli
└── main.ml
main.ml
is the main program (the entry point). main.ml
depends on utils.ml
, while utils.ml
in turn depends on basics.ml
. main.ml
calls functions in utils.ml
using prefix Utils
(e.g. Utils.example_function x y
).
The question: What should I write in the dune
file in order to compile this project?
So far, all the dune examples I have seen use this directory structure instead:
my_project/
├── dune
├── main.ml
└── mylib
├── dune
├── basics.ml
├── basics.mli
├── utils.ml
└── utils.mli
Where my_project/dune
is:
(executable
(name main)
(libraries mylib))
and my_project/mylib/dune
is:
(library (name mylib))
and main.ml
calls functions in utils.ml
using prefix Mylib.Utils
(e.g. Mylib.Utils.example_function x y
).
I do not want this directory structure; I do not want to create a separate directory for utils.ml
and basics.ml
. I want all source files to be in the same directory as main.ml
. Is there a way to do this using dune?