Using an executable as library in dune

121 Views Asked by At

I'm building a project using dune and I'm facing the following situation. Essentially, my project depends on another project, not developed by me, from which I want to use some parts of the source code.

Here is more or less my project tree

my_project/
|---dune-project
|---src/
   |---dune
   |---extrenal-project/
      |---dune-project
      |---dune
      |---src/
         |---dune
   |---src-file.ml

The problem is that external-project has a dune file that builds it as an executable, instead of a library. Therefore, I cannot include it as a library in my dune file. Ideally, I don't want to modify the dune file inside of external-project.

I've tried a series of combinations. Here is the current status of my dune file:

(dirs external-project)

(executable
 (name myexec)
 (libraries containers)
 (modules Myexec)
 (promote (until-clean) (into ".."))
)

(env (dev (flags (:standard -warn-error -A))))

Which allows me to compile external-project correctly, but then does not allow me to reference any of its files. I also tried (dirs external-project external-project/src) but to no success.

So, my question is: is there a way for me to reference external-project as a library, even though it is build as an executable?

Thanks for your help!

0

There are 0 best solutions below