Browse thread
Working on dependent projects with ocamlbuild
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Nicolas Pouillard <nicolas.pouillard@g...> |
| Subject: | Re: [Caml-list] Working on dependent projects with ocamlbuild |
Excerpts from Daniel Bünzli's message of Thu Nov 01 11:53:44 +0100 2007:
> Hello,
Hello,
[...]
> But if I use the approach mentionned in my initial posting users of
> base will see the unconstrained a.cmi and b.cmi. Is there a way that
> allows me to use this approach while maintaining the abstraction I
> get with cma's ? Even if it means plugins in p1 and p2 ? I have the
> impression that the response is negative because even if I try to
> build a .cma with a mllib the build directory with have all .cmi and
> the compilers will look at them.
There is a solution to specify directory scoping in a fine-grained manner.
This way you can explain precisely which directory is seen by a directory.
This is done in a plugin using the function Pathname.define_context that
takes a directory (an implicit pathname starting from the root of your
project) and a list of directories seen by it.
You can then setup your sources in order to confine some files in a directory
only seen by the modules that wrap them.
p1/src/implem/a.ml
p1/src/implem/b.ml
p1/src/base.ml
p1/myocamlbuild.ml
in p1/myocamlbuild.ml...
open Ocamlbuild_pack;;
dispatch begin function
| After_rules ->
Pathname.define_context "src" ["src/implem"]
| _ -> ()
end;;
HTH,
--
Nicolas Pouillard aka Ertai