* ocamlbuild: simplification of invocation
@ 2008-06-16 9:07 Renald Buter
2008-06-16 11:00 ` [Caml-list] " Stéphane Glondu
0 siblings, 1 reply; 4+ messages in thread
From: Renald Buter @ 2008-06-16 9:07 UTC (permalink / raw)
To: caml-list
Hello,
I'm not sure if this is the right forum to ask this question, but I'll
post it anyway :)
Hello list,
I have a simple test setup that I'd like to build with ocamlbuild:
open OUnit
let test_failure _ = assert_failure "failed"
let test_suite = "Setup" >::: [
"failure" >:: test_failure
]
let _ = run_test_tt_main test_suite
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...
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.
**********************************************************************
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlbuild: simplification of invocation
2008-06-16 9:07 ocamlbuild: simplification of invocation Renald Buter
@ 2008-06-16 11:00 ` Stéphane Glondu
2008-06-16 11:48 ` Renald Buter
0 siblings, 1 reply; 4+ messages in thread
From: Stéphane Glondu @ 2008-06-16 11:00 UTC (permalink / raw)
To: Renald Buter; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlbuild: simplification of invocation
2008-06-16 11:00 ` [Caml-list] " Stéphane Glondu
@ 2008-06-16 11:48 ` Renald Buter
2008-06-16 12:02 ` Stéphane Glondu
0 siblings, 1 reply; 4+ messages in thread
From: Renald Buter @ 2008-06-16 11:48 UTC (permalink / raw)
To: Ocaml Mailinglist; +Cc: steph
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.
**********************************************************************
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlbuild: simplification of invocation
2008-06-16 11:48 ` Renald Buter
@ 2008-06-16 12:02 ` Stéphane Glondu
0 siblings, 0 replies; 4+ messages in thread
From: Stéphane Glondu @ 2008-06-16 12:02 UTC (permalink / raw)
To: Renald Buter; +Cc: Ocaml Mailinglist
Renald Buter a écrit :
> [...]
> 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?
Sure. I recommend you to read:
http://brion.inria.fr/gallium/index.php/Using_an_external_library
Cheers,
--
Stéphane Glondu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-16 12:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-16 9:07 ocamlbuild: simplification of invocation Renald Buter
2008-06-16 11:00 ` [Caml-list] " Stéphane Glondu
2008-06-16 11:48 ` Renald Buter
2008-06-16 12:02 ` Stéphane Glondu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox