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: Renald Buter <buter@c...>
Subject: Re: [Caml-list] ocamlbuild: simplification of invocation
Stéphane Glondu wrote:
> 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,
> 

Ah! That looks simple... Thank you.

Could this be made file-specific (I will not have to use oUnit in the 
final result)? Probably some combination of myocamlbuild.ml and _tags? 
Or are multiple targets a problem for ocamlbuild?

With kind regards,

Renald Buter

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************