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