English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ocamlbuild and ocamlfind - using multiple grammars in a project
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-08 (13:22)
From: Romain Bardou <Romain.Bardou@l...>
Subject: Re: [Caml-list] ocamlbuild and ocamlfind - using multiple grammars in a project
Hans Ole Rafaelsen a écrit :
> Hi
> I'm trying to build a project using ocamlbuild with ocamlfind. One 
> submodule requires 'json-static' and another requires 
> 'bitstring.syntax'. The preprocessors requires different syntaxes, 
> resulting in the following error:
> ocamlfind: No unique value for the META variable 'preprocessor': package 
> camlp4 defines `camlp4', package bitstring.syntax defines `camlp4of'
> Is there a way to make a myocamlbuild.ml file to select the preprocessor 
> to use on a submodule/file basis?

Yes. In the wiki plugin, you have lines such as:

flag ["ocaml"; "compile";  "syntax_"^syntax] & S[A"-syntax"; A syntax];

This means that the "-syntax foo" option will only be added if a package 
"foo" exists AND your compiled file (i.e. ".ml") has tag "syntax_foo". 
So, just tag your files, but not two files with two syntax tags.

> On a similar topic: Is it possible to tell ocamlbuild to use another 
> file than myocamlbuild.ml for additional build instructions? At the 
> moment I have a makefile that changes links to different files, but I'm 
> not happy too with this method.

Unfortunately, not yet.

Romain Bardou