caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jiten Pathy <jpathy@fssrv.net>
To: Jeremie Dimino <jdimino@janestreet.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] oasis help
Date: Tue, 10 Feb 2015 06:07:39 -0800	[thread overview]
Message-ID: <CAL2Z3DD3vGRzh+J1xVKnZK1f7+pvWnEYcT+7GuEN0YKApDo=zg@mail.gmail.com> (raw)
In-Reply-To: <CANhEzE4BA1b0qJth=qeofJfsSAjpmT2p1N+CRAvP8k+d70jnTA@mail.gmail.com>

Thanks. ocamlbuild seems to have a nice plugin api.

I ended up using
tag_file "target.ml" [Printf.sprintf "open(%s)" module_name]

On Tue, Feb 10, 2015 at 5:19 AM, Jeremie Dimino <jdimino@janestreet.com> wrote:
> You can access the oasis environment from myocamlbuild.ml and setup
> compilation flags according to it. See for instance:
>
>   https://github.com/janestreet/bin_prot/blob/master/myocamlbuild.ml
>
> So you could have this in your _oasis:
>
>   Flag use_b
>   Default: false
>
> And in your myocamlbuild.ml:
>
> ----------------------------------
> (* OASIS_START *)
> (* OASIS_STOP *)
>
> let dispatch = function
>   | After_rules ->
>     let env = BaseEnvLight.load () in
>     let module_name = if BaseEnvLight.var_get "use_b" = "true" then "B" else
> "A" in
>     flag ["ocaml"; "compile"] (S ["-open"; module_name])
>   | _ ->
>     ()
>
> let () = Ocamlbuild_plugin.dispatch (fun hook -> dispatch hook;
> dispatch_default hook)
> ----------------------------------
>
>
> On Tue, Feb 10, 2015 at 12:58 PM, Jiten Pathy <jpathy@fssrv.net> wrote:
>>
>> I have two modules defining the same function.
>> How would i conditionally open modules during compilation using oasis
>> /ocamlbuild?(i.e pass -open A or -open B depending on some flag from
>> oasis?)
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
>
> --
> Jeremie

  reply	other threads:[~2015-02-10 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 12:58 Jiten Pathy
2015-02-10 13:19 ` Jeremie Dimino
2015-02-10 14:07   ` Jiten Pathy [this message]
     [not found] <4912b1d7-c491-9462-2220-c08492d1833d@inria.fr>
2016-11-10  9:27 ` [Caml-list] OASIS help Francois BERENGER
2016-11-10  9:49   ` Laurent Thévenoux
2016-11-10  9:52     ` Francois BERENGER
2016-11-11 10:52       ` Bikal Gurung
  -- strict thread matches above, loose matches on Subject: below --
2016-11-10  9:08 Laurent Thévenoux
2013-11-06 16:09 Robert Soulé
2013-11-10 21:08 ` Sylvain Le Gall

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='CAL2Z3DD3vGRzh+J1xVKnZK1f7+pvWnEYcT+7GuEN0YKApDo=zg@mail.gmail.com' \
    --to=jpathy@fssrv.net \
    --cc=caml-list@inria.fr \
    --cc=jdimino@janestreet.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).