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
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs