ocamlbuild: build plugin with options

229 views Asked by At

I'm trying to write an ocamlbuild plugin (myocamlbuild.ml) that will use definitions from another file. I have a lot of definitions that I'd like to be used across several build plugins and I wanted put them in their own file. I tried running ocamlbuild twice, once with -no-plugin just to build the plugin, e.g.

ocamlbuild -no-plugin myocamlbuild.cmo

and then again afterwards

ocamlbuild actual-targets.otarget

but when I run the second one it tries to rebuild the plugin and complains that it can't find the included library (even though it exists in the _build directory). So, is there any way that I can convince ocamlbuild to include '-I _build _build/coq_paths.cmx' on the command line? From 'ocamlbuild -help' it looks like there is a '-plugin-option' flag, but I can't find any way to use it.

Thanks.

1

There are 1 answers

0
gasche On BEST ANSWER

Since 4.01, ocamlbuild supports a new (experimental) option -plugin-tag that allows to specify (built-in) ocamlbuild tags to use when compiling myocamlbuild.ml. If you package "coq-paths" using findlib, you can then use

ocamlbuild -use-ocamlfind -plugin-tag "package(coq-path)" ...