|
| 1 | +library_parameter |
| 2 | +----------------- |
| 3 | + |
| 4 | +.. warning:: |
| 5 | + |
| 6 | + This feature is experimental and requires the compiler you are using to |
| 7 | + support parameterized libraries. |
| 8 | + |
| 9 | +The ``library_parameter`` stanza describes a parameter interface defined in a single ``.mli`` file. To enable this feature, |
| 10 | +you need to add ``(using oxcaml 0.1)`` :doc:`extension |
| 11 | +</reference/dune-project/using>` in your ``dune-project`` file. |
| 12 | + |
| 13 | +.. describe:: (library_parameter ...) |
| 14 | + |
| 15 | + .. versionadded:: 3.20 |
| 16 | + |
| 17 | + Define a parameter. |
| 18 | + |
| 19 | + .. describe:: (name <parameter-name>) |
| 20 | + |
| 21 | + ``parameter-name`` is the name of the library parameter. It must be a valid |
| 22 | + OCaml module name as for :doc:`/reference/dune/library`. |
| 23 | + |
| 24 | + This must be specified if no `public_name` is specified. |
| 25 | + |
| 26 | + .. describe:: (public_name ...) |
| 27 | + |
| 28 | + The name under which the library parameter can be referred as a dependency |
| 29 | + when it's not part of the current workspace, i.e., when it is installed. |
| 30 | + Without a ``(public_name ...)`` field, the library parameter won't be |
| 31 | + installed by Dune. The public name must start with the package name it's |
| 32 | + part of and optionally followed by a dot, then anything else you want. The |
| 33 | + package name must also be one of the packages that Dune knows about, as |
| 34 | + determined by the logic described in :doc:`/reference/packages`. |
| 35 | + |
| 36 | + .. describe:: (package <package>) |
| 37 | + |
| 38 | + Installs a private library parameter under the specified package. Such a |
| 39 | + parameter is now usable by public libraries defined in the same project. |
| 40 | + |
| 41 | + .. describe:: (synopsis <string>) |
| 42 | + |
| 43 | + A one-line description of the library parameter. |
| 44 | + |
| 45 | + .. describe:: (modules <modules>) |
| 46 | + |
| 47 | + Specifies a specific module to select as a `library_parameter`. |
| 48 | + |
| 49 | + ``<modules>`` uses the :doc:`/reference/ordered-set-language`, where |
| 50 | + elements are module names and don't need to start with an uppercase letter. |
| 51 | + |
| 52 | + The library parameter **must** only declare one ``mli`` file as part of its |
| 53 | + modules. |
| 54 | + |
| 55 | + .. describe:: (libraries <library-dependencies>) |
| 56 | + |
| 57 | + Specifies the library parameter's dependencies. |
| 58 | + |
| 59 | + See :doc:`/reference/library-dependencies` for more details. |
| 60 | + |
| 61 | + .. describe:: (preprocesss <preprocess-spec>) |
| 62 | + |
| 63 | + Specifies how to preprocess files when needed. |
| 64 | + |
| 65 | + The default is ``no_preprocessing``, and other options are described |
| 66 | + in :doc:`/reference/preprocessing-spec`. |
| 67 | + |
| 68 | + .. describe:: (preprocessor_deps (<deps-conf list>)) |
| 69 | + |
| 70 | + Specifies extra preprocessor dependencies preprocessor, i.e., if the |
| 71 | + preprocessor reads a generated file. |
| 72 | + |
| 73 | + The specification of dependencies is described in |
| 74 | + :doc:`/concepts/dependency-spec`. |
| 75 | + |
| 76 | + |
| 77 | + .. describe:: (flags ...) |
| 78 | + |
| 79 | + See :doc:`/concepts/ocaml-flags`. |
| 80 | + |
| 81 | + .. describe:: (ocamlc_flags ...) |
| 82 | + |
| 83 | + See :doc:`/concepts/ocaml-flags`. |
| 84 | + |
| 85 | + .. describe:: (ocamlopt_flags ...) |
| 86 | + |
| 87 | + See :doc:`/concepts/ocaml-flags`. |
| 88 | + |
| 89 | + .. describe:: (optional) |
| 90 | + |
| 91 | + If present, it indicates that the library parameter should only be built |
| 92 | + and installed if all the dependencies are available, either in the |
| 93 | + workspace or in the installed world. |
| 94 | + |
| 95 | + .. describe:: (enabled_if <blang expression>) |
| 96 | + |
| 97 | + Conditionally disables a library parameter. |
| 98 | + |
| 99 | + A disabled library parameter cannot be built and will not be installed. |
| 100 | + |
| 101 | + The condition is specified using the :doc:`/reference/boolean-language`, and |
| 102 | + the field allows for the ``%{os_type}`` variable, which is expanded to the |
| 103 | + type of OS being targeted by the current build. Its value is the same as the |
| 104 | + value of the ``os_type`` parameter in the output of ``ocamlc -config``. |
| 105 | + |
| 106 | + .. describe:: (allow_overlapping_dependencies) |
| 107 | + |
| 108 | + Allows external dependencies to overlap with libraries that are present in |
| 109 | + the workspace. |
0 commit comments