From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 29B617F6CB for ; Tue, 10 Feb 2015 14:19:33 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mxout1.mail.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout1.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ADAwB/BNpUnHDIaSZcg1haBIJ+sDsrhW+HUoFgAQmFcQKBFwdDAQEBAQEBEAEBAQEBBhYJQoQNAQEDARIRBBkBASwLAQQLCwQHAxcdAgIiEgEFAQoSBhMSEId3AwkIAwqrOz4xij5whGIBBYwrA4VqAQEBAQEBAQMBAQEBAQEBAQEBAREGCo9pBAeCLQwvEYExhFUKeI0fhV2BGDaLJ4JDgXQSI4EVhBBvgkIBAQE X-IPAS-Result: A0ADAwB/BNpUnHDIaSZcg1haBIJ+sDsrhW+HUoFgAQmFcQKBFwdDAQEBAQEBEAEBAQEBBhYJQoQNAQEDARIRBBkBASwLAQQLCwQHAxcdAgIiEgEFAQoSBhMSEId3AwkIAwqrOz4xij5whGIBBYwrA4VqAQEBAQEBAQMBAQEBAQEBAQEBAREGCo9pBAeCLQwvEYExhFUKeI0fhV2BGDaLJ4JDgXQSI4EVhBBvgkIBAQE X-IronPort-AV: E=Sophos;i="5.09,550,1418079600"; d="scan'208";a="121113829" Received: from mxout1.mail.janestreet.com ([38.105.200.112]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2015 14:19:32 +0100 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout1.mail.janestreet.com with smtp (Exim 4.82) (envelope-from ) id 1YLAix-0004Xa-Gg for caml-list@inria.fr; Tue, 10 Feb 2015 08:19:31 -0500 X-JS-Flow: external Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BU2gVj-AAACev-Pv; 2015-02-10 08:19:31.504515-05:00 Received: from mail-ig0-f175.google.com ([209.85.213.175]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1YLAix-0001RY-BP for caml-list@inria.fr; Tue, 10 Feb 2015 08:19:31 -0500 Received: by mail-ig0-f175.google.com with SMTP id hn18so23440761igb.2 for ; Tue, 10 Feb 2015 05:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=TIfzjuj6HFTb7WuMSA/0NPeI/nt1PEFxNGL3qE6rqek=; b=o8eDTFGm3pf4HwSqTuDroeV5v3WStM05JE2NnNtATwX/P/0EyJi0ZmKCH6J6aKAyEN yQ6PYGBvl0nxevFOl5ei97F3K4MTDWCSE5nFFYOWslG8ZiC8YS3hxbjfGT1kyF3Bvl8p x8lokZKhUQ6SVNoK94z3PawLc6hsxyat/1KMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=TIfzjuj6HFTb7WuMSA/0NPeI/nt1PEFxNGL3qE6rqek=; b=kajkgItyVGVGG0ZPLABn31N1DnikBlV7m1TZue7RBtBOcEEIA7tu1SCNnz06Z9SSRb TVlQqb/iP67ofLWjBn5v0Qw2bog3Wd2iE4cbKov0jLPEAKVI5Pgt2vFYNkcHZ/iYzt1U js0o3au4NyR5CDP2/xKRJElLPIElNf1T5+Qq3j9nQDA14mY+jP5fCinJ2CWtGmXXe51n 3ae0GG1pSutP0bR5qXa+HiT1mYtqZjc0DcSlbn7Be4MOFUHoYHbI9NuaOV847AcPM4zX cwyhATMrurz4n3nY/glZAovqzgypBi5PmzphqLq/LLIB9EXiV9ATB/SM1aOOV2cUhcjE 2dDg== X-Gm-Message-State: ALoCoQk6jlRlcEk0Er2RYsr3Hgsx5N6Nnz8bh4ocBY5eGl7OrdJ0Xnga4ax2zvjw3z1uZg0pXwVYG1sY82V6Y9XMv52skib0oPyUNowHbRvtcizpQBJEzqioC9J/jsm8opt1oVeuLGOc X-Received: by 10.43.92.9 with SMTP id bo9mr31222405icc.54.1423574371010; Tue, 10 Feb 2015 05:19:31 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.43.92.9 with SMTP id bo9mr31222397icc.54.1423574370887; Tue, 10 Feb 2015 05:19:30 -0800 (PST) Received: by 10.50.252.20 with HTTP; Tue, 10 Feb 2015 05:19:30 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Feb 2015 13:19:30 +0000 Message-ID: From:Jeremie Dimino To:Jiten Pathy Cc:"caml-list@inria.fr" Content-Type: multipart/alternative; boundary=bcaec51969cdb0406f050ebbbc88 X-JS-Processed-by: mailcore Subject: Re: [Caml-list] oasis help --bcaec51969cdb0406f050ebbbc88 Content-Type: text/plain; charset=UTF-8 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 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 --bcaec51969cdb0406f050ebbbc88 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You can access the oasis environment from myocamlbuild.ml and setup compilation flags accordin= g to it. See for instance:


So you could have this in your _oasis:

=C2=A0 Flag use_b
=C2=A0 Default: false

And in your myocamlbuild.ml:<= /div>

----------------------------------
= (* OASIS_START *)
(* OASIS_STOP *)

let dispatch =3D function
=C2=A0 | After_rules ->
<= div>=C2=A0 =C2=A0 let env =3D BaseEnvLight.load () in
=C2=A0 =C2= =A0 let module_name =3D if BaseEnvLight.var_get "use_b" =3D "= ;true" then "B" else "A" in
=C2=A0 =C2= =A0 flag ["ocaml"; "compile"] (S ["-open"; mo= dule_name])
=C2=A0 | _ ->
=C2=A0 =C2=A0 ()

let () =3D Ocamlbuild_plugin.dispatch (fun hook -&g= t; 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.=C2=A0 Subscription management and archives:
ht= tps://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
--bcaec51969cdb0406f050ebbbc88--