Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlbuild: simplification of invocation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stéphane_Glondu <steph@g...>
Subject: Re: [Caml-list] ocamlbuild: simplification of invocation
Renald Buter a écrit :
> [...]
> To build this, I have to enter:
> 
>   ocamlbuild -cflags -I,+oUnit -lflags -I,+oUnit -libs unix,oUnit 
> test_setup.native
> 
> Now, is there any way of simplifying this? I've tried looking into the 
> tags for the _tags file, but got confused...

You can make a plugin which sets these options by putting the following 
lines in a file named myocamlbuild.ml at the root of your project:

--8<----------
open Ocamlbuild_plugin;;

dispatch begin function
   | Before_options ->
       Options.ocaml_cflags := [ "-I"; "+oUnit"];
       Options.ocaml_lflags := [ "-I"; "+oUnit"];
       Options.ocaml_libs := [ "unix"; "oUnit"];
   | _ -> ()
end;;
--8<----------

Then you can just invoke "ocamlbuild test_setup.native".


Cheers,

-- 
Stéphane Glondu