Version franaise
Home About Download Resources Contact us
Browse thread
Conditional compilation wrt OCaml version?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Mikkel_Fahnøe_Jørgensen <mikkel@d...>
Subject: Re: [Caml-list] Conditional compilation wrt OCaml version?
>  Working on Batteries, we're faced with a few places where we'd like to
> perform conditional compilation depending on the version of OCaml being
> used. We could probably do this with Camlp4, cpp, Autoconf hackery, etc.
> -- but first, we need to decide on which of these options we'll adopt.
>
> Any suggestion?

If you are interested in using ocamlbuild you can have a look at
ocamlbuild-ctools:

http://dvide.com/labs/ocamlbuild-ctools/

I added extensions to ocamlbuild using a syntax like

normalfile.o
[mytag,myothertag,~notthistag]
conditionalfile.o
...

this is done in a .cprog file that lists all files to include, but
that same could be done with other similar files e.g. .mllib

Also, I added multi-variant builds so the same build can handle
multiple build targets based on tags - for example debug and release
builds. Multivariant builds work by adding tags in the filename:
myfile.variant_release,mingw.o


Most of this could be integrated into ocamlbuild, but ocamlbuild is
not very actively maintained as I understand.

Mikkel