Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlbuild and the "status bar"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Re: ocamlbuild and the "status bar"
On 2/27/07, Joel Reymont <joelr1@gmail.com> wrote:
>
> On Feb 27, 2007, at 11:04 AM, Joel Reymont wrote:
>
> > I really like this tool but I can't figure out where to get the
> > nifty "status bar" functionality described towards the end of the
> > slides.
>
> This is a rather silly question so I retract it. A much better
> question is the following...
>
> How do I integrate ocamlbuild with external libraries?
>
> I have OUnit installed in /usr/local/lib/ocaml/site-lib/ounit since
> it uses ocamlfind during installation. I have to use a longish
> command line to make OUnit examples compile, like this:
>
> ocamlbuild -cflags -I,/usr/local/lib/ocaml/site-lib/ounit -lflags -I,/
> usr/local/lib/ocaml/site-lib/ounit -libs unix,ounit test_list.byte

There is many solutions and you get one of them.

1/ Comand line solutions

1.1/ Using ocamlfind:

Since it's an ocamlfind package you can use it.

ocamlbuild -ocamlc "ocamlfind ocamlc -package ounit" -lfags -linkpkg
-lib unix test_list.byte

1.2/ Using the library directly (like you did).

2/ Shell script/Makefile solution

Put all your stuffs form the previous solutions in a shell script or a Makefile.

3/ A solution with an Ocamlbuild plugin:

$ cat _tags
"test_list.byte": use_unix

$ cat myocamlbuild.ml
open Ocamlbuild_plugin;;
open Command;;

let packages = "ounit" (* "pkg1,pkg2,..." *);;

let ocamlfind cmd =
  S[A"ocamlfind"; A cmd; A"-package"; A packages];;

flag ["ocaml"; "link"] (A"-linkpkg");;

dispatch begin function
  | After_options ->
      Options.ocamlc := ocamlfind "ocamlc";
      Options.ocamlopt := ocamlfind "ocamlopt";
  | _ -> ()
end

$ ocamlbuild test_list.byte
Finished, 3 targets (2 cached) in 00:00:00.

Cheers,

-- 
Nicolas Pouillard