caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: ocamlbuild and the "status bar"
Date: Tue, 27 Feb 2007 14:28:44 +0100	[thread overview]
Message-ID: <cd67f63a0702270528h381345b8g1f7ab22efd32a516@mail.gmail.com> (raw)
In-Reply-To: <BA930FC8-F3DF-4F6C-9E37-A7DB735219EE@gmail.com>

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


  reply	other threads:[~2007-02-27 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 11:04 Joel Reymont
2007-02-27 12:58 ` Joel Reymont
2007-02-27 13:28   ` Nicolas Pouillard [this message]
2007-02-27 13:06 ` [Caml-list] " Nicolas Pouillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd67f63a0702270528h381345b8g1f7ab22efd32a516@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).