caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremie Dimino <jdimino@janestreet.com>
To: Jiten Pathy <jpathy@fssrv.net>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] oasis help
Date: Tue, 10 Feb 2015 13:19:30 +0000	[thread overview]
Message-ID: <CANhEzE4BA1b0qJth=qeofJfsSAjpmT2p1N+CRAvP8k+d70jnTA@mail.gmail.com> (raw)
In-Reply-To: <CAL2Z3DCS6TD+4fg3rt24aiVHOM0iH_DS191kX9XWEFbfrfG13g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2510 bytes --]

  reply	other threads:[~2015-02-10 13:19 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 [this message]
2015-02-10 14:07   ` Jiten Pathy
     [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='CANhEzE4BA1b0qJth=qeofJfsSAjpmT2p1N+CRAvP8k+d70jnTA@mail.gmail.com' \
    --to=jdimino@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=jpathy@fssrv.net \
    /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).