Browse thread
[ANN] OCaml Batteries Included, alpha 3
[
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: | DooMeeR <d@d...> |
| Subject: | Re: ocamlbuild documentation (was Re: [Caml-list] Re: [ANN] OCaml Batteries Included, alpha 3) |
I'll skip over the documentation questions because people are beginning
to say that I troll too much :p
> Instead, I found that ocamlbuild replaces my current build option of choice:
>
> ocamlopt foo.ml -I +lablGL lablgl.cmxa lablglut.cmxa foo.ml -o foo
>
> with lots of incidental complexity:
>
> $ cat myocamlbuild.ml
> open Ocamlbuild_plugin;;
> open Command;;
>
> dispatch begin function
> | After_rules ->
> ocaml_lib ~extern:true ~dir:"+lablGL" "lablgl";
> ocaml_lib ~extern:true ~dir:"+lablGL" "lablglut";
> | _ -> ()
> end;;
>
> $ cat _tags
> <main.{byte,native}>: use_lablgl, use_lablglut
> <**/*.ml>: use_lablgl
>
> $ ocamlbuild foo.native
This is, indeed, and in my opinion, one of the BIGGEST problem with
Ocamlbuild right now. In fact you didn't chose the easiest solution,
which is:
ocamlbuild -cflags -I,+lablGL -lflags -I,+lablGL -lib lablgl -lib
lablglut foo.native
However, this is of course very hackish, not documented (took me a while
to figure that this was the simplest way of using a library), and still
not satisfying at all. The extension of Ocamlbuild I am working on
should allow you to replace this by:
ocamlbuild -pkg lablGL.glut foo.native
(the package lablGL.glut depends on the package lablGL, which will thus
be included automatically)
I will work on an extension to allow tags such as use_pkg(lablGL.glut)
to put this in a _tag file if you get tired of using the command line
option.
This will require findlib though. If you do not have findlib, another
solution I may implement someday would be:
ocamlbuild -libs +lablGL/lablgl,+lablGL/lablglut foo.native
Which is still better than the solution using ocamlopt directly IMO
(because here, ocamlbuild can at least guess whether it should include
the .cmxa or the .cma).
Now, I don't think it will happen someday that Ocamlbuild will be able
to guess that lablGL should be included. It raises too many questions :(
--
Romain Bardou