Variables for Artifacts¶
For specific situations where one needs to refer to individual compilation artifacts, special variables (see Variables) are provided, so the user doesn’t need to be aware of the particular naming conventions or directory layout implemented by Dune.
These variables can appear wherever a Dependency Specification is expected and also inside Actions. When used inside Actions, they implicitly declare a dependency on the corresponding artifact.
The variables have the form %{<ext>:<path>}, where <path> is
interpreted relative to the current directory:
cmo:<path>,cmx:<path>, andcmi:<path>expand to the corresponding artifact’s path for the module specified by<path>. The basename of<path>should be the name of a module as specified in a(modules)field.cma:<path>andcmxa:<path>expands to the corresponding artifact’s path for the library specified by<path>. The basename of<path>should be the name of the library as specified in the(name)field of alibrarystanza (not its public name).cmt:<path>andcmti:<path>expand to the corresponding compiled annotation files for the module specified by<path>. These files contain the typed abstract syntax tree with precise location information and type annotations, generated with the-bin-annotflag. They are particularly useful for IDE tools to provide tooltips and type information.Added in version 3.21.
In each case, the expansion of the variable is a path pointing inside the build
context (i.e., _build/<context>).