ocaml-community / cppo

C-style preprocessor for OCaml
BSD 3-Clause "New" or "Revised" License
107 stars 26 forks source link

Dune: using both cppo and a ppx #86

Open phstrauss opened 1 year ago

phstrauss commented 1 year ago

Hello, I'm trying to use both cppo and logs-ppx preprocessing in my dune file, I've read:

https://github.com/ocaml-community/cppo https://dune.readthedocs.io/en/stable/quick-start.html#using-cppo https://github.com/ocaml/dune/issues/171 https://github.com/ocsigen/lwt/issues/411 https://github.com/ocaml/dune/pull/7373

but can't get a solution, could you help me? I'm using latest opam with ocaml 5.0.0. Thanks.

My latest poor attempt is:

(rule ((targets (globals.ml)) (deps (globals.cppo.ml)) (action (run ${bin:cppo} ${<} -o ${@}))))

(rule ((targets (plot2d.ml)) (deps (plot2d.cppo.ml)) (action (run ${bin:cppo} ${<} -o ${@}))))

(executables (names eqfrex) (libraries dspml plwrap lablgtk3 cairo2 plplot plcairo react logs logs.fmt) (preprocess (pps logs-ppx) ) (modes (native exe) (byte exe)) )

Regards.

pmetzger commented 1 year ago

This would seem to be a dune question, not a cppo question.