ocamlocamlbuildoasis

How to configure _oasis for OCaml to set 'Profile' flag


I have an existing project in OCaml and one _oasis file. I don't know where to enable the profiling flag for ocamlbuild.

I looked up Oasis manual and the code, and found there was a variable profile available in setup.data. I assume this was what Oasis auto generated.

Where and what should I include in _oasis to set profile to true ?


Solution

  • You can activate the ocamlbuild_more_args feature.

    On top of your _oasis file:

    AlphaFeatures: ocamlbuild_more_args
    

    Then, in your Package:

    XOCamlbuildExtraArgs: your_ocamlbuild_option
    

    I can't find any -profile option in ocamlbuild though, so I'm not sure of what this is about. Also, this option is still quite unstable.

    A better way to handle that would be to modify your _tags file accordingly. It is generated by oasis but you can modify it.

    EDIT:

    setup.data informs you of environment variables. As for profile, it shows if the -p option will be passed to ocamlopt. You can pass it using the NativeOpt field.