I am developing a big library with dune. Let us call this library L
.
To avoid creating a big mess, the dune project has many smaller libraries : A
, B
, C
, ...
These libraries depend on each other.
I would like the users to be able to opam install L
, and then access to the different smaller libraries as L.A
, L.B
, etc.
What is the proper way to do this?
Edit following the comment of @glennsl:
Here is the filesystem tree:
l/
l/dune-project
l/a <- This directory contains library A
l/a/dune
l/b <- This directory contains library B
l/b/dune
in l/a/dune
:
(library
(name a)
(public_name l.a))
in l/b/dune
:
(library
(name b)
(public_name l.b)
(libraries a))
in l/a/dune-project
:
(name l)
I can't find how to expose A
and B
as modules of L
.
Unless there's some configuration setting that interferes, this should just be a matter of exporting the modules of the other libraries as module aliases:
This is in fact what
dune
does automatically to namespace library modules. And if you don't already have an explicit main module forL
, you will have to manually add the module aliases that would have been automatically generated as well.